forked from boostcampwm-2022/web05-SleepyWoods
-
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.
[feat] boostcampwm-2022#179 안내 페이지 모달창
- Loading branch information
Showing
4 changed files
with
233 additions
and
3 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,45 @@ | ||
import { useState } from 'react'; | ||
import help from '../../assets/icon/help.svg'; | ||
import keyboardArrow from '../../assets/icon/keyboardArrow.svg'; | ||
import keyboardSpace from '../../assets/icon/keyboardSpace.svg'; | ||
import keyboardShift from '../../assets/icon/keyboardShift.svg'; | ||
import keyboardA from '../../assets/icon/keyboardA.svg'; | ||
import keyboardR from '../../assets/icon/keyboardR.svg'; | ||
import * as style from './info.styled'; | ||
|
||
const Help = () => { | ||
const [isShowModal, setIsShowModal] = useState(false); | ||
const [animation, setAnimation] = useState('show'); | ||
|
||
const handleModal = () => { | ||
if (isShowModal) { | ||
setAnimation('close'); | ||
setTimeout(() => setIsShowModal(false), 300); | ||
} else { | ||
setAnimation('show'); | ||
setIsShowModal(true); | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
{isShowModal && ( | ||
<> | ||
<section css={style.modal(animation)}> | ||
<button | ||
type="button" | ||
css={style.closeBtn} | ||
onClick={handleModal}></button> | ||
<h3 css={style.header}>📋 Notice</h3> | ||
</section> | ||
</> | ||
)} | ||
<button | ||
type="button" | ||
onClick={handleModal} | ||
css={style.info(help)}></button> | ||
</> | ||
); | ||
}; | ||
|
||
export default Help; |
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,79 @@ | ||
import { css } from '@emotion/react'; | ||
import help from '../../assets/icon/help.svg'; | ||
import help2 from '../../assets/icon/help2.svg'; | ||
import close from '../../assets/icon/close.svg'; | ||
|
||
export const helpBtn = css` | ||
width: 60px; | ||
height: 60px; | ||
position: absolute; | ||
bottom: 55px; | ||
right: 60px; | ||
background-image: url(${help2}); | ||
background-repeat: no-repeat; | ||
background-position: center; | ||
`; | ||
|
||
export const modal = (animation: string) => css` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
flex-flow: column; | ||
width: 60%; | ||
min-width: 600px; | ||
max-width: 800px; | ||
height: 60%; | ||
min-height: 400px; | ||
max-height: 600px; | ||
padding: 20px; | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -60%); | ||
border-radius: 0 20px 20px 20px; | ||
background-color: rgba(255, 255, 255, 0.9); | ||
animation: ${animation} 0.3s ease-in-out; | ||
@keyframes show { | ||
from { | ||
opacity: 0; | ||
} | ||
to { | ||
opacity: 1; | ||
} | ||
} | ||
@keyframes close { | ||
from { | ||
opacity: 1; | ||
} | ||
to { | ||
opacity: 0; | ||
} | ||
} | ||
`; | ||
|
||
export const closeBtn = css` | ||
position: absolute; | ||
top: 20px; | ||
right: 20px; | ||
width: 20px; | ||
height: 20px; | ||
opacity: 0.7; | ||
padding: 5px; | ||
::after { | ||
content: ''; | ||
display: block; | ||
width: 20px; | ||
height: 20px; | ||
background-image: url(${close}); | ||
background-position: center; | ||
background-repeat: no-repeat; | ||
background-size: contain; | ||
} | ||
`; |
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