Skip to content

Commit

Permalink
feat(components): add Card component
Browse files Browse the repository at this point in the history
  • Loading branch information
Callenowy committed Jan 20, 2024
1 parent cbeb331 commit 61d8262
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/components/card/card.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { render, screen } from '@testing-library/react';
import { Card } from './card';

describe('Card', () => {
it('renders children inside a div with correct styles', () => {
render(
<Card data-testid="card">
<span>Card Content</span>
</Card>
);

expect(screen.getByTestId('card')).toBeInTheDocument();
expect(screen.getByTestId('card')).toHaveClass(
'w-full rounded-[10px] bg-white p-8 shadow'
);
});
});
17 changes: 17 additions & 0 deletions src/components/card/card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { cn } from '@/utils/cn';

export const Card = ({
children,
className,
...rest
}: React.PropsWithChildren<React.HTMLAttributes<HTMLDivElement>>) => (
<div
className={cn(
'w-full rounded-[10px] bg-white p-6 shadow-base md:p-8',
className
)}
{...rest}
>
{children}
</div>
);
1 change: 1 addition & 0 deletions src/components/card/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './card';

0 comments on commit 61d8262

Please sign in to comment.