Show tooltip for metadata on ChapterCards

Text that was too long got cut of, but it was never shown as the tooltip, which caused the information about the full text to get lost
This commit is contained in:
schroda
2025-03-10 23:15:48 +01:00
parent efd9a45912
commit a2acddab5f

View File

@@ -10,6 +10,7 @@ import Box from '@mui/material/Box';
import { ComponentProps, ReactNode } from 'react';
import Stack from '@mui/material/Stack';
import { TypographyMaxLines } from '@/modules/core/components/TypographyMaxLines.tsx';
import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx';
export const ChapterCardMetadata = ({
title,
@@ -46,19 +47,37 @@ export const ChapterCardMetadata = ({
}}
>
{infoIcons}
<TypographyMaxLines variant="h6" component="h3" {...slotProps?.title}>
{title}
</TypographyMaxLines>
<CustomTooltip title={title}>
<TypographyMaxLines variant="h6" component="h3" {...slotProps?.title}>
{title}
</TypographyMaxLines>
</CustomTooltip>
</Stack>
{secondaryText && (
<TypographyMaxLines variant="caption" display="block" lines={1} {...slotProps?.secondaryText}>
{secondaryText}
</TypographyMaxLines>
<CustomTooltip title={secondaryText}>
<TypographyMaxLines
variant="caption"
display="block"
lines={1}
{...slotProps?.secondaryText}
sx={{ maxWidth: 'fit-content', ...slotProps?.secondaryText?.sx }}
>
{secondaryText}
</TypographyMaxLines>
</CustomTooltip>
)}
{ternaryText && (
<TypographyMaxLines variant="caption" display="block" lines={1} {...slotProps?.ternaryText}>
{ternaryText}
</TypographyMaxLines>
<CustomTooltip title={ternaryText}>
<TypographyMaxLines
variant="caption"
display="block"
lines={1}
{...slotProps?.ternaryText}
sx={{ maxWidth: 'fit-content', ...slotProps?.ternaryText?.sx }}
>
{ternaryText}
</TypographyMaxLines>
</CustomTooltip>
)}
</Box>
);