fix: hide the year of most recent posts on the landing page
This commit is contained in:
parent
187c6de312
commit
563ae6db2e
|
@ -7,9 +7,15 @@ import PostType = LPE.PostType
|
|||
export type Props = React.ComponentProps<typeof Container> & {
|
||||
contentType: PostType
|
||||
date: Date | null
|
||||
displayYear?: boolean
|
||||
}
|
||||
|
||||
export const PostCardLabel: FC<Props> = ({ contentType, date, ...props }) => {
|
||||
export const PostCardLabel: FC<Props> = ({
|
||||
displayYear = true,
|
||||
contentType,
|
||||
date,
|
||||
...props
|
||||
}) => {
|
||||
return (
|
||||
<Container {...props}>
|
||||
<Typography variant="body3" genericFontFamily="sans-serif">
|
||||
|
@ -23,7 +29,11 @@ export const PostCardLabel: FC<Props> = ({ contentType, date, ...props }) => {
|
|||
date.toLocaleString('en-GB', {
|
||||
day: 'numeric',
|
||||
month: 'long', // TODO: Should be uppercase
|
||||
year: 'numeric',
|
||||
...(displayYear
|
||||
? {
|
||||
year: 'numeric',
|
||||
}
|
||||
: {}),
|
||||
})}
|
||||
</Typography>
|
||||
</Container>
|
||||
|
|
|
@ -41,6 +41,7 @@ export type PostCardProps = CommonProps &
|
|||
size?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large'
|
||||
applySizeStyles?: boolean
|
||||
displayPodcastShow?: boolean
|
||||
displayYear?: boolean
|
||||
}
|
||||
|
||||
export const PostCard = (_props: PostCardProps) => {
|
||||
|
@ -60,6 +61,7 @@ export const PostCard = (_props: PostCardProps) => {
|
|||
contentType,
|
||||
applySizeStyles = true,
|
||||
displayPodcastShow = true,
|
||||
displayYear = true,
|
||||
...props
|
||||
} = _props
|
||||
|
||||
|
@ -81,6 +83,7 @@ export const PostCard = (_props: PostCardProps) => {
|
|||
<PostCardLabel
|
||||
className="post-card__label"
|
||||
contentType={contentType}
|
||||
displayYear={displayYear}
|
||||
date={date}
|
||||
/>
|
||||
)
|
||||
|
|
|
@ -13,6 +13,7 @@ export type PostsGridProps = Partial<React.ComponentProps<typeof Container>> & {
|
|||
shows?: LPE.Podcast.Show[]
|
||||
posts?: LPE.Post.Document[]
|
||||
displayPodcastShow?: boolean
|
||||
displayYear?: boolean
|
||||
}
|
||||
|
||||
export const PostsGrid: React.FC<PostsGridProps> = ({
|
||||
|
@ -23,6 +24,7 @@ export const PostsGrid: React.FC<PostsGridProps> = ({
|
|||
bordered = false,
|
||||
horizontal = false,
|
||||
displayPodcastShow = true,
|
||||
displayYear = true,
|
||||
...props
|
||||
}) => {
|
||||
const theme = useTheme()
|
||||
|
@ -69,6 +71,7 @@ export const PostsGrid: React.FC<PostsGridProps> = ({
|
|||
applySizeStyles={false}
|
||||
className="post-card"
|
||||
contentType={post.type}
|
||||
displayYear={displayYear}
|
||||
displayPodcastShow={displayPodcastShow}
|
||||
data={PostCard.toData(post, shows)}
|
||||
/>
|
||||
|
|
|
@ -37,6 +37,7 @@ export const HomePage: React.FC<HomePageProps> = ({
|
|||
<PostsGrid
|
||||
posts={group1}
|
||||
horizontal
|
||||
displayYear={false}
|
||||
pattern={[{ cols: 5, size: 'xxsmall' }]}
|
||||
breakpoints={[
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue