-
Notifications
You must be signed in to change notification settings - Fork 15
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
base: main
Are you sure you want to change the base?
@theguild/components v7 #1587
Conversation
🦋 Changeset detectedLatest commit: 6a6e886 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Co-authored-by: Dimitri POSTOLOV <[email protected]>
📚 Storybook DeploymentThe latest changes are available as preview in: https://eef59b2e.the-guild-docs-storybook.pages.dev |
'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', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'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()
?
'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' + | ||
' ', |
There was a problem hiding this comment.
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' : '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx.parameters.forcedLightMode ? 'light' : '', | |
ctx.parameters.forcedLightMode && 'light', |
); | ||
} | ||
|
||
function HiveIconMark(props: React.SVGProps<SVGSVGElement>) { |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
window.localStorage.removeItem('cookies'); | |
localStorage.removeItem('cookies'); |
export function CookiesConsent(props: CookiesConsentProps) { | ||
const [show, setShow] = useState(() => localStorage.getItem('cookies') !== 'true'); | ||
|
||
const accept = useCallback(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const accept = useCallback(() => { | |
const onAccept = useCallback(() => { |
render(args) { | ||
return <LargeHiveIconDecoration {...args} />; | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
render(args) { | |
return <LargeHiveIconDecoration {...args} />; | |
}, | |
render: LargeHiveIconDecoration, |
should works ?
render(args) { | ||
return <HighlightDecoration {...args} />; | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
render(args) { | |
return <HighlightDecoration {...args} />; | |
}, | |
render: HighlightDecoration, |
should works?
if (typeof window !== 'undefined' && '$crisp' in window) { | ||
(window.$crisp as { push(cmd: string[]): void }).push(['do', 'chat:open']); | ||
event.preventDefault(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const containerRef = useRef<HTMLDivElement>(null); | |
const containerRef = useRef<HTMLDivElement>(null!); |
always available
if (container) { | ||
container.style.setProperty('--border-opacity', scrolled ? '1' : '0'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
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
if (typeof window !== 'undefined' && '$crisp' in window) { | ||
(window.$crisp as { push(cmd: string[]): void }).push(['do', 'chat:open']); | ||
event.preventDefault(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<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}> |
[ | ||
'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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use object, not tuple
[ | ||
'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'], |
There was a problem hiding this comment.
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>) { |
There was a problem hiding this comment.
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>) { |
There was a problem hiding this comment.
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>) { |
There was a problem hiding this comment.
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>) { |
There was a problem hiding this comment.
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); | ||
}, {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}, {}); | |
}); |
onChangeRef.current = onChange; | ||
|
||
useEffect(() => { | ||
if (mounted && markerRef.current && 'IntersectionObserver' in window) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'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
render() { | ||
return <ToolsAndLibrariesCards />; | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
render() { | |
return <ToolsAndLibrariesCards />; | |
}, | |
render: ToolsAndLibrariesCards, |
const cardDecorations = { | ||
[PRODUCTS.HIVE.name](props: React.SVGAttributes<SVGSVGElement>) { | ||
return ( | ||
<svg |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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')], |
There was a problem hiding this comment.
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 *)'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
darkMode: ['variant', '&:not(.light *)'], | |
darkMode: ['variant'], |
this need to be simplified, ping me if you need help
No description provided.