-
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 #713 from danskernesdigitalebibliotek/DDFFORM-822-…
…modal-til-abningstider Ddfform 822 modal til abningstider
- Loading branch information
Showing
16 changed files
with
430 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
@import "./src/styles/scss/tools"; | ||
|
||
// CSS sheets that are used to style the admin interface. | ||
@import "./src/stories/Library/dialog/dialog"; | ||
@import "./src/stories/Library/opening-hours-editor/opening-hours-editor"; | ||
@import "./src/stories/Library/material-search/material-search"; | ||
@import "./src/stories/Library/cover/cover"; |
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
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
4 changes: 0 additions & 4 deletions
4
src/stories/Library/opening-hours-editor/opening-hours-editor.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
52 changes: 52 additions & 0 deletions
52
src/stories/Library/opening-hours-sidebar/OpeningHoursSidebar.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,52 @@ | ||
import { ComponentMeta, ComponentStory } from "@storybook/react"; | ||
import { withDesign } from "storybook-addon-designs"; | ||
import OpeningHoursSidebar from "./OpeningHoursSidebar"; | ||
import defaultLibraries from "./opening-hours-libraries-data"; | ||
|
||
export default { | ||
title: "Library/Opening Hours Sidebar/Without Dialog", | ||
component: OpeningHoursSidebar, | ||
decorators: [withDesign], | ||
argTypes: { | ||
title: { | ||
defaultValue: "Dagens åbningstider", | ||
control: { | ||
type: "text", | ||
}, | ||
}, | ||
dateString: { | ||
defaultValue: "fredag 28. maj", | ||
control: { | ||
type: "text", | ||
}, | ||
}, | ||
libraries: { | ||
control: { | ||
type: "object", | ||
}, | ||
defaultValue: defaultLibraries, | ||
}, | ||
link: { | ||
defaultValue: "#", | ||
control: { | ||
type: "text", | ||
}, | ||
}, | ||
}, | ||
parameters: { | ||
design: { | ||
type: "figma", | ||
url: "https://www.figma.com/design/Zx9GrkFA3l4ISvyZD2q0Qi/Designsystem?node-id=7760-59368&t=FtYoMFQsdy52r88A-4", | ||
}, | ||
}, | ||
} as ComponentMeta<typeof OpeningHoursSidebar>; | ||
|
||
const Template: ComponentStory<typeof OpeningHoursSidebar> = (args) => { | ||
return ( | ||
<div className="storybook-dialog-sidebar"> | ||
<OpeningHoursSidebar {...args} />; | ||
</div> | ||
); | ||
}; | ||
|
||
export const Default = Template.bind({}); |
56 changes: 56 additions & 0 deletions
56
src/stories/Library/opening-hours-sidebar/OpeningHoursSidebar.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,56 @@ | ||
import { FC } from "react"; | ||
import { ReactComponent as WatchStaticIcon } from "../../../public/icons/basic/icon-watch-static.svg"; | ||
import DisclosureControllable from "../disclosure-controllable/DisclosureControllable"; | ||
import OpeningHoursSidebarSummary from "./OpeningHoursSidebarSummary"; | ||
import OpeningHoursSidebarDetails, { | ||
OpeningHoursItemType, | ||
} from "./OpeningHoursSidebarDetails"; | ||
|
||
type OpeningHoursSidebarType = { | ||
title: string; | ||
dateString: string; | ||
libraries: { | ||
id: string; | ||
name: string; | ||
openingHoursData: OpeningHoursItemType[]; | ||
}[]; | ||
link: string; | ||
}; | ||
|
||
const OpeningHoursSidebar: FC<OpeningHoursSidebarType> = ({ | ||
title, | ||
dateString, | ||
libraries, | ||
link, | ||
}) => { | ||
return ( | ||
<section className="opening-hours-sidebar"> | ||
<header className="opening-hours-sidebar__header"> | ||
<WatchStaticIcon className="opening-hours-sidebar__icon" /> | ||
<div className="opening-hours-sidebar__texts"> | ||
<h2 className="opening-hours-sidebar__title">{title}</h2> | ||
<p className="opening-hours-sidebar__date">{dateString}</p> | ||
</div> | ||
</header> | ||
|
||
{libraries.map(({ id, name, openingHoursData }, i) => ( | ||
<DisclosureControllable | ||
showContent={i === 0} | ||
key={id} | ||
id={id} | ||
detailsClassName="opening-hours-sidebar-details" | ||
summaryClassName="opening-hours-sidebar-summary" | ||
summary={<OpeningHoursSidebarSummary name={name} />} | ||
> | ||
<OpeningHoursSidebarDetails | ||
openingHoursData={openingHoursData} | ||
link={link} | ||
name={name} | ||
/> | ||
</DisclosureControllable> | ||
))} | ||
</section> | ||
); | ||
}; | ||
|
||
export default OpeningHoursSidebar; |
38 changes: 38 additions & 0 deletions
38
src/stories/Library/opening-hours-sidebar/OpeningHoursSidebarDetails.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,38 @@ | ||
import React from "react"; | ||
|
||
export type OpeningHoursItemType = { | ||
term: string; | ||
description: string; | ||
}; | ||
|
||
type OpeningHoursSidebarDetailsType = { | ||
openingHoursData: OpeningHoursItemType[]; | ||
link: string; | ||
name: string; | ||
}; | ||
|
||
const OpeningHoursSidebarDetails: React.FC<OpeningHoursSidebarDetailsType> = ({ | ||
openingHoursData, | ||
link, | ||
name, | ||
}) => { | ||
return ( | ||
<div className="opening-hours-sidebar-details__content"> | ||
<dl className="opening-hours-sidebar-details__list"> | ||
{openingHoursData.map(({ term, description }, i) => ( | ||
<div key={i} className="opening-hours-sidebar-details__item"> | ||
<dt className="opening-hours-sidebar-details__term">{term}</dt> | ||
<dd className="opening-hours-sidebar-details__description"> | ||
{description} | ||
</dd> | ||
</div> | ||
))} | ||
</dl> | ||
<a href={link} className="opening-hours-sidebar__link"> | ||
{`Gå til ${name}`} | ||
</a> | ||
</div> | ||
); | ||
}; | ||
|
||
export default OpeningHoursSidebarDetails; |
19 changes: 19 additions & 0 deletions
19
src/stories/Library/opening-hours-sidebar/OpeningHoursSidebarSummary.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,19 @@ | ||
import { FC } from "react"; | ||
import { ReactComponent as ExpandMoreIcon } from "../../../public/icons/collection/ExpandMore.svg"; | ||
|
||
type OpeningHoursSidebarSummaryType = { | ||
name: string; | ||
}; | ||
|
||
const OpeningHoursSidebarSummary: FC<OpeningHoursSidebarSummaryType> = ({ | ||
name, | ||
}) => { | ||
return ( | ||
<> | ||
<h3 className="opening-hours-sidebar-summary__name">{name}</h3> | ||
<ExpandMoreIcon className="opening-hours-sidebar-summary__icon" /> | ||
</> | ||
); | ||
}; | ||
|
||
export default OpeningHoursSidebarSummary; |
Oops, something went wrong.