diff --git a/base.scss b/base.scss index aa2a2cb29..f7dba7f23 100644 --- a/base.scss +++ b/base.scss @@ -96,6 +96,9 @@ @import "./src/stories/Library/multiselect/multiselect"; @import "./src/stories/Library/input-with-dropdown/input-with-dropdown"; @import "./src/stories/Library/button-box/button-box"; +@import "./src/stories/Library/links/arrow-link/arrow-link"; +@import "./src/stories/Library/Buttons/row-button/row-button"; +@import "./src/stories/Library/article-header/article-header"; // Autosuggest block styling needs to be loaded before the rest of the scss for autosuggest @import "./src/stories/Blocks/autosuggest/autosuggest"; @@ -110,6 +113,7 @@ @import "./src/stories/Blocks/status-userprofile/status-userprofile"; @import "./src/stories/Blocks/material-manifestation-item/material-manifestation-item"; @import "./src/stories/Blocks/advanced-search/advanced-search"; +@import "./src/stories/Blocks/article/article"; @import "./src/styles/scss/shared"; @import "./src/styles/scss/internal"; diff --git a/src/stories/Blocks/article/Article.stories.tsx b/src/stories/Blocks/article/Article.stories.tsx new file mode 100644 index 000000000..bb0be293d --- /dev/null +++ b/src/stories/Blocks/article/Article.stories.tsx @@ -0,0 +1,39 @@ +import { ComponentStory, ComponentMeta } from "@storybook/react"; +import { withDesign } from "storybook-addon-designs"; +import Article from "./Article"; + +export default { + title: "Blocks / Article", + component: Article, + decorators: [withDesign], + argTypes: { + title: { + defaultValue: "Jesper Stein vinder Læsernes Bogpris for Rampen’", + }, + subtitle: { + defaultValue: + "Jesper Stein har begået en hudløst ærlig og tankevækkende skildring af en skilsmisseramt familie. En selvbiografisk roman, som har ramt læserne i hjertet.", + }, + library: { + defaultValue: "Af biblioteksformidler på Hovedbiblioteket", + }, + author: { + defaultValue: "Lene Kuhlmann Frandsen", + }, + date: { + defaultValue: "08. April 21", + }, + }, + parameters: { + design: { + type: "figma", + url: "https://www.figma.com/file/Zx9GrkFA3l4ISvyZD2q0Qi/Designsystem?type=design&node-id=7477%3A39048&mode=dev", + }, + }, +} as ComponentMeta; + +const Template: ComponentStory = (args) => ( +
+); + +export const Default = Template.bind({}); diff --git a/src/stories/Blocks/article/Article.tsx b/src/stories/Blocks/article/Article.tsx new file mode 100644 index 000000000..3836fae3d --- /dev/null +++ b/src/stories/Blocks/article/Article.tsx @@ -0,0 +1,32 @@ +import { FC } from "react"; +import ArticleHeader from "../../Library/article-header/ArticleHeader"; + +type ArticleProps = { + title: string; + subtitle: string; + library: string; + author: string; + date: string; +}; + +const Article: FC = ({ + title, + subtitle, + library, + author, + date, +}) => { + return ( +
+ +
+ ); +}; + +export default Article; diff --git a/src/stories/Blocks/article/article.scss b/src/stories/Blocks/article/article.scss new file mode 100644 index 000000000..9485ace79 --- /dev/null +++ b/src/stories/Blocks/article/article.scss @@ -0,0 +1,3 @@ +.article { + background-color: $c-global-primary; +} diff --git a/src/stories/Library/Buttons/row-button/RowButton.stories.tsx b/src/stories/Library/Buttons/row-button/RowButton.stories.tsx new file mode 100644 index 000000000..f22c17ac7 --- /dev/null +++ b/src/stories/Library/Buttons/row-button/RowButton.stories.tsx @@ -0,0 +1,37 @@ +import { ComponentStory, ComponentMeta } from "@storybook/react"; +import { withDesign } from "storybook-addon-designs"; +import RowButton from "./RowButton"; + +export default { + title: "Library / Buttons / RowButton", + component: RowButton, + decorators: [withDesign], + argTypes: { + labels: { + defaultValue: ["Netmedier"], + }, + }, + parameters: { + design: { + type: "figma", + url: "https://www.figma.com/file/Zx9GrkFA3l4ISvyZD2q0Qi/Designsystem?type=design&node-id=7880%3A59070&mode=dev", + }, + layout: "centered", + }, +} as ComponentMeta; + +const Template: ComponentStory = (args) => ( + +); + +export const Default = Template.bind({}); + +export const TwoButtons = Template.bind({}); +TwoButtons.args = { + labels: ["Netmedier", "Licenser"], +}; + +export const ThreeAndMoreButtons = Template.bind({}); +ThreeAndMoreButtons.args = { + labels: ["Netmedier", "Licenser", "This is hiddden"], +}; diff --git a/src/stories/Library/Buttons/row-button/RowButton.tsx b/src/stories/Library/Buttons/row-button/RowButton.tsx new file mode 100644 index 000000000..da2701cf8 --- /dev/null +++ b/src/stories/Library/Buttons/row-button/RowButton.tsx @@ -0,0 +1,30 @@ +import clsx from "clsx"; +import { FC } from "react"; + +type RowButtonProps = { + labels: string[]; + className?: string; +}; + +const RowButton: FC = ({ labels, className }) => ( +
+ {labels.slice(0, 2).map((label) => ( + + ))} + {labels.length > 2 && ( + + )} +
+); + +export default RowButton; diff --git a/src/stories/Library/Buttons/row-button/row-button.scss b/src/stories/Library/Buttons/row-button/row-button.scss new file mode 100644 index 000000000..2a1acf188 --- /dev/null +++ b/src/stories/Library/Buttons/row-button/row-button.scss @@ -0,0 +1,20 @@ +.row-buttons { + display: flex; + flex-direction: row; +} + +.row-button { + height: 40px; + background-color: $c-global-secondary; + padding: 9px $s-md; + display: flex; + align-items: center; + + & + .row-button { + margin-left: $s-sm; + } + + &:hover { + cursor: pointer; + } +} diff --git a/src/stories/Library/article-header/ArticleHeader.tsx b/src/stories/Library/article-header/ArticleHeader.tsx new file mode 100644 index 000000000..497271d61 --- /dev/null +++ b/src/stories/Library/article-header/ArticleHeader.tsx @@ -0,0 +1,37 @@ +import { FC } from "react"; +import RowButton from "../Buttons/row-button/RowButton"; +import ArrowLink from "../links/arrow-link/ArrowLink"; + +type ArticleHeaderProps = { + title: string; + subtitle: string; + library: string; + author: string; + date: string; +}; + +const ArticleHeader: FC = ({ + title, + subtitle, + library, + author, + date, +}) => { + return ( +
+ +

{title}

+

{subtitle}

+

+ {library} + + {author} + + {date} +

+ +
+ ); +}; + +export default ArticleHeader; diff --git a/src/stories/Library/article-header/article-header.scss b/src/stories/Library/article-header/article-header.scss new file mode 100644 index 000000000..c6094644d --- /dev/null +++ b/src/stories/Library/article-header/article-header.scss @@ -0,0 +1,38 @@ +.article-header { + display: grid; + gap: $s-xl; + padding: $s-4xl $s-xl; + position: relative; + + @include breakpoint-s { + padding: $s-4xl $s-7xl; + } + + &__back-link { + position: absolute; + left: $s-md; + top: $s-sm; + + @include breakpoint-s { + left: $s-2xl; + top: $s-lg; + } + } + + &__title, + &__subtitle { + @include breakpoint-s { + max-width: 897px; + } + } + + &__info { + display: flex; + align-items: baseline; + gap: $s-xs; + + &__date { + margin-left: $s-xs; + } + } +} diff --git a/src/stories/Library/links/arrow-link/ArrowLink.stories.tsx b/src/stories/Library/links/arrow-link/ArrowLink.stories.tsx new file mode 100644 index 000000000..16c98a0c8 --- /dev/null +++ b/src/stories/Library/links/arrow-link/ArrowLink.stories.tsx @@ -0,0 +1,27 @@ +import { ComponentStory, ComponentMeta } from "@storybook/react"; +import { withDesign } from "storybook-addon-designs"; +import ArrowLink from "./ArrowLink"; + +export default { + title: "Library / Links / ArrowLink", + component: ArrowLink, + decorators: [withDesign], + argTypes: { + label: { + defaultValue: "Go back", + }, + }, + parameters: { + design: { + type: "figma", + url: "https://www.figma.com/file/Zx9GrkFA3l4ISvyZD2q0Qi/Designsystem?type=design&node-id=7477%3A39098&mode=dev", + }, + layout: "centered", + }, +} as ComponentMeta; + +const Template: ComponentStory = (args) => ( + +); + +export const Default = Template.bind({}); diff --git a/src/stories/Library/links/arrow-link/ArrowLink.tsx b/src/stories/Library/links/arrow-link/ArrowLink.tsx new file mode 100644 index 000000000..ee2fccf53 --- /dev/null +++ b/src/stories/Library/links/arrow-link/ArrowLink.tsx @@ -0,0 +1,21 @@ +import clsx from "clsx"; +import { ReactComponent as ArrowSmallLeft } from "../../Arrows/icon-arrow-ui/icon-arrow-ui-small-left.svg"; + +type ArrowLinkProps = { + label: string; + className: string; +}; + +const ArrowLink: React.FC = ({ label, className }) => { + return ( + +
{label}
+ +
+ ); +}; + +export default ArrowLink; diff --git a/src/stories/Library/links/arrow-link/arrow-link.scss b/src/stories/Library/links/arrow-link/arrow-link.scss new file mode 100644 index 000000000..6542f9d79 --- /dev/null +++ b/src/stories/Library/links/arrow-link/arrow-link.scss @@ -0,0 +1,7 @@ +.arrow-link { + display: block; + text-decoration: none; + &__text { + margin-bottom: -5px; + } +}