-
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.
1. Add components: - Overlay; - Modal; 2. Add animation in scss in this components;
- Loading branch information
Andrey Golovachev (moonzaki)
committed
Nov 13, 2024
1 parent
571d9e4
commit 4fc4330
Showing
9 changed files
with
151 additions
and
10 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
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,20 @@ | ||
import Button from '../Button/Button'; | ||
import Text from '../Text/Text'; | ||
import CloseIcon from '@mui/icons-material/Close'; | ||
import './Modal.scss'; | ||
|
||
function Modal({ ...props }) { | ||
const { overlay, isOverlay } = props; | ||
|
||
return ( | ||
<div className={`modal${isOverlay ? ' active' : ''}`}> | ||
<Text tag="h2" className="modal__title">Modal | ||
<Button className="button" onClick={() => overlay(false)}> | ||
<CloseIcon style={{ color: '#313131' }} /> | ||
</Button> | ||
</Text> | ||
</div> | ||
); | ||
} | ||
|
||
export default Modal; |
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,55 @@ | ||
$transition: .15s; | ||
|
||
.modal { | ||
width: 500px; | ||
aspect-ratio: 1; | ||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); | ||
background: white; | ||
border-radius: 15px; | ||
padding: 15px; | ||
opacity: 0; | ||
visibility: hidden; | ||
transform: translate(0%, -30%); | ||
transition: opacity $transition ease-in-out, visibility 0s $transition; | ||
|
||
&__title { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
gap: 20px; | ||
} | ||
|
||
&.active { | ||
opacity: 1; | ||
visibility: visible; | ||
animation: slideIn $transition ease-in-out forwards; | ||
animation-delay: $transition; | ||
} | ||
|
||
&:not(.active) { | ||
animation: slideOut $transition ease-in-out forwards; | ||
|
||
} | ||
} | ||
|
||
@keyframes slideIn { | ||
0% { | ||
opacity: 0; | ||
transform: translate(0%, -30%); | ||
} | ||
|
||
100% { | ||
opacity: 1; | ||
transform: translate(0%, 0%); | ||
} | ||
} | ||
|
||
@keyframes slideOut { | ||
0% { | ||
transform: translate(0%, 0%); | ||
} | ||
|
||
100% { | ||
transform: translate(0%, 30%); | ||
} | ||
} |
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,10 @@ | ||
import './Overlay.scss'; | ||
|
||
function overlay({ children, ...props }) { | ||
const { active } = props; | ||
return ( | ||
<div className={`overlay${active ? ' active' : ''}`}>{children}</div> | ||
); | ||
} | ||
|
||
export default overlay; |
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,19 @@ | ||
.overlay { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 100vw; | ||
height: 100vh; | ||
background-color: rgba(0, 0, 0, 0.5); | ||
opacity: 0; | ||
visibility: hidden; | ||
transition: .3s; | ||
|
||
&.active { | ||
opacity: 1; | ||
visibility: visible; | ||
} | ||
} |