Skip to content

Commit

Permalink
Merge pull request #682 from danskernesdigitalebibliotek/DDFFORM-917-…
Browse files Browse the repository at this point in the history
…sliderheadline-title-underline

Refactored Underlined Title for `Slider`
  • Loading branch information
kasperbirch1 authored Jul 29, 2024
2 parents cb1b89d + e56846d commit 8decd5d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/stories/Library/slider/Slider.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default {
},
argTypes: {
title: {
defaultValue: "Inspiration",
defaultValue: "Get <u>new</u> Inspiration",
type: "string",
},
items: {
Expand Down
9 changes: 8 additions & 1 deletion src/stories/Library/slider/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ const Slider: FC<SliderProps> = ({ title, items }) => {

<div className="slider swiper">
<div className="slider__header">
{title ? <h2 className="slider__title">{title}</h2> : ""}
{title && (
<h2
className="slider__title"
// We need to be able to replicate our WYSIWYG field in Drupal that makes it possible to underline (<u>) words.
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: title }}
/>
)}

<div className="slider__controls" data-glide-el="controls">
<button
Expand Down
4 changes: 1 addition & 3 deletions src/stories/Library/slider/slider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
}

.slider__title {
@extend %title-underline;
@include typography($typo__h2);

display: flex;
@include u-extending-underline-style;
}

.slider__controls {
Expand Down
2 changes: 2 additions & 0 deletions src/styles/scss/tools/placeholder.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
}
}

// Todo: Should be removed. Use @mixin u-extending-underline-style instead.
%title-underline {
position: relative;
&::before {
Expand All @@ -32,6 +33,7 @@
}
}

// Todo: Should be removed. Use @mixin u-extending-underline-style instead.
%title-underline--narrow {
@extend %title-underline;

Expand Down

0 comments on commit 8decd5d

Please sign in to comment.