-
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.
Merge pull request #593 from danskernesdigitalebibliotek/release/herm…
…od-sprint-12 Hermod sprint 12
- Loading branch information
Showing
14 changed files
with
327 additions
and
74 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
43 changes: 43 additions & 0 deletions
43
src/stories/Library/filtered-event-list/FilteredEventList.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,43 @@ | ||
import { ComponentMeta, ComponentStory } from "@storybook/react"; | ||
import FilteredEventList from "./FilteredEventlist"; | ||
import FilteredListData from "./FilteredEventListData"; | ||
|
||
export default { | ||
title: "Library/ Filtered Event List", | ||
|
||
component: FilteredEventList, | ||
argTypes: { | ||
title: { | ||
defaultValue: "Aktiviteter på biblioteket", | ||
control: "text", | ||
description: "Title of the recommendation", | ||
}, | ||
events: { | ||
defaultValue: FilteredListData, | ||
control: "object", | ||
description: "List of events to be displayed", | ||
}, | ||
buttonText: { | ||
defaultValue: "Se alle", | ||
control: "text", | ||
description: "Text for the button", | ||
}, | ||
buttonShowLessText: { | ||
defaultValue: "Se færre", | ||
control: "text", | ||
description: "Text for the button", | ||
}, | ||
}, | ||
parameters: { | ||
design: { | ||
type: "figma", | ||
url: "https://www.figma.com/file/Zx9GrkFA3l4ISvyZD2q0Qi/Designsystem?type=design&node-id=7567-80202&mode=design&t=eZs7Tgx4a1ebZQiO-4", | ||
}, | ||
}, | ||
} as ComponentMeta<typeof FilteredEventList>; | ||
|
||
const Template: ComponentStory<typeof FilteredEventList> = (args) => ( | ||
<FilteredEventList {...args} /> | ||
); | ||
|
||
export const FilteredList = Template.bind({}); |
59 changes: 59 additions & 0 deletions
59
src/stories/Library/filtered-event-list/FilteredEventListData.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,59 @@ | ||
import { ContentListItemProps } from "../content-list-item/ContentListItem"; | ||
import ImageCredited from "../image-credited/ImageCredited"; | ||
|
||
const FilteredListData: ContentListItemProps[] = [ | ||
{ | ||
image: ( | ||
<ImageCredited src="https://images.unsplash.com/photo-1549277513-f1b32fe1f8f5?q=80&w=1470&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" /> | ||
), | ||
tagText: "Foredrag", | ||
title: "Kunst og kultur i middelalderen", | ||
description: "En dybdegåendenalysef kunst og kultur i middelalderen.", | ||
location: "Kulturhuset", | ||
price: "50 - 100 KR", | ||
href: "/", | ||
date: "2023-01-10", | ||
time: "15:00 - 17:00", | ||
}, | ||
{ | ||
image: ( | ||
<ImageCredited src="https://plus.unsplash.com/premium_photo-1696886122527-e4303b76aa8f?q=80&w=5156&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" /> | ||
), | ||
tagText: "arrangement", | ||
title: "Fars Legestue", | ||
description: "Kom forbi til hygge i Fars Legestue", | ||
location: "Hovedbiblioteket", | ||
price: "60 KR", | ||
href: "/", | ||
date: "2023-01-12", | ||
time: "18:00 - 20:00", | ||
}, | ||
{ | ||
image: ( | ||
<ImageCredited src="https://images.unsplash.com/photo-1549277513-f1b32fe1f8f5?q=80&w=1470&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" /> | ||
), | ||
tagText: "arrangement", | ||
title: "Fars Legestue", | ||
description: "Kom forbi til hygge i Fars Legestue", | ||
location: "Hovedeblibloteket", | ||
price: "60 KR", | ||
href: "/", | ||
date: "2023-01-13", | ||
time: "18:00 - 20:00", | ||
}, | ||
{ | ||
image: ( | ||
<ImageCredited src="https://plus.unsplash.com/premium_photo-1696886122527-e4303b76aa8f?q=80&w=5156&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" /> | ||
), | ||
tagText: "arrangement", | ||
title: "Fars Legestue", | ||
description: "Kom forbi til hygge i Fars Legestue", | ||
location: "Hovedeblibloteket", | ||
price: "60 KR", | ||
href: "/", | ||
date: "2023-01-14", | ||
time: "18:00 - 20:00", | ||
}, | ||
]; | ||
|
||
export default FilteredListData; |
52 changes: 52 additions & 0 deletions
52
src/stories/Library/filtered-event-list/FilteredEventlist.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,52 @@ | ||
import React, { useEffect } from "react"; | ||
import { | ||
ContentListItem, | ||
ContentListItemProps, | ||
} from "../content-list-item/ContentListItem"; | ||
|
||
interface PromoteEventsListProps { | ||
title: string; | ||
events: ContentListItemProps[]; | ||
buttonText: string; | ||
buttonShowLessText?: string; | ||
} | ||
|
||
const PromoteEventsList: React.FC<PromoteEventsListProps> = ({ | ||
title, | ||
events, | ||
buttonText, | ||
buttonShowLessText, | ||
}) => { | ||
useEffect(() => { | ||
require("../../utils/show-more"); | ||
}, []); | ||
|
||
return ( | ||
<div className="filtered-event-list" data-show-more-list-wrapper> | ||
<h2 className="filtered-event-list__heading">{title}</h2> | ||
<ul | ||
className="filtered-event-list__list" | ||
data-show-more-list | ||
data-initial-visible-items="2" | ||
data-hide-list-button-after-expand="false" | ||
data-show-more-list-id="filtered-event-list" | ||
> | ||
{events.map((event) => ( | ||
<li className="filtered-event-list__list-item" data-show-more-item> | ||
<ContentListItem {...event} /> | ||
</li> | ||
))} | ||
</ul> | ||
<button | ||
className="filtered-event-list__button btn-primary btn-outline btn-medium" | ||
type="button" | ||
data-show-more-button | ||
data-show-more-text={buttonText} | ||
data-show-less-text={buttonShowLessText} | ||
> | ||
{buttonText} | ||
</button> | ||
</div> | ||
); | ||
}; | ||
export default PromoteEventsList; |
28 changes: 28 additions & 0 deletions
28
src/stories/Library/filtered-event-list/filtered-event-list.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,28 @@ | ||
.filtered-event-list { | ||
@include layout-container($layout__max-width--medium); | ||
} | ||
.filtered-event-list__heading { | ||
@include typography($typo__h2); | ||
margin-bottom: $s-xl; | ||
} | ||
.filtered-event-list__list-item { | ||
border-bottom: 1px solid $color__global-tertiary-1; | ||
|
||
&--hidden { | ||
display: none; | ||
} | ||
|
||
&:first-child { | ||
border-top: 1px solid $color__global-tertiary-1; | ||
} | ||
} | ||
|
||
.filtered-event-list__button { | ||
width: min-content; | ||
margin: 0 auto; | ||
margin-top: $s-xl; | ||
|
||
&--hidden { | ||
display: none; | ||
} | ||
} |
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
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
Oops, something went wrong.