diff --git a/base.scss b/base.scss index ba740b98f..5c6e9592e 100644 --- a/base.scss +++ b/base.scss @@ -153,11 +153,12 @@ @import "./src/stories/Blocks/advanced-search/advanced-search"; @import "./src/stories/Blocks/article/article"; @import "./src/stories/Blocks/event-page/event-page"; -@import "./src/stories/Blocks/fee-list/fee-list-page-skeleton.scss"; +@import "./src/stories/Blocks/fee-list/fee-list-page-skeleton"; @import "./src/stories/Blocks/content-list-page/content-list-page"; @import "./src/stories/Blocks/reservation-page/reservation-page-skeleton"; @import "./src/stories/Blocks/loan-page/loan-page-skeleton"; @import "./src/stories/Blocks/registration-page/registration-page"; +@import "./src/stories/Blocks/webform/webform"; @import "./src/styles/scss/shared"; @import "./src/styles/scss/internal"; diff --git a/src/stories/Blocks/advanced-search/advanced-search.scss b/src/stories/Blocks/advanced-search/advanced-search.scss index bd00de0be..81f04e46c 100644 --- a/src/stories/Blocks/advanced-search/advanced-search.scss +++ b/src/stories/Blocks/advanced-search/advanced-search.scss @@ -19,6 +19,7 @@ &__clauses { @include typography($typo__button); + color: $color__global-grey; display: flex; flex-direction: row; align-items: center; diff --git a/src/stories/Blocks/favorites-list/FavoritesList.stories.tsx b/src/stories/Blocks/favorites-list/FavoritesList.stories.tsx new file mode 100644 index 000000000..d585eeb15 --- /dev/null +++ b/src/stories/Blocks/favorites-list/FavoritesList.stories.tsx @@ -0,0 +1,22 @@ +import { ComponentMeta, ComponentStory } from "@storybook/react"; +import FavouritesList from "./FavoritesList"; + +export default { + title: "Blocks / Favourite List", + component: FavouritesList, +} as ComponentMeta; + +const Template: ComponentStory = (args) => { + return ; +}; + +export const Default = Template.bind({}); +Default.args = { + materialsCount: 3, +}; + +export const SkeletonVersion = Template.bind({}); +SkeletonVersion.args = { + materialsCount: 3, + skeletonVersion: true, +}; diff --git a/src/stories/Blocks/favorites-list/FavoritesList.tsx b/src/stories/Blocks/favorites-list/FavoritesList.tsx new file mode 100644 index 000000000..5a1528c7f --- /dev/null +++ b/src/stories/Blocks/favorites-list/FavoritesList.tsx @@ -0,0 +1,73 @@ +import React from "react"; +import { CardListItem } from "../../Library/card-list-item/CardListItem"; +import { CardListItemSkeleton } from "../../Library/card-list-item/CardListItemSkeleton"; +import ResultPager from "../../Library/card-list-page/ResultPager"; +import data from "../../Library/card-list-page/SearchResultPageData"; + +export interface FavouritesListProps { + skeletonVersion?: boolean; + materialsCount: number; +} + +const FavouritesList: React.FC = ({ + skeletonVersion = false, + materialsCount, +}) => { + const pageTitle = ( +

Favourites

+ ); + + const materialsCountLine = materialsCount > 0 && ( +

{materialsCount} materials

+ ); + + const SkeletonList = () => ( +
    + {[...Array(5)].slice(0, materialsCount).map(() => ( +
  • + +
  • + ))} +
+ ); + + const FavouritesListContent = () => ( +
    + {data.searchResult.slice(0, materialsCount).map((item, i) => ( +
  • + +
  • + ))} +
+ ); + + const EmptyList = () => ( +
Your favorites list is empty
+ ); + + let content; + if (skeletonVersion) { + content = ; + } else if (materialsCount > 0) { + content = ; + } else { + content = ; + } + + return ( +
+ {pageTitle} + {materialsCountLine} + {content} + {!skeletonVersion && ( + + )} +
+ ); +}; + +export default FavouritesList; diff --git a/src/stories/Blocks/patron-page/ContactInfoSection.tsx b/src/stories/Blocks/patron-page/ContactInfoSection.tsx new file mode 100644 index 000000000..933341d62 --- /dev/null +++ b/src/stories/Blocks/patron-page/ContactInfoSection.tsx @@ -0,0 +1,30 @@ +import React from "react"; +import Input from "../../Library/Forms/input/Input"; +import { Checkbox } from "../../Library/Forms/checkbox/Checkbox"; + +const ContactInfoSection: React.FC = () => { + return ( +
+

Contact information

+

+ Patron contact info body text +

+ + + + +
+ ); +}; + +export default ContactInfoSection; diff --git a/src/stories/Blocks/patron-page/PatronPage.stories.tsx b/src/stories/Blocks/patron-page/PatronPage.stories.tsx new file mode 100644 index 000000000..2cb4f7684 --- /dev/null +++ b/src/stories/Blocks/patron-page/PatronPage.stories.tsx @@ -0,0 +1,31 @@ +import { ComponentMeta, ComponentStory } from "@storybook/react"; +import PatronPage from "./PatronPage"; + +export default { + title: "Blocks / Patron Page", + component: PatronPage, + parameters: { + design: { + type: "figma", + url: "https://www.figma.com/file/xouARmJCONbzbZhpD8XpcM/Brugerprofil?type=design&node-id=1239-66174&mode=design", + }, + layout: "fullscreen", + }, + argTypes: { + skeletonVersion: { + control: "boolean", + defaultValue: false, + }, + }, +} as ComponentMeta; + +const Template: ComponentStory = (args) => { + return ; +}; + +export const Default = Template.bind({}); + +export const SkeletonVersion = Template.bind({}); +SkeletonVersion.args = { + skeletonVersion: true, +}; diff --git a/src/stories/Blocks/patron-page/PatronPage.tsx b/src/stories/Blocks/patron-page/PatronPage.tsx new file mode 100644 index 000000000..a13d449f7 --- /dev/null +++ b/src/stories/Blocks/patron-page/PatronPage.tsx @@ -0,0 +1,136 @@ +import React from "react"; +import PatronInfo from "../../Library/patron-info/PatronInfo"; +import Input from "../../Library/Forms/input/Input"; +import { StatusLoans } from "../status-loans/statusLoans"; +import { Dropdown } from "../../Library/dropdown/Dropdown"; +import { Links } from "../../Library/links/Links"; +import PatronPageSkeleton from "./PatronPageSkeleton"; +import ContactInfoSection from "./ContactInfoSection"; + +export interface PatronPageProps { + skeletonVersion?: boolean; +} + +const PatronPage: React.FC = ({ skeletonVersion = false }) => { + if (skeletonVersion) return ; + + const statusBarsData = [ + { + title: "Loans per month", + statusBars: [ + { amount: 1, fullAmount: 4, title: "Ebooks", outOf: "out of" }, + { amount: 2, fullAmount: 10, title: "Audiobooks", outOf: "out of" }, + ], + }, + ]; + + const branches = [ + { + title: "Copenhagen", + }, + { + title: "New York", + }, + { + title: "The Moon", + }, + ]; + + return ( +
+

Patron profile page

+

Basic details

+ + {/* Patron info section */} + + +
+ + + {/* Digital loans section */} +
+ +
+ + {/* Pickup branch section */} +
+

Reservations

+

+ Change pickup body text +

+ + +
+ + {/* Pin code section */} +
+

Pincode

+

+ Change current pin by entering a new pin and saving +

+
+
+ +
+
+ +
+
+
+ + + + {/* Delete profile link */} +
+ Do you wish to delete your library profile?{" "} + +
+
+ + ); +}; + +export default PatronPage; diff --git a/src/stories/Blocks/patron-page/PatronPageSkeleton.tsx b/src/stories/Blocks/patron-page/PatronPageSkeleton.tsx new file mode 100644 index 000000000..e19a81c77 --- /dev/null +++ b/src/stories/Blocks/patron-page/PatronPageSkeleton.tsx @@ -0,0 +1,15 @@ +import PatronInfoSkeleton from "../../Library/patron-info/PatronInfoSkeleton"; +import ContactInfoSection from "./ContactInfoSection"; + +const PatronPageSkeleton: React.FC = () => { + return ( +
+

Patron profile page

+

Basic details

+ + + + ); +}; + +export default PatronPageSkeleton; diff --git a/src/stories/Blocks/status-loans/statusLoans.stories.tsx b/src/stories/Blocks/status-loans/statusLoans.stories.tsx index e14e7cc49..78ae4b6b9 100644 --- a/src/stories/Blocks/status-loans/statusLoans.stories.tsx +++ b/src/stories/Blocks/status-loans/statusLoans.stories.tsx @@ -2,7 +2,7 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; import { StatusLoans as StatusLoansComp } from "./statusLoans"; export default { - title: "Blocks / Userprofile / Status loans", + title: "Blocks / User Profile / Status loans", component: StatusLoansComp, parameters: { design: { @@ -29,6 +29,9 @@ export default { defaultValue: "På mange digitale materialer, er der er begrænsning på, hvor mange du kan låne pr. måned. Der findes dog en række materialer uden begrænsning.", }, + reservationsText: { + defaultValue: "You can reserve 3 ebooks and 3 audiobooks", + }, link: { defaultValue: { text: "Se titler du altid kan låne", diff --git a/src/stories/Blocks/status-loans/statusLoans.tsx b/src/stories/Blocks/status-loans/statusLoans.tsx index cedcd16a6..375a66781 100644 --- a/src/stories/Blocks/status-loans/statusLoans.tsx +++ b/src/stories/Blocks/status-loans/statusLoans.tsx @@ -18,25 +18,35 @@ export type StatusLoansProps = { title: string; link: LinkProps; bread: string; + reservationsText: string; }; export const StatusLoans = (props: StatusLoansProps) => { - const { statusBarsData, title: statusBarsTitle, link, bread } = props; + const { + statusBarsData, + title: statusBarsTitle, + link, + bread, + reservationsText, + } = props; const { link: url, text: linkText } = link; return ( <> -

{statusBarsTitle}

-
+

{statusBarsTitle}

+
{`${bread} `} {linkText}
-
+
+ {reservationsText} +
+
{statusBarsData.map(({ statusBars, title }) => ( -
-

{title}

+
+

{title}

{statusBars.map( ({ title: statusBarTitle, amount, fullAmount, outOf }) => ( ; + +const Template: ComponentStory = (args) => { + return ; +}; + +export const Default = Template.bind({}); + +export const WithoutSubtitle = Template.bind({}); +WithoutSubtitle.args = { + withoutSubtitle: true, +}; diff --git a/src/stories/Blocks/webform/Webform.tsx b/src/stories/Blocks/webform/Webform.tsx new file mode 100644 index 000000000..4b5359849 --- /dev/null +++ b/src/stories/Blocks/webform/Webform.tsx @@ -0,0 +1,108 @@ +import React from "react"; +import { Dropdown } from "../../Library/dropdown/Dropdown"; +import { Button } from "../../Library/Buttons/button/Button"; + +export interface WebformProps { + title: string; + subtitle: string; + withoutSubtitle?: boolean; +} + +const Webform: React.FC = ({ + title, + subtitle, + withoutSubtitle = false, +}) => { + return ( +
+
+

{title}

+ {!withoutSubtitle &&

{subtitle}

} +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+