Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@theguild/components v7 #1587

Open
wants to merge 52 commits into
base: main
Choose a base branch
from
Open

@theguild/components v7 #1587

wants to merge 52 commits into from

Conversation

dimaMachina
Copy link
Collaborator

No description provided.

.changeset/pre.json Outdated Show resolved Hide resolved
Copy link

changeset-bot bot commented Aug 2, 2024

🦋 Changeset detected

Latest commit: 6a6e886

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@theguild/components Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dimaMachina dimaMachina mentioned this pull request Aug 2, 2024
.changeset/pre.json Outdated Show resolved Hide resolved
.changeset/pre.json Outdated Show resolved Hide resolved
Copy link
Contributor

github-actions bot commented Aug 2, 2024

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@theguild/components 7.0.0-alpha-20241007100828-6a6e886c53b8fb1e9699760f5a1a98a13f0b26a8 npm ↗︎ unpkg ↗︎

Copy link
Contributor

github-actions bot commented Aug 7, 2024

📚 Storybook Deployment

The latest changes are available as preview in: https://eef59b2e.the-guild-docs-storybook.pages.dev

Comment on lines +59 to +62
'relative block rounded-lg sm:w-fit' +
' px-6 py-3 font-medium leading-6 text-green-1000' +
' relative flex flex-row items-center justify-center gap-2 text-nowrap' +
' dark:text-neutral-200',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'relative block rounded-lg sm:w-fit' +
' px-6 py-3 font-medium leading-6 text-green-1000' +
' relative flex flex-row items-center justify-center gap-2 text-nowrap' +
' dark:text-neutral-200',
'relative block rounded-lg sm:w-fit',
'px-6 py-3 font-medium leading-6 text-green-1000',
'relative flex flex-row items-center justify-center gap-2 text-nowrap',
'dark:text-neutral-200',

why to use + if we have cn()?

