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

[FEAT] 카드 큐레이션 컴포넌트 구현 #38

Merged
merged 7 commits into from
Jan 13, 2025
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
4 changes: 4 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import '../src/styles/fonts.css';
import '../src/styles/global.css';
import '../src/styles/reset.css';

import type { Preview } from '@storybook/react';

const preview: Preview = {
Expand Down
28 changes: 0 additions & 28 deletions src/components/common/Button/Button.tsx

This file was deleted.

83 changes: 0 additions & 83 deletions src/components/common/Button/button.css.ts

This file was deleted.

24 changes: 24 additions & 0 deletions src/components/curation/CurationCard/CurationCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as styles from './curationCard.css';

interface CurationCardProps {
bgImage: string;
title: string;
subtitle: string;
onClick: () => void;
}

const CurationCard = ({ bgImage, title, subtitle, onClick }: CurationCardProps) => {
return (
<button
className={styles.cardContainer}
style={{ backgroundImage: `url(${bgImage})` }}
onClick={onClick}>
<div className={styles.textbox}>
<p className={styles.title}>{title}</p>
<p className={styles.subtitle}>{subtitle}</p>
</div>
</button>
);
};

export default CurationCard;
30 changes: 30 additions & 0 deletions src/components/curation/CurationCard/curationCard.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import theme from '@styles/theme.css';
import { style } from '@vanilla-extract/css';

export const cardContainer = style({
width: '28.5rem',
height: '26.8rem',
borderRadius: '8px',
overflow: 'hidden',
backgroundSize: 'cover',
backgroundPosition: 'center',
display: 'flex',
alignItems: 'flex-end',

padding: '1.6rem',
color: theme.COLORS.white,
});

export const textbox = style({
display: 'flex',
flexDirection: 'column',
textAlign: 'start',
});

export const title = style({
...theme.FONTS.h3Sb18,
});

export const subtitle = style({
...theme.FONTS.b9R15,
});
67 changes: 0 additions & 67 deletions src/stories/Button.stories.ts

This file was deleted.

37 changes: 37 additions & 0 deletions src/stories/CurationCard.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import CurationCard from '@components/curation/CurationCard/CurationCard';
import type { Meta, StoryObj } from '@storybook/react';

const meta = {
title: 'Curation/CurationCard',
component: CurationCard,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
argTypes: {
bgImage: {
control: { type: 'text' },
},
title: {
control: { type: 'text' },
},
subtitle: {
control: { type: 'text' },
},
onClick: {
action: 'clicked',
},
},
args: {
bgImage: 'https://img.danawa.com/images/descFiles/6/110/5109431_agiLaciMHn_1659098198501.jpeg',
title: '고양이 있는 절 봤어?',
subtitle: '용문사에 있는 고양이 좀 봐. 귀엽지?',
onClick: () => alert('click !'),
},
} satisfies Meta<typeof CurationCard>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {};
Loading