Skip to content

Commit

Permalink
feat: (#258) 토스트 컴포넌트 제작
Browse files Browse the repository at this point in the history
  • Loading branch information
chsua committed Aug 5, 2023
1 parent fe1a8e5 commit 0a8f079
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
12 changes: 12 additions & 0 deletions frontend/src/components/common/Toast/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Size } from '@type/style';

import * as S from './style';

interface ToastProps {
children: string;
size: Size | 'free';
}

export default function Toast({ children, size }: ToastProps) {
return <S.Wrapper $size={size}>{children}</S.Wrapper>;
}
28 changes: 28 additions & 0 deletions frontend/src/components/common/Toast/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { styled } from 'styled-components';

import { Size } from '@type/style';

const squareSize = {
sm: { width: '250px', height: '30px' },
md: { width: '400px', height: '35px' },
lg: { width: '500px', height: '40px' },
free: { width: '80%', height: '40px' },
};

export const Wrapper = styled.div<{ $size: Size | 'free' }>`
display: flex;
align-items: center;
justify-content: center;
width: ${props => squareSize[props.$size].width};
height: ${props => squareSize[props.$size].height};
border-radius: 4px;
position: fixed;
background-color: rgba(0, 0, 0, 0.5);
color: var(--white);
font: var(--text-caption);
letter-spacing: 1px;
`;

0 comments on commit 0a8f079

Please sign in to comment.