-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(card): adding initial component for the card
- Loading branch information
1 parent
69f7171
commit 6a119fa
Showing
4 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
libs/react-components/src/lib/components/Card/Card.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import Card from './index'; | ||
|
||
const meta = { | ||
title: 'Components/Card', | ||
component: Card, | ||
tags: ['autodocs'], | ||
parameters: { | ||
layout: 'fullscreen', | ||
}, | ||
args: { | ||
title: 'Card title', | ||
content: (<><p>Test content of the card</p></>), | ||
}, | ||
} satisfies Meta<typeof Card>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Basic: Story = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { ReactNode } from 'react'; | ||
import styles from './styles.module.css'; | ||
|
||
interface CardProps { | ||
/** | ||
* The title of the card | ||
*/ | ||
title: string; | ||
/** | ||
* The content of the card | ||
*/ | ||
content: ReactNode; | ||
} | ||
|
||
const Card: React.FC<CardProps> = ({ | ||
title, | ||
content, | ||
}) => { | ||
return ( | ||
<div className={styles.card}> | ||
<h3>{title}</h3> | ||
<div className={styles.content}>{content}</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Card; |
56 changes: 56 additions & 0 deletions
56
libs/react-components/src/lib/components/Card/styles.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
.card { | ||
position: relative; | ||
border-radius: 12px; | ||
border: 1px solid var(--td-web-gray-100, #ced3da); | ||
background: #fff; | ||
height: 100%; | ||
padding: 1.5rem; | ||
overflow: hidden; | ||
} | ||
|
||
.card h3 { | ||
color: var(--td-web-primary-navy, #00233c); | ||
/* Desktop/H3 */ | ||
font-family: Inter; | ||
font-size: 1.5rem; | ||
font-style: normal; | ||
font-weight: 600; | ||
line-height: 34px; /* 141.667% */ | ||
letter-spacing: -0.24px; | ||
margin-top: 0; | ||
margin-bottom: 0; | ||
} | ||
|
||
.card p { | ||
margin-top: 0; | ||
} | ||
|
||
.card .content { | ||
color: var(--td-web-gray-700, #333a3e); | ||
font-family: Inter; | ||
font-size: 18px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 26px; | ||
} | ||
|
||
.card:hover { | ||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12); | ||
} | ||
|
||
.card:hover::after { | ||
transform: scaleX(1); | ||
} | ||
|
||
.card:after { | ||
border-bottom: 2px solid var(--cv-theme-text-logo-on-background); | ||
bottom: 0; | ||
content: ''; | ||
display: block; | ||
left: 0; | ||
position: absolute; | ||
transform: scaleX(0); | ||
transform-origin: 0 50%; | ||
transition: transform 0.25s ease-in-out; | ||
width: 100%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters