Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: migrate Modal to styled-components
- Loading branch information
1 parent
0883ec3
commit 6dce3c5
Showing
10 changed files
with
175 additions
and
319 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
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,28 @@ | ||
import styled from 'styled-components'; | ||
import { COLOR_GRAY_TRANSPARENT_2 } from '../../../styles/colors'; | ||
|
||
const StyledBackDrop = styled.div` | ||
z-index: -1; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
opacity: 0; | ||
background: ${COLOR_GRAY_TRANSPARENT_2}; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
position: fixed; | ||
transition: opacity 0.3s linear, z-index 0.3s linear; | ||
${props => | ||
props.isOpen && | ||
` | ||
visibility: visible; | ||
z-index: 1000000; | ||
opacity: 1; | ||
`}; | ||
`; | ||
|
||
export default StyledBackDrop; |
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,11 @@ | ||
import styled from 'styled-components'; | ||
import ButtonIcon from '../../ButtonIcon'; | ||
|
||
const StyledCloseButton = styled(ButtonIcon)` | ||
position: absolute; | ||
top: 0.5rem; | ||
right: 0.5rem; | ||
z-index: 1000002; | ||
`; | ||
|
||
export default StyledCloseButton; |
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,11 @@ | ||
import styled from 'styled-components'; | ||
|
||
const StyledContent = styled.div` | ||
padding: 1rem; | ||
overflow: hidden; | ||
overflow-y: auto; | ||
-webkit-overflow-scrolling: touch; | ||
box-sizing: border-box; | ||
`; | ||
|
||
export default StyledContent; |
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,11 @@ | ||
import styled from 'styled-components'; | ||
import { COLOR_GRAY_2 } from '../../../styles/colors'; | ||
|
||
const StyledFooter = styled.footer` | ||
border-top: 0.0625px solid ${COLOR_GRAY_2}; | ||
padding: 0.75rem 1rem; | ||
flex-shrink: 0; | ||
display: block; | ||
`; | ||
|
||
export default StyledFooter; |
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,14 @@ | ||
import styled from 'styled-components'; | ||
import { COLOR_GRAY_4 } from '../../../styles/colors'; | ||
|
||
const StyledHeader = styled.header` | ||
font-family: 'Lato Light', Arial, sans-serif; | ||
position: relative; | ||
padding: 1rem; | ||
text-align: center; | ||
font-size: 1.5rem; | ||
color: ${COLOR_GRAY_4}; | ||
display: block; | ||
`; | ||
|
||
export default StyledHeader; |
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,80 @@ | ||
import styled from 'styled-components'; | ||
import { BORDER_RADIUS_1 } from '../../../styles/borderRadius'; | ||
import { COLOR_WHITE } from '../../../styles/colors'; | ||
|
||
const StyledModalContainer = styled.section` | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
width: 55%; | ||
min-width: 18rem; | ||
max-height: 80vh; | ||
min-height: 4rem; | ||
background-color: ${COLOR_WHITE}; | ||
border-radius: ${BORDER_RADIUS_1}; | ||
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.16); | ||
flex-direction: column; | ||
box-sizing: border-box; | ||
display: flex; | ||
justify-content: center; | ||
align-items: normal; | ||
position: relative; | ||
&:focus { | ||
outline: 0; | ||
} | ||
${props => | ||
props.isOpen && | ||
` | ||
animation: slide-up-in 0.2s linear; | ||
opacity: 1; | ||
transform: scale(1, 1) translateY(0); | ||
`}; | ||
${props => | ||
!props.isOpen && | ||
` | ||
animation: slide-down-out 0.2s linear; | ||
opacity: 0; | ||
transform: translateY(50%); | ||
`}; | ||
${props => props.size === 'large' && 'width: 85%;'} | ||
${props => props.size === 'medium' && 'width: 70%;'} | ||
@media (min-width: 1240px) { | ||
width: 520px; | ||
${props => props.size === 'large' && 'width: 920px;'} | ||
${props => props.size === 'medium' && 'width: 720px;'} | ||
} | ||
@media (max-width: 800px) { | ||
width: 95%; | ||
} | ||
@keyframes slide-up-in { | ||
0% { | ||
opacity: 0; | ||
transform: scale(0.8, 0.8) translateY(70%); | ||
} | ||
100% { | ||
opacity: 1; | ||
transform: scale(1, 1) translateY(0); | ||
} | ||
} | ||
@keyframes slide-down-out { | ||
0% { | ||
opacity: 1; | ||
transform: translateY(0); | ||
} | ||
100% { | ||
opacity: 0; | ||
transform: translateY(50%); | ||
} | ||
} | ||
`; | ||
|
||
export default StyledModalContainer; |
Oops, something went wrong.