diff --git a/base.scss b/base.scss index 359618de7..85bda840f 100644 --- a/base.scss +++ b/base.scss @@ -142,6 +142,7 @@ @import "./src/stories/Library/opening-hours/opening-hours-skeleton"; @import "./src/stories/Library/filtered-event-list/filtered-event-list"; @import "./src/stories/Library/event-list-stacked/event-list-stacked"; +@import "./src/stories/Library/banner/banner"; // Autosuggest block styling needs to be loaded before the rest of the scss for autosuggest @import "./src/stories/Blocks/autosuggest/autosuggest"; diff --git a/public/icons/basic/icon-underlined.svg b/public/icons/basic/icon-underlined.svg new file mode 100644 index 000000000..d76d2cbf3 --- /dev/null +++ b/public/icons/basic/icon-underlined.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/stories/Library/banner/Banner.stories.tsx b/src/stories/Library/banner/Banner.stories.tsx new file mode 100644 index 000000000..70b4fc002 --- /dev/null +++ b/src/stories/Library/banner/Banner.stories.tsx @@ -0,0 +1,52 @@ +import { ComponentStory, ComponentMeta } from "@storybook/react"; +import { withDesign } from "storybook-addon-designs"; +import Banner from "./Banner"; +import ImageCredited from "../image-credited/ImageCredited"; + +export default { + title: "Library / Banner", + component: Banner, + decorators: [withDesign], + parameters: { + design: { + type: "figma", + url: "https://www.figma.com/file/Zx9GrkFA3l4ISvyZD2q0Qi/Designsystem?type=design&node-id=7477-39243&mode=dev", + }, + }, + argTypes: { + image: { + defaultValue: ( + + ), + }, + title: { + name: "Title", + defaultValue: "Hvad skal jeg høre?", + }, + description: { + name: "Description", + defaultValue: + "Om du er dedikeret musiknørd eller moderat musikinteresseret, så er dette siden til dig. Her kan du finde anbefalinger, digitale musikmagasiner, nyheder, musiklitteratur og meget mere.", + control: { type: "text" }, + }, + }, +} as ComponentMeta; + +const Template: ComponentStory = (args) => ; + +export const Default = Template.bind({}); + +export const NoImage = Template.bind({}); +NoImage.args = { + title: "Title uden billede", + image: undefined, +}; + +export const NoDescription = Template.bind({}); +NoDescription.args = { + title: "Banner uden beskrivelse", + description: undefined, +}; diff --git a/src/stories/Library/banner/Banner.tsx b/src/stories/Library/banner/Banner.tsx new file mode 100644 index 000000000..521521ba1 --- /dev/null +++ b/src/stories/Library/banner/Banner.tsx @@ -0,0 +1,33 @@ +import { FC, ReactNode } from "react"; +import MediaContainer from "../media-container/MediaContainer"; +import { ReactComponent as ArrowLargeRight } from "../Arrows/icon-arrow-ui/icon-arrow-ui-large-right.svg"; + +type BannerType = { + title: string; + image?: ReactNode; + description?: string; +}; + +const Banner: FC = ({ image, title, description }) => { + return ( + + {image && ( +
+ +
+ )} +
+

) words. + // eslint-disable-next-line react/no-danger + dangerouslySetInnerHTML={{ __html: title }} + /> +

{description}

+ +

+
+ ); +}; + +export default Banner; diff --git a/src/stories/Library/banner/banner.scss b/src/stories/Library/banner/banner.scss new file mode 100644 index 000000000..302b08bd5 --- /dev/null +++ b/src/stories/Library/banner/banner.scss @@ -0,0 +1,75 @@ +@mixin banner-height { + height: 500px; + @include media-query__medium { + height: 810px; + } +} + +@mixin banner-text-margin { + margin-bottom: $s-md; + @include media-query__medium { + margin-bottom: $s-xl; + } +} + +.banner { + @include layout-container($layout__max-width--large, 0); + @include banner-height; + display: grid; + grid-template-rows: 1fr auto 1fr; + text-decoration: none; +} + +.banner-content { + padding: $s-xl; + max-width: 375px; + background-color: white; + grid-row: 2; + grid-column: 1; + + @include media-query__medium { + padding: $s-2xl; + max-width: 575px; + margin-left: 250px; + } +} + +.banner-content__title { + @include typography($typo__h1); + @include banner-text-margin; + + u { + position: relative; + text-decoration: none; + + &::after { + content: ""; + position: absolute; + bottom: -5px; + left: 0; + width: 100%; + height: 10px; + background-size: 100% 100%; + // Underlined icon from public/icons/basic/icon-underlined.svg + background-image: url("data:image/svg+xml,%3Csvg width='101' height='7' viewBox='0 0 101 7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.88867 6C36.7022 -0.286878 63.0591 0.988901 99.1109 1.35819' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A"); + } + } +} + +.banner-content__description { + @include typography($typo__body-medium); + @include banner-text-margin; + color: $color__global-grey; +} + +.banner-visual { + grid-row: 1 / -1; + grid-column: 1; + + // Todo: can this be done in drupal? + img { + @include banner-height; + object-fit: cover; + object-position: center; + } +}