Skip to content

Commit

Permalink
feat: Button 컴포넌트 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
feb-dain committed May 16, 2023
1 parent 0617340 commit 6c36b68
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/components/common/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ButtonHTMLAttributes, MouseEventHandler } from 'react';
import styled, { CSSProp } from 'styled-components';

interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {
css: CSSProp;
onClick?: MouseEventHandler<HTMLButtonElement>;
}

const Button = ({ children, ...props }: Props) => {
return <S.Button {...props}>{children}</S.Button>;
};

const S = {
Button: styled.button<{ css: CSSProp }>`
cursor: pointer;
${(props) => props.css}
`,
};

export default Button;
11 changes: 11 additions & 0 deletions src/pages/CartPage.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
import { css } from 'styled-components';
import Button from '../components/common/Button';
import Header from '../components/common/Header';

const CartPage = () => {
return (
<div>
<Header title="STORE" />
<main>
<Button css={orderButtonStyle}>주문하기</Button>
</main>
</div>
);
};

const orderButtonStyle = css`
padding: 26px 120px;
color: #fff;
background: var(--text-color);
`;

export default CartPage;

0 comments on commit 6c36b68

Please sign in to comment.