This repository has been archived by the owner on Mar 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev-nextjs' into ci/server-client-deploy
- Loading branch information
Showing
8 changed files
with
758 additions
and
533 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const Cross: React.FC<React.SVGProps<SVGSVGElement>> = (props) => { | ||
return ( | ||
<svg width='20' height='20' fill='#ffffff' viewBox='0 0 256 256' {...props}> | ||
<path d='M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z'></path> | ||
</svg> | ||
); | ||
}; |
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 @@ | ||
export { Modal } from './ui'; |
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,30 @@ | ||
import type { Meta } from '@storybook/react'; | ||
import { useState } from 'react'; | ||
import { Button } from '../button'; | ||
import { Modal } from './ui'; | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction | ||
const meta: Meta<typeof Modal> = { | ||
title: 'shared/Modal', | ||
component: Modal, | ||
tags: ['autodocs'], | ||
argTypes: {} | ||
}; | ||
|
||
export default meta; | ||
|
||
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args | ||
export const Modal_Opened = () => { | ||
const [isModalOpen, setIsModalOpen] = useState(false); | ||
|
||
return ( | ||
<div> | ||
<Modal isOpen={isModalOpen} onClose={() => setIsModalOpen(false)}> | ||
Some Text | ||
</Modal> | ||
<Button typeBtn='primary' size='m' onClick={() => setIsModalOpen(true)}> | ||
Open modal | ||
</Button> | ||
</div> | ||
); | ||
}; |
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 @@ | ||
.modalOverlay { | ||
z-index: 99; | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
display: flex; | ||
width: 100vw; | ||
height: 100vh; | ||
backdrop-filter: blur(8px); | ||
background-color: rgba(0, 0, 0, 0.5); | ||
opacity: 0; | ||
transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; | ||
} | ||
|
||
.modalOverlay__afterOpen { | ||
opacity: 1; | ||
} | ||
|
||
.modalOverlay__beforeClose { | ||
opacity: 0; | ||
} | ||
|
||
.modalBody { | ||
position: absolute; | ||
left: 50%; | ||
bottom: 0; | ||
width: 100%; | ||
padding: 32px; | ||
border-radius: 15px; | ||
background: var(--base-cards-color, #1a1c22); | ||
transition: all 225ms cubic-bezier(0, 0, 0.2, 1) 0ms; | ||
transform: translate(-50%, 100%); | ||
} | ||
|
||
.modalBody__afterOpen { | ||
bottom: 50%; | ||
transform: translate(-50%, 50%); | ||
} | ||
|
||
.modalBody__beforeClose { | ||
bottom: 0; | ||
transform: translate(-50%, 100%); | ||
} | ||
|
||
.modalBody, | ||
.modalBody__afterOpen, | ||
.modalBody__beforeClose { | ||
&.size_l { | ||
max-width: 570px; | ||
} | ||
|
||
&.size_m { | ||
max-width: 470px; | ||
} | ||
|
||
&.size_s { | ||
max-width: 370px; | ||
} | ||
} | ||
|
||
.modalContent { | ||
width: 100%; | ||
height: 100%; | ||
max-height: 80vh; | ||
overflow-y: auto; | ||
} | ||
|
||
.closeButton { | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
width: 52px; | ||
height: 52px; | ||
padding: 16px; | ||
cursor: pointer; | ||
|
||
&:hover path { | ||
stroke: #d42522; | ||
} | ||
} |
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,38 @@ | ||
import classNames from 'clsx'; | ||
import { FC, PropsWithChildren } from 'react'; | ||
import ReactModal from 'react-modal'; | ||
|
||
import styles from './styles.module.scss'; | ||
|
||
import { Cross } from 'shared/assets/Icons/Cross'; | ||
|
||
interface ModalProps { | ||
isOpen: boolean; | ||
onClose?: () => void; | ||
size?: 's' | 'm' | 'l'; | ||
} | ||
|
||
export const Modal: FC<PropsWithChildren<ModalProps>> = (props) => { | ||
const { isOpen, onClose, size = 's', children } = props; | ||
|
||
return ( | ||
<ReactModal | ||
isOpen={isOpen} | ||
closeTimeoutMS={225} | ||
onRequestClose={onClose} | ||
overlayClassName={{ | ||
base: styles.modalOverlay, | ||
afterOpen: styles.modalOverlay__afterOpen, | ||
beforeClose: styles.modalOverlay__beforeClose | ||
}} | ||
className={{ | ||
base: classNames(styles.modalBody, {}, [styles[`size_${size}`]]), | ||
afterOpen: classNames(styles.modalBody__afterOpen, {}, [styles[`size_${size}`]]), | ||
beforeClose: classNames(styles.modalBody__beforeClose, {}, [styles[`size_${size}`]]) | ||
}} | ||
> | ||
<Cross className={styles.closeButton} onClick={onClose} /> | ||
<div className={styles.modalContent}>{children}</div> | ||
</ReactModal> | ||
); | ||
}; |
Oops, something went wrong.