diff --git a/components/awtis/awtis-detay.js b/components/awtis/awtis-detay.js new file mode 100644 index 0000000..8c6615a --- /dev/null +++ b/components/awtis/awtis-detay.js @@ -0,0 +1,117 @@ +import {useState} from 'react' +import PropTypes from 'prop-types' +import {Accordion, AccordionDetails, AccordionSummary, Box, Button, CardActionArea, Chip, Container, Grid, Paper} from '@mui/material' +import {useRouter} from 'next/router' +import Card from '@mui/material/Card' +import CardContent from '@mui/material/CardContent' +import Avatar from '@mui/material/Avatar' +import Typography from '@mui/material/Typography' +import {green} from '@mui/material/colors' +import ExpandMoreIcon from '@mui/icons-material/ExpandMore' +import KeyboardBackspaceIcon from '@mui/icons-material/KeyboardBackspace' + +import AwtisBiyografi from './awtis-biyografi' +import MizikLis from './mizik-lis' + +const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:1337' + +const sortTeks = teks => teks.sort((a, b) => b.id - a.id) + +export default function AwtisDetay({anAwtis}) { + const router = useRouter() + const [esByografiOuve, meteEsByografiOuve] = useState(false) + const {alias, biyografi, teks, foto} = anAwtis + const sortedTeks = sortTeks(teks) + const gwanBiyo = anAwtis.biyografi.length > 100 + + const biyo = gwanBiyo ? `${anAwtis.biyografi.slice(0, 100)}...` : anAwtis.biyografi + + const handleClick = () => { + meteEsByografiOuve(true) + } + + const handleBack = () => { + const href = '/awtis?paj&paj=1' + const as = '/awtis/paj/1' + router.push(href, as) + } + + return ( + + + + {alias} + + + + + + + + + + {biyo && ( + + + + + + Biographie + + + {biyo} + + + + + + )} + + + {teks.length > 1 ? ( + + } + aria-controls='panel-teks-content' + id='panel-teks-header' + > + Liste des textes + + + + + + + ) : ( + <> + Texte + + + + + )} + + + + {esByografiOuve && ( + + )} + + ) +} + +AwtisDetay.propTypes = { + anAwtis: PropTypes.object.isRequired +}