Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
27 changes: 27 additions & 0 deletions src/components/Card/Card.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,30 @@ export const Clickable: Story = {
onClick: () => console.log('Clicked!'),
},
}

export const ClickableHover: Story = {
parameters: {
docs: {
description: {
story:
'Hover a clickable card to surface the `border-hover` color swap.',
},
},
},
render: args => (
<div className="flex flex-col gap-4">
{(['default', 'outline', 'muted'] as const).map(variant => (
<Card key={variant} {...args} variant={variant} render={<button />}>
<CardHeader>
<CardTitle className="capitalize">{variant}</CardTitle>
<CardDescription>Hover me</CardDescription>
</CardHeader>
</Card>
))}
</div>
),
args: {
clickable: true,
onClick: () => console.log('Clicked!'),
},
}
5 changes: 4 additions & 1 deletion src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ export const cardVariants = cva(
muted: 'bg-background-muted border-1 border-border-card',
},
clickable: {
true: ['cursor-pointer hover:opacity-80', focusRingVariants()],
true: [
'cursor-pointer hover:border-transparent hover:ring-2 hover:ring-border-hover',
focusRingVariants(),
],
},
disabled: {
true: 'opacity-50 cursor-default pointer-events-none hover:border-border-card',
Expand Down
Loading