From 088f40a9338033be298f9b2995591d1426ff1309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Fri, 11 Dec 2020 01:50:24 +0100 Subject: [PATCH] Create AwtisBio component --- components/awtis/awtis-bio.js | 83 +++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 components/awtis/awtis-bio.js diff --git a/components/awtis/awtis-bio.js b/components/awtis/awtis-bio.js new file mode 100644 index 0000000..fee9a2a --- /dev/null +++ b/components/awtis/awtis-bio.js @@ -0,0 +1,83 @@ +import React from 'react' +import PropTypes from 'prop-types' + +import { + Button, + Box, + Typography, + Dialog, + DialogActions, + DialogContent, + DialogContentText, + DialogTitle +} from '@material-ui/core' + +import MizikBadjMeni from './mizik-badj-meni' + +export default function AwtisBio({alias, miziks, bio, isBioOpen, setIsBioOpen}) { + const handleClose = () => { + setIsBioOpen(false) + } + + const descriptionElementRef = React.useRef(null) + React.useEffect(() => { + if (isBioOpen) { + const {current: descriptionElement} = descriptionElementRef + if (descriptionElement !== null) { + descriptionElement.focus() + } + } + }, [isBioOpen]) + + return ( +
+ + + {alias} + + + + + {bio ? ( + + {bio} + + ) : ( + + Pas de biobraphie disponible + + )} + + + + + + +
+ ) +} + +AwtisBio.propTypes = { + alias: PropTypes.string.isRequired, + miziks: PropTypes.array.isRequired, + bio: PropTypes.string, + isBioOpen: PropTypes.bool.isRequired, + setIsBioOpen: PropTypes.func.isRequired +} + +AwtisBio.defaultProps = { + bio: null +}