Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change event card to display free/paid events where imagecard is used #1523

Merged
Merged
3 changes: 2 additions & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
},
"formatter": {
"indentStyle": "space",
"lineWidth": 120
"lineWidth": 120,
"lineEnding": "lf"
},
"javascript": {
"formatter": {
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/Components/ImageCard/ImageCard.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ $card-box-shadow-hover: 0 3px 8px 0 rgba(0, 0, 0, 0.4);
}

.date_label {
font-weight: 400;
font-weight: 700;
color: $grey-4;
}

Expand Down Expand Up @@ -127,6 +127,10 @@ $card-box-shadow-hover: 0 3px 8px 0 rgba(0, 0, 0, 0.4);
visibility: hidden;
}

.ticket_type{
Snorre98 marked this conversation as resolved.
Show resolved Hide resolved
font-size: 0.7rem;
}

// Styling to container and children when it is hovered.
.container:hover {
.edit_button {
Expand Down
16 changes: 16 additions & 0 deletions frontend/src/Components/ImageCard/ImageCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import classNames from 'classnames';
import { t } from 'i18next';
import type { ReactNode } from 'react';
import { Skeleton } from '~/Components';
import { KEY } from '~/i18n/constants';
import type { Children } from '~/types';
import { backgroundImageFromUrl } from '~/utils';
import { Link } from '../Link';
Expand All @@ -19,6 +21,7 @@ type ImageCardProps = {
compact?: boolean;
isSkeleton?: boolean;
children?: Children;
ticket_type?: string;
};

export function ImageCard({
Expand All @@ -32,6 +35,7 @@ export function ImageCard({
compact,
isSkeleton,
children,
ticket_type,
}: ImageCardProps) {
const containerStyle = classNames(styles.container, compact && styles.compact, className);
const cardStyle = classNames(styles.card);
Expand All @@ -45,6 +49,17 @@ export function ImageCard({
);
}

let displayTicketType = '';
if (ticket_type === 'billig' || ticket_type === 'custom') {
displayTicketType = t(KEY.common_ticket_type_billig);
}
if (ticket_type === 'free' || ticket_type === 'registration') {
displayTicketType = t(KEY.common_ticket_type_free);
}
if (ticket_type === 'included') {
displayTicketType = t(KEY.common_ticket_type_included);
}

return (
<div className={containerStyle}>
<Link url={url} className={classNames(cardStyle, styles.image)} style={backgroundImageFromUrl(imageUrl)}>
Expand All @@ -59,6 +74,7 @@ export function ImageCard({
<div className={styles.date_label}>
{date && <TimeDisplay timestamp={date} displayType="event-datetime" />}
</div>
<div className={styles.ticket_type}>{displayTicketType}</div>
</div>

<div className={bottomDescriptionStyle}>{description}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export function EventsList({ events }: EventsListProps) {
description={dbT(event, 'description_short') ?? ''}
compact={true}
url={reverse({ pattern: ROUTES.frontend.event, urlParams: { id: event.id } })}
ticket_type={event.ticket_type}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export function EventCarousel({ element, skeletonCount = 0 }: EventCarouselProps
imageUrl={BACKEND_DOMAIN + event.image_url}
description={event_short_dsc}
url={url}
ticket_type={event.ticket_type}
>
<div className={styles.button_bar}>
{canChangeEvent && (
Expand Down
Loading