Comment on lines +6 to +25
'bg-primary hover:bg-green-800 hover:text-white' +
' focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-green-800' +
' dark:text-neutral-800 dark:hover:text-neutral-900 dark:bg-neutral-100 dark:hover:bg-white',
),
'primary-inverted': cn(
'bg-primary hover:bg-white' +
' focus-visible:outline-4 focus-visible:outline-offset-0 focus-visible:outline-white/40',
),
secondary: cn(
'bg-green-300 hover:bg-green-200' +
' focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-green-300/40',
),
'secondary-inverted': cn(
'bg-green-800 hover:bg-green-700 text-white' +
' focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-green-800/40',
),
tertiary: cn(
'bg-transparent text-green-1000' +
' focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-green-800' +
' ',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, we don't need to use +, since we have cn()

className={cn(
'text-green-1000',
neueMontreal.variable,
ctx.parameters.forcedLightMode ? 'light' : '',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ctx.parameters.forcedLightMode ? 'light' : '',
ctx.parameters.forcedLightMode && 'light',

);
}

function HiveIconMark(props: React.SVGProps<SVGSVGElement>) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to .svg

@@ -65,6 +65,8 @@
"dependencies": {
"@giscus/react": "3.0.0",
"@next/bundle-analyzer": "14.2.13",
"@radix-ui/react-navigation-menu": "^1.2.0",
"@theguild/tailwind-config": "0.5.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need it now as a dependency?

<CallToAction
className="m-2"
onClick={() => {
window.localStorage.removeItem('cookies');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
window.localStorage.removeItem('cookies');
localStorage.removeItem('cookies');

export function CookiesConsent(props: CookiesConsentProps) {
const [show, setShow] = useState(() => localStorage.getItem('cookies') !== 'true');

const accept = useCallback(() => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const accept = useCallback(() => {
const onAccept = useCallback(() => {

Comment on lines +43 to +45
render(args) {
return <LargeHiveIconDecoration {...args} />;
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
render(args) {
return <LargeHiveIconDecoration {...args} />;
},
render: LargeHiveIconDecoration,

should works ?

Comment on lines +36 to +38
render(args) {
return <HighlightDecoration {...args} />;
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
render(args) {
return <HighlightDecoration {...args} />;
},
render: HighlightDecoration,

should works?

Comment on lines +31 to +34
if (typeof window !== 'undefined' && '$crisp' in window) {
(window.$crisp as { push(cmd: string[]): void }).push(['do', 'chat:open']);
event.preventDefault();
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (typeof window !== 'undefined' && '$crisp' in window) {
(window.$crisp as { push(cmd: string[]): void }).push(['do', 'chat:open']);
event.preventDefault();
}
(window.$crisp as { push(cmd: string[]): void }).push(['do', 'chat:open']);
event.preventDefault();

onClick is not available on server

</Anchor>
))}
</div>
<p className="text-sm">© 2024 The Guild</p>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p className="text-sm">© 2024 The Guild</p>
<p className="text-sm">© {new Date().getFullYear()} The Guild</p>


const isHive = productName === 'Hive';

const containerRef = useRef<HTMLDivElement>(null);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const containerRef = useRef<HTMLDivElement>(null);
const containerRef = useRef<HTMLDivElement>(null!);

always available

Comment on lines +90 to +92
if (container) {
container.style.setProperty('--border-opacity', scrolled ? '1' : '0');
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (container) {
container.style.setProperty('--border-opacity', scrolled ? '1' : '0');
}
container.style.setProperty('--border-opacity', scrolled ? '1' : '0');

{children}

{renderSlot(Search, {
// The && and :is(x) selector bump the specificity to 0-2-2 to override Nextra styles.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't do this, it's too overcomplicates all the things, it will be broken and difficult to maintain

Comment on lines +159 to +162
if (typeof window !== 'undefined' && '$crisp' in window) {
(window.$crisp as { push(cmd: string[]): void }).push(['do', 'chat:open']);
event.preventDefault();
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (typeof window !== 'undefined' && '$crisp' in window) {
(window.$crisp as { push(cmd: string[]): void }).push(['do', 'chat:open']);
event.preventDefault();
}
(window.$crisp as { push(cmd: string[]): void }).push(['do', 'chat:open']);
event.preventDefault();

const MenuContentColumns = forwardRef(
(props: MenuContentColumnsProps, ref: React.ForwardedRef<HTMLDivElement>) => {
return (
<div className="flex gap-x-6 [&>*]:flex [&>*]:flex-col [&>*]:gap-4" ref={ref} {...props}>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<div className="flex gap-x-6 [&>*]:flex [&>*]:flex-col [&>*]:gap-4" ref={ref} {...props}>
<div className="flex gap-x-6 *:flex *:flex-col *:gap-4" ref={ref} {...props}>

Comment on lines +327 to +342
[
'Documentation',
PaperIcon,
isHive ? '/docs' : 'https://the-guild.dev/graphql/hive/docs',
],
['Status', TargetIcon, 'https://status.graphql-hive.com/'],
[
'Product Updates',
RightCornerIcon,
isHive
? '/product-updates'
: 'https://the-guild.dev/graphql/hive/product-updates',
],
['Blog', PencilIcon, 'https://the-guild.dev/blog'],
['GitHub', GitHubIcon, 'https://github.com/kamilkisiela/graphql-hive'],
] as const
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use object, not tuple

Comment on lines +355 to +362
[
'YouTube',
YouTubeIcon,
'https://www.youtube.com/watch?v=d_GBgH-L5c4&list=PLhCf3AUOg4PgQoY_A6xWDQ70yaNtPYtZd',
],
['X', TwitterIcon, 'https://x.com/theguilddev'],
['LinkedIn', LinkedInIcon, 'https://www.linkedin.com/company/the-guild-software/'],
['Discord', DiscordIcon, 'https://discord.com/invite/xud7bH9'],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, object, not tuple

// These icons are _different_ than the ones used elsewhere.
// e.g. Discord is a "chat" bubble with the Discord logo in the center.

function YouTubeIcon(props: React.SVGProps<SVGSVGElement>) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to .svg

);
}

function TwitterIcon(props: React.SVGProps<SVGSVGElement>) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to .svg

);
}

function LinkedInIcon(props: React.SVGProps<SVGSVGElement>) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to svg

);
}

function DiscordIcon(props: React.SVGProps<SVGSVGElement>) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to svg

const marker = markerRef.current;
const observer = new IntersectionObserver(entries => {
onChangeRef.current(entries[0].boundingClientRect.y < -1);
}, {});
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}, {});
});

onChangeRef.current = onChange;

useEffect(() => {
if (mounted && markerRef.current && 'IntersectionObserver' in window) {
Copy link
Collaborator Author

@dimaMachina dimaMachina Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (mounted && markerRef.current && 'IntersectionObserver' in window) {
if (mounted && markerRef.current) {

it's available in all modern browsers

>
<NavigationMenuPrimitive.Viewport
className={cn(
'relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-[var(--radix-navigation-menu-viewport-width)] origin-[top_center] overflow-hidden rounded-xl border border-beige-200 bg-white shadow-[0px_16px_32px_-12px_rgba(14,18,27,0.10)] ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-90 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 dark:border-neutral-800 dark:bg-neutral-900',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-[var(--radix-navigation-menu-viewport-width)] origin-[top_center] overflow-hidden rounded-xl border border-beige-200 bg-white shadow-[0px_16px_32px_-12px_rgba(14,18,27,0.10)] ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-90 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 dark:border-neutral-800 dark:bg-neutral-900',
'relative mt-1.5 h-[--radix-navigation-menu-viewport-height] w-[--radix-navigation-menu-viewport-width] origin-[top_center] overflow-hidden rounded-xl border border-beige-200 bg-white shadow-[0px_16px_32px_-12px_rgba(14,18,27,0.10)] ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-90 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 dark:border-neutral-800 dark:bg-neutral-900',

use shorthand

Comment on lines +16 to +18
render() {
return <ToolsAndLibrariesCards />;
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
render() {
return <ToolsAndLibrariesCards />;
},
render: ToolsAndLibrariesCards,

const cardDecorations = {
[PRODUCTS.HIVE.name](props: React.SVGAttributes<SVGSVGElement>) {
return (
<svg
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to svg

"@theguild/components": "workspace:*",
"@theguild/components": "^6",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use from workspace

@@ -17,4 +26,6 @@ export default {
},
},
},
darkMode: ['variant', '&:not(.light *)'],
plugins: [require('tailwindcss-animate')],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use import

@@ -17,4 +26,6 @@ export default {
},
},
},
darkMode: ['variant', '&:not(.light *)'],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
darkMode: ['variant', '&:not(.light *)'],
darkMode: ['variant'],

this need to be simplified, ping me if you need help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants