Skip to content
Open
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
1 change: 0 additions & 1 deletion packages/ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ function App() {
button3
</Button.text>
</div>
{/* <Drawer /> */}
</>
);
}
Expand Down
18 changes: 9 additions & 9 deletions packages/ui/src/components/button/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@ const ButtonSizeMapper = {
[ButtonSize.SMALL]: css({
padding: '8px 6px',
height: '24px',
width: '60px',
fontSize: '12px'
}),
[ButtonSize.MEDIUM]: css({
padding: '10px 12px',
height: '32px',
width: '80px',
fontSize: '14px'
}),
[ButtonSize.LARGE]: css({
padding: '16px 12px',
height: '36px',
width: '160px',
height: '40px',
fontSize: '16px'
})
};
Expand All @@ -46,7 +43,8 @@ export const FilledButton = styled.button<IButtonProps>(
alignItems: 'center',
color: ColorPaletteMapper[ColorPalette.WHITE][100],
backgroundColor: ColorPaletteMapper[props.color][60],
cursor: 'pointer'
cursor: 'pointer',
width: props.width ? `${props.width}px` : '100px'
}),
props => ({ ...ButtonSizeMapper[props.size] }),
props => ({ ...ButtonShapeMapper[props.shape] }),
Expand All @@ -67,7 +65,8 @@ export const OutlinedButton = styled.button<IButtonProps>(
alignItems: 'center',
cursor: 'pointer',
backgroundColor: ColorPaletteMapper[ColorPalette.WHITE][100],
color: ColorPaletteMapper[props.color][60]
color: ColorPaletteMapper[props.color][60],
width: props.width ? `${props.width}px` : '100px'
}),
props => ({ ...ButtonSizeMapper[props.size] }),
props => ({ ...ButtonShapeMapper[props.shape] }),
Expand All @@ -80,11 +79,12 @@ export const OutlinedButton = styled.button<IButtonProps>(
);

export const TextButton = styled.button<IButtonProps>(
{
props => ({
all: 'unset',
cursor: 'pointer',
fontWeight: 600
},
fontWeight: 600,
width: props.width ? `${props.width}px` : '100px'
}),
props => ButtonSizeMapper[props.size],
props => ({
color: ColorPaletteMapper[props.color][60],
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/components/button/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ export interface IButtonProps {
color: ColorPalette;
size: ButtonSize;
shape: ButtonShape;
width?: number;
onClick?: () => void;
}
38 changes: 34 additions & 4 deletions packages/ui/src/components/modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,28 @@ import { MouseEvent } from 'react';
import { XCircle } from '@emotion-icons/bootstrap';
import { css } from '@emotion/react';
import { ColorPalette } from '../color';
import { ModalBackground, ModalContainer, ModalHeader } from './styles';
import Button from '../button';
import { ButtonShape, ButtonSize } from '../button/types';
import {
ModalBackground,
ModalContainer,
ModalFooter,
ModalHeader
} from './styles';
import { TModal } from './types';

const Modal: TModal = ({ children, closeHandler }) => {
const Modal: TModal = ({
children,
onCloseModal,
onClickCancel,
onClickConfirm
}) => {
const stopPropagation = (event: MouseEvent<HTMLDivElement>) => {
event.stopPropagation();
};

return (
<ModalBackground onClick={closeHandler}>
<ModalBackground onClick={onCloseModal}>
<ModalContainer onClick={stopPropagation}>
<ModalHeader>
<XCircle
Expand All @@ -21,10 +33,28 @@ const Modal: TModal = ({ children, closeHandler }) => {
cursor: pointer;
color: ${ColorPalette.GRAY};
`}
onClick={closeHandler}
onClick={onCloseModal}
/>
</ModalHeader>
{children}
<ModalFooter>
<Button.outlined
width={182}
shape={ButtonShape.RECTANGLE}
color={ColorPalette.PINK}
size={ButtonSize.MEDIUM}
onClick={onClickCancel}>
취소
</Button.outlined>
<Button.filled
width={182}
shape={ButtonShape.RECTANGLE}
color={ColorPalette.PINK}
size={ButtonSize.MEDIUM}
onClick={onClickConfirm}>
확인
</Button.filled>
</ModalFooter>
</ModalContainer>
</ModalBackground>
);
Expand Down
12 changes: 12 additions & 0 deletions packages/ui/src/components/modal/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const ModalBackground = styled.div`
`;

export const ModalContainer = styled.div`
position: relative;
background-color: ${ColorPaletteMapper[ColorPalette.WHITE][100]};
width: 100%;
height: 100%;
Expand All @@ -32,3 +33,14 @@ export const ModalHeader = styled.div`
justify-content: flex-end;
align-items: center;
`;

export const ModalFooter = styled.div`
position: absolute;
bottom: 12px;
height: 60px;
padding: 12px;
display: flex;
justify-content: space-between;
align-items: center;
column-gap: 12px;
`;
4 changes: 3 additions & 1 deletion packages/ui/src/components/modal/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { FC, ReactNode } from 'react';

export interface IModalProps {
children: ReactNode;
closeHandler: () => void;
onCloseModal: () => void;
onClickConfirm: () => void;
onClickCancel: () => void;
}

export type TModal = FC<IModalProps>;