Fix align teks by adding alignTeks method
This commit is contained in:
@@ -125,6 +125,24 @@ const langToArray = anTeks => {
|
|||||||
return langArray
|
return langArray
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const alignTeks = (langArray, isMobile) => {
|
||||||
|
if (langArray.length > 0 && !isMobile) {
|
||||||
|
return 'justify'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (langArray.length > 0 && isMobile) {
|
||||||
|
return 'justify'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (langArray.length === 0 && isMobile) {
|
||||||
|
return 'justify'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (langArray.length === 0 && !isMobile) {
|
||||||
|
return 'center'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default function TeksDrawer({teks, anTeks}) {
|
export default function TeksDrawer({teks, anTeks}) {
|
||||||
const isMobile = useMediaQuery('(max-width:800px)')
|
const isMobile = useMediaQuery('(max-width:800px)')
|
||||||
const langArray = langToArray(anTeks)
|
const langArray = langToArray(anTeks)
|
||||||
@@ -232,7 +250,7 @@ export default function TeksDrawer({teks, anTeks}) {
|
|||||||
<Typography align='center' className={classes.text} variant='h4'>
|
<Typography align='center' className={classes.text} variant='h4'>
|
||||||
Transcription
|
Transcription
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography paragraph align={langArray.length === 0 && isMobile ? 'justify' : 'center'} component='span'>
|
<Typography paragraph align={alignTeks(langArray, isMobile)} component='span'>
|
||||||
{formatJsonString(anTeks.transkripsyon)}
|
{formatJsonString(anTeks.transkripsyon)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user