-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…tization feat: 모달 분리
- Loading branch information
Showing
10 changed files
with
192 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React, { ReactNode } from 'react'; | ||
|
||
type ButtonProps = { | ||
onClick?: React.MouseEventHandler<HTMLButtonElement>; | ||
children?: ReactNode; | ||
}; | ||
|
||
const Button: React.FC<ButtonProps> = ({ onClick, children }: ButtonProps) => { | ||
return ( | ||
<button type='button' onClick={onClick} style={{ padding: 0 }}> | ||
{children} | ||
</button> | ||
); | ||
}; | ||
|
||
export default Button; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
frontend/web/src/components/molecules/modal_close_button.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
import { IoMdClose } from 'react-icons/io'; | ||
import { RecoilState, useSetRecoilState } from 'recoil'; | ||
import theme from '../../theme'; | ||
import Button from '../atoms/button'; | ||
import FlexRow from './flex_row'; | ||
|
||
type modalCloseButtonProps = { | ||
setState: RecoilState<boolean>; | ||
}; | ||
|
||
const ModalCloseButton: React.FC<modalCloseButtonProps> = ({ setState }: modalCloseButtonProps) => { | ||
const setModalOpen = useSetRecoilState(setState); | ||
|
||
return ( | ||
<FlexRow> | ||
<div /> | ||
<Button onClick={() => setModalOpen(false)}> | ||
<IoMdClose size={50} color={theme.inputColor} /> | ||
</Button> | ||
</FlexRow> | ||
); | ||
}; | ||
|
||
export default ModalCloseButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* eslint-disable @typescript-eslint/no-non-null-assertion */ | ||
import React, { ReactNode } from 'react'; | ||
import styled from 'styled-components'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
const Background = styled.div` | ||
height: 100%; | ||
width: 100%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
position: fixed; | ||
left: 0; | ||
top: 0; | ||
background: rgb(0, 0, 0, 0.5); | ||
z-index: 10000; | ||
`; | ||
|
||
const Container = styled.div<{ width: number; height: number }>` | ||
width: ${(props) => `${props.width}rem`}; | ||
height: ${(props) => `${props.height}rem`}; | ||
position: relative; | ||
border-radius: 2%; | ||
text-align: center; | ||
padding: 2vh; | ||
background-color: white; | ||
box-shadow: 1px 1px 13px #4a4848; | ||
`; | ||
|
||
type centeredModalProps = { children: ReactNode; width: number; height: number }; | ||
|
||
const CenteredModal: React.FC<centeredModalProps> = ({ | ||
children, | ||
width, | ||
height, | ||
}: centeredModalProps) => { | ||
return ReactDOM.createPortal( | ||
<Background> | ||
<Container width={width} height={height}> | ||
{children} | ||
</Container> | ||
</Background>, | ||
document.getElementById('modal-root')!, | ||
); | ||
}; | ||
|
||
export default CenteredModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.