mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-09-11 22:06:29 +02:00
Add /profil to notifications, improve responsiveness
This commit is contained in:
53
src/components/Form/IgnoreButton/IgnoreButton.tsx
Normal file
53
src/components/Form/IgnoreButton/IgnoreButton.tsx
Normal 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}>
|
||||
✕
|
||||
</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
|
30
src/components/Form/IgnoreButton/styles.module.scss
Normal file
30
src/components/Form/IgnoreButton/styles.module.scss
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user