-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1889b4
commit 4ebc00d
Showing
24 changed files
with
663 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
166 changes: 166 additions & 0 deletions
166
src/stories/Library/event-list-item/event-list-item.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
.event-list-item { | ||
list-style: none; | ||
} | ||
.event-list-item__href { | ||
@include show-svg-on-hover(); | ||
|
||
text-decoration: none; | ||
display: grid; | ||
padding: $s-lg; | ||
row-gap: $s-md; | ||
max-width: $layout__max-width; | ||
background-color: #fcfcfc; | ||
margin: 0 auto; | ||
margin-bottom: $s-md; | ||
} | ||
.event-list-item__image-wrapper { | ||
background: green; // Placeholder for image background | ||
position: relative; | ||
width: 100%; | ||
height: 100%; | ||
&:before { | ||
content: ""; | ||
display: block; | ||
padding-top: 75%; // Fallback for 4:3 aspect ratio | ||
} | ||
@supports (aspect-ratio: 4 / 3) { | ||
aspect-ratio: 4 / 3; | ||
&:before { | ||
display: none; | ||
} | ||
} | ||
} | ||
|
||
.event-list-item__image { | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; | ||
} | ||
|
||
.event-list-item__content { | ||
@include typography($typo__body-medium); | ||
display: grid; | ||
grid-template-columns: repeat(2, 1fr); | ||
} | ||
.event-list-item__tag { | ||
width: max-content; | ||
margin-bottom: calc($s-sm * 1.5); | ||
grid-column: 1; | ||
} | ||
|
||
.event-list-item__date { | ||
@include typography($typo__small-caption); | ||
grid-column: 2; | ||
text-align: right; | ||
} | ||
|
||
.event-list-item__title { | ||
@include typography($typo__h4); | ||
@extend %text-truncate; | ||
margin-bottom: $s-sm; | ||
grid-column: 1/ -1; | ||
} | ||
|
||
.event-list-item__description { | ||
@include typography($typo__small-caption); | ||
@extend %text-ellipsis-two-lines; | ||
-webkit-line-clamp: 3; | ||
grid-column: 1 / -1; | ||
margin-bottom: $s-xl; | ||
} | ||
|
||
.event-list-item__location { | ||
@include typography($typo__small-caption); | ||
@extend %link-tag; | ||
grid-column: 1; | ||
grid-row: 4; | ||
align-self: end; | ||
} | ||
|
||
.event-list-item__details { | ||
grid-column: 2; | ||
grid-row: 4; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-end; | ||
} | ||
|
||
.event-list-item__time { | ||
@include typography($typo__body-placeholder); | ||
} | ||
|
||
.event-list-item__pricing { | ||
@include typography($typo__body-medium); | ||
} | ||
|
||
@include media-query__small { | ||
.event-list-item__href { | ||
grid-template-columns: 222px 1fr max-content; | ||
gap: $s-2xl; | ||
} | ||
.event-list-item__image-wrapper { | ||
max-width: 222px; | ||
} | ||
.event-list-item__content { | ||
grid-template-columns: repeat(4, 1fr); | ||
grid-template-rows: 30px 30px 40px auto 1fr; | ||
width: 100%; | ||
align-items: center; | ||
} | ||
.event-list-item__tag { | ||
grid-column: 1; | ||
grid-row: 1; | ||
margin-bottom: unset; | ||
} | ||
.event-list-item__date { | ||
grid-column: 1; | ||
grid-row: 2; | ||
text-align: initial; | ||
align-self: end; | ||
} | ||
|
||
.event-list-item__title { | ||
grid-column: 1 / span 3; | ||
grid-row: 3; | ||
margin-bottom: unset; | ||
} | ||
.event-list-item__description { | ||
grid-column: 1 / span 3; | ||
grid-row: 4; | ||
margin-bottom: unset; | ||
-webkit-line-clamp: 2; | ||
} | ||
.event-list-item__details { | ||
grid-column: 4; | ||
grid-row: 3 / -1; | ||
|
||
align-self: flex-start; | ||
margin-bottom: $s-md; | ||
} | ||
.event-list-item__location { | ||
grid-column: 1; | ||
grid-row: 5; | ||
margin-top: $s-md; | ||
} | ||
.event-list-item__time { | ||
grid-column: 4; | ||
grid-row: 3; | ||
} | ||
.event-list-item__pricing { | ||
grid-column: 4; | ||
grid-row: 4; | ||
} | ||
} | ||
|
||
.event-list-item > svg { | ||
display: none; | ||
|
||
@include media-query__medium { | ||
display: initial; | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
src/stories/Library/event-list-item/eventListItem.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
import { withDesign } from "storybook-addon-designs"; | ||
import { EventListItem } from "./EventListItem"; | ||
|
||
export default { | ||
title: "Library / EventListItem", | ||
component: EventListItem, | ||
decorators: [withDesign], | ||
argTypes: { | ||
image: { | ||
defaultValue: "/path/to/image.jpg", // Replace with path to your image in the public folder | ||
control: { type: "text" }, | ||
}, | ||
title: { | ||
defaultValue: "Ny indsamling til Læs for livet", | ||
control: { type: "text" }, | ||
}, | ||
description: { | ||
defaultValue: | ||
"Demokrati betyder helt enkelt folkestyre og er en måde at fordele magten i fx et land", | ||
control: { type: "text" }, | ||
}, | ||
date: { | ||
defaultValue: "25 Feb 2023", | ||
control: { type: "text" }, | ||
}, | ||
time: { | ||
defaultValue: "19:30 - 21:00", | ||
control: { type: "text" }, | ||
}, | ||
location: { | ||
defaultValue: "Stadsbiblioteket", | ||
control: { type: "text" }, | ||
}, | ||
price: { | ||
defaultValue: 80, | ||
control: { type: "number" }, | ||
}, | ||
href: { | ||
defaultValue: "/", | ||
control: { type: "text" }, | ||
}, | ||
}, | ||
parameters: { | ||
design: { | ||
type: "figma", | ||
url: "https://www.figma.com/file/Zx9GrkFA3l4ISvyZD2q0Qi/Designsystem?type=design&node-id=7690-56463&mode=design&t=RCEb5jOu9CS9Ui9x-4", | ||
}, | ||
layout: "full", | ||
}, | ||
} as ComponentMeta<typeof EventListItem>; | ||
|
||
const Template: ComponentStory<typeof EventListItem> = (args) => ( | ||
<EventListItem {...args} /> | ||
); | ||
|
||
export const Default = Template.bind({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { ReactComponent as ArrowSmallRight } from "../Arrows/icon-arrow-ui/icon-arrow-ui-small-right.svg"; | ||
import { Tag } from "../tag/Tag"; | ||
|
||
export type EventListItemProps = { | ||
image: string; | ||
title: string; | ||
description: string; | ||
date: string; | ||
time: string; | ||
location: string; | ||
price: number; | ||
href: string; | ||
}; | ||
|
||
export const EventListItem = ({ | ||
image, | ||
title, | ||
description, | ||
date, | ||
time, | ||
location, | ||
price, | ||
href, | ||
}: EventListItemProps) => { | ||
return ( | ||
<li className="event-list-item"> | ||
<a | ||
href={href} | ||
className="event-list-item__href arrow__hover--right-small" | ||
> | ||
<div className="event-list-item__image-wrapper"> | ||
<img src={image} alt={title} className="event-list-item__image" /> | ||
</div> | ||
<div className="event-list-item__content"> | ||
<Tag hasBackground className="event-list-item__tag"> | ||
foredrag | ||
</Tag> | ||
<p className="event-list-item__date">{date}</p> | ||
<h3 className="event-list-item__title">{title}</h3> | ||
<p className="event-list-item__description">{description}</p> | ||
<p className="event-list-item__location">{location}</p> | ||
<div className="event-list-item__details"> | ||
<time className="event-list-item__time">{time}</time> | ||
<p className="event-list-item__pricing">{price} KR</p> | ||
</div> | ||
</div> | ||
<ArrowSmallRight /> | ||
</a> | ||
</li> | ||
); | ||
}; |
Oops, something went wrong.