Add /profil to notifications, improve responsiveness

This commit is contained in:
pikiou
2022-03-25 01:37:11 +01:00
parent f65963d91c
commit 8fb7b5287b
21 changed files with 538 additions and 280 deletions

View File

@@ -0,0 +1,53 @@
import { FC, ReactNode, useState } from "react"
import styles from "./styles.module.scss"
type Props = {
children?: ReactNode | undefined
text: string
onClick?: () => void
}
const FormButton: FC<Props> = ({ children, text, onClick }): JSX.Element => {
const [doShowMessage, setDoShowMessage] = useState<boolean>(false)
const showMessage = () => {
setDoShowMessage(true)
}
const onIgnore = () => {
setDoShowMessage(true)
onClick?.()
}
const onCloseIgnore = () => {
setDoShowMessage(false)
}
return (
<>
<button
type="button"
className={styles.greyButton}
onClick={!children ? onClick : showMessage}
>
{text}
</button>
{doShowMessage && (
<div className={styles.infoBeforeIgnore}>
<button type="button" className={styles.closeButton} onClick={onCloseIgnore}>
&#10005;
</button>
<div>{children}</div>
<button type="button" className={styles.greyButton} onClick={onIgnore}>
Ok, ignorer
</button>
</div>
)}
</>
)
}
FormButton.defaultProps = {
children: undefined,
onClick: undefined,
}
export default FormButton

View File

@@ -0,0 +1,30 @@
@import "../../../theme/mixins";
.greyButton {
@include form-grey-button;
margin-top: 10px;
}
.infoBeforeIgnore {
margin-top: 15px;
position: relative;
padding: 15px;
outline: 0;
background-color: $color-white;
}
.closeButton {
position: absolute;
padding: 0;
z-index: 10;
top: 10px;
right: 10px;
width: 20px;
height: 20px;
border-radius: 0;
line-height: 20px;
color: $color-grey-dark;
text-align: center;
background: none;
cursor: pointer;
}