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

Product card tweaks for main #1956

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/slimy-trainers-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@theguild/components": patch
---

Tweak ProductCard styles on mobile
1 change: 1 addition & 0 deletions packages/components/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ export * from './explore-main-product-cards';
export * from './text-link';
export * from './contact-us';
export { Giscus } from './giscus';
export * from './product-card';
export * from './version-dropdown';
export * from './dropdown';
24 changes: 13 additions & 11 deletions packages/components/src/components/product-card/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cn } from '../../cn';
import { FOUR_MAIN_PRODUCTS, ProductInfo, PRODUCTS } from '../../products';
import { HighlightDecoration } from '../decorations';
import { DecorationIsolation, HighlightDecoration } from '../decorations';
import { ArrowIcon } from '../icons';
import { ReactComponent as HiveDecoration } from './hive-decoration.svg';
import { ReactComponent as HiveGatewayDecoration } from './hive-gateway-decoration.svg';
Expand All @@ -23,7 +23,7 @@ export function MainProductCard({ as: Root, product, className, ...rest }: Produ
return (
<Root
className={cn(
'hive-focus-within group relative flex-1 shrink-0 basis-[283.5px] overflow-hidden rounded-2xl bg-blue-400 text-green-1000 max-md:w-[283.5px]',
'hive-focus-within group flex-1 shrink-0 basis-[283.5px] overflow-hidden rounded-2xl bg-blue-400 text-green-1000 max-md:min-w-[283.5px]',
isHive && 'bg-green-1000 text-white',
className,
)}
Expand All @@ -36,16 +36,18 @@ export function MainProductCard({ as: Root, product, className, ...rest }: Produ
<p className="font-medium">{product.name}</p>
<Icon className="mt-8" />
<ArrowIcon className="absolute bottom-8 right-8" />
<DecorationIsolation>
<Decoration
strokeWidth="0.5px"
className={cn(
'pointer-events-none absolute bottom-0 right-0 h-full fill-blue-200 opacity-0 transition-opacity duration-500 group-focus-within:opacity-100 group-hover:opacity-100',
isHive && 'fill-blue-700',
)}
preserveAspectRatio="xMidYMid meet"
/>
<HighlightDecoration className="pointer-events-none absolute left-0 top-[-15%] h-[150%] w-full opacity-0 transition-opacity duration-1000 group-focus-within:opacity-100 group-hover:opacity-100" />
</DecorationIsolation>
</a>
<Decoration
strokeWidth="0.5px"
className={cn(
'pointer-events-none absolute bottom-0 right-0 h-full fill-blue-200 opacity-0 transition-opacity duration-500 group-focus-within:opacity-100 group-hover:opacity-100',
isHive && 'fill-blue-700',
)}
preserveAspectRatio="xMidYMid meet"
/>
<HighlightDecoration className="pointer-events-none absolute left-0 top-[-15%] h-[150%] w-full opacity-0 transition-opacity duration-1000 group-focus-within:opacity-100 group-hover:opacity-100" />
</Root>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const Default: StoryObj<typeof ProductCard> = {
name: 'ProductCard',
render() {
return (
<ul className="mt-5 grid grid-cols-4 gap-5 overflow-x-auto p-4 last-of-type:mb-24">
<ul className="mt-5 grid grid-cols-1 gap-5 overflow-x-auto p-4 last-of-type:mb-24 sm:grid-cols-4">
{productsLexicographically.map(product => (
<ProductCard as="li" key={product.name} product={product} />
))}
Expand Down
Loading