Skip to content

Commit

Permalink
Merge branch 'bose/2190' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
BorghildSelle committed Aug 16, 2024
2 parents 9d97659 + 3c95494 commit 5583ce1
Showing 1 changed file with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Heading } from '@core/Typography'
import { Heading, Typography } from '@core/Typography'
import { EventCardData } from '../../../../types/types'
import { forwardRef, HTMLAttributes } from 'react'
import { twMerge } from 'tailwind-merge'
Expand All @@ -7,26 +7,20 @@ import { toPlainText } from '@portabletext/react'
import { PortableTextBlock } from '@portabletext/types'
import { FormattedDateParts, useIntl } from 'react-intl'
import { BaseLink } from '@core/Link'
import Blocks from '../../../../pageComponents/shared/portableText/Blocks'
import FormattedDateTime from '@core/FormattedDateTime/FormattedDateTime'

export type PastEventsListItemProps = {
event: EventCardData
hasSectionTitle: boolean
} & HTMLAttributes<HTMLAnchorElement>

/**
* Event Card component.
* Remember to wrap in ul and li if in a list.
* */
const PastEventsListItem = forwardRef<HTMLAnchorElement, PastEventsListItemProps>(function PastEventsListItem(
{ event, className = '', hasSectionTitle = true, ...rest },
ref,
) {
const intl = useIntl()
const details = intl.formatMessage({ id: 'details', defaultMessage: 'Details' })

const { title, eventDate, slug, ingress } = event
const { title, eventDate, location, slug } = event
const { start } = getEventDates(eventDate)
const plainTitle = title ? toPlainText(title as PortableTextBlock[]) : ''

Expand All @@ -49,32 +43,31 @@ const PastEventsListItem = forwardRef<HTMLAnchorElement, PastEventsListItemProps
{...rest}
>
<div className="w-full h-full aspect-square bg-norwegian-woods-100 text-white-100 flex justify-center items-center p-2">
{/* {start && <FormattedDateTime date={start} className="uppercase pb-3" timeClassName="text-sm" hideIcon />} */}
{start && (
<FormattedDateParts value={start} year="numeric" month="short" day="2-digit">
{(parts) => {
return (
<div className="flex flex-col gap-4 justify-start items-center">
<span className="text-md">{`${parts[0].value} ${parts[2].value}`}</span>
{/* <div className="flex flex-col">
<span className="text-lg">{parts[0].value}</span>
<span className="text-base">{parts[2].value}</span>
</div> */}
<span className="text-sm">{parts[4].value}</span>
</div>
)
}}
</FormattedDateParts>
)}
</div>
<div className="px-6 py-6">
<div className="px-6 py-6 ">
<Heading
value={title}
as={hasSectionTitle ? 'h3' : 'h2'}
variant="h5"
className="text-base pb-4 group-hover:underline"
className="text-base pb-4 group-hover:underline text-pretty max-w-text"
/>
{ingress && <Blocks value={ingress} className="text-xs max-w-prose text-pretty" />}
{location && (
<Typography variant="body" className="text-sm text-pretty max-w-text">
{location}
</Typography>
)}
</div>
</BaseLink>
)
Expand Down

0 comments on commit 5583ce1

Please sign in to comment.