import type { IPostItem } from 'src/types/blog';
import type { BoxProps } from '@mui/material/Box';
import type { CardProps } from '@mui/material/Card';
import { varAlpha } from 'minimal-shared/utils';
import Box from '@mui/material/Box';
import Link from '@mui/material/Link';
import Card from '@mui/material/Card';
import Avatar from '@mui/material/Avatar';
import Typography from '@mui/material/Typography';
import CardContent from '@mui/material/CardContent';
import { RouterLink } from 'src/routes/components';
import { fDate } from 'src/utils/format-time';
import { fShortenNumber } from 'src/utils/format-number';
import { AvatarShape } from 'src/assets/illustrations';
import { Image } from 'src/components/image';
import { Iconify } from 'src/components/iconify';
// ----------------------------------------------------------------------
type PostItemProps = CardProps & {
post: IPostItem;
detailsHref: string;
};
export function PostItem({ post, detailsHref, sx, ...other }: PostItemProps) {
return (
{fDate(post.createdAt)}
({
...theme.mixins.maxLine({ line: 2, persistent: theme.typography.subtitle2 }),
})}
>
{post.title}
);
}
// ----------------------------------------------------------------------
type PostItemLatestProps = {
post: IPostItem;
index: number;
detailsHref: string;
};
export function PostItemLatest({ post, index, detailsHref }: PostItemLatestProps) {
const postSmall = index === 1 || index === 2;
return (
({
bgcolor: varAlpha(theme.vars.palette.grey['900Channel'], 0.64),
}),
},
}}
/>
{fDate(post.createdAt)}
({
...theme.mixins.maxLine({
line: 2,
persistent: postSmall ? theme.typography.subtitle2 : theme.typography.h5,
}),
})}
>
{post.title}
);
}
// ----------------------------------------------------------------------
type InfoBlockProps = BoxProps & Pick;
function InfoBlock({ sx, totalViews, totalShares, totalComments, ...other }: InfoBlockProps) {
return (
({
mt: 3,
gap: 1.5,
display: 'flex',
typography: 'caption',
color: 'text.disabled',
justifyContent: 'flex-end',
}),
...(Array.isArray(sx) ? sx : [sx]),
]}
{...other}
>
{fShortenNumber(totalComments)}
{fShortenNumber(totalViews)}
{fShortenNumber(totalShares)}
);
}