Skip to content

Commit

Permalink
feat: #11 카드 컴포넌트 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
leeminhee119 committed Jul 28, 2024
1 parent 1fdf5f8 commit c9fd3c7
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/component/common/Card/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { css, Interpolation, Theme } from "@emotion/react";

type CardProps = {
width?: string;
height?: string;
rounded?: keyof typeof BORDER_RADIUS;
shadow?: boolean;
padding?: string;
children: React.ReactNode;
styles?: Interpolation<Theme>;
} & React.HTMLAttributes<HTMLDivElement>;

const BORDER_RADIUS = {
sm: ".8rem",
md: "1.2rem",
} as const;

export function Card({ width = "100%", height = "34rem", rounded = "sm", shadow = true, padding = "3rem", styles, children }: CardProps) {
return (
<div
css={[
css`
width: ${width};
height: ${height};
border-radius: ${BORDER_RADIUS[rounded]};
background-color: #fff; // FIXME - design token
box-shadow: ${shadow ? "0 .4rem 1.2rem rgba(0 0 0 / 4%)" : "none"};
padding: ${padding};
`,
styles,
]}
>
{children}
</div>
);
}
1 change: 1 addition & 0 deletions src/component/common/Card/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Card } from "./Card";

0 comments on commit c9fd3c7

Please sign in to comment.