Skip to content

Commit

Permalink
Make sure that rich-text has spacing and margin. DDFFORM-5
Browse files Browse the repository at this point in the history
It worked in Storybook, but not in Drupal.
That is because Storybook adds its own wrapper, which made it appear
correct.
  • Loading branch information
rasben committed Dec 15, 2023
1 parent b1889b4 commit a5367c1
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
80 changes: 80 additions & 0 deletions src/stories/Library/rich-text/rich-text.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// This component is used for WYSIWYG content.
// E.g. we cannot control classes of the underlying elements, so in this case
// we will target HTML tags instead.
.rich-text {
@include typography($typo__rich-text-body);

// Setting a max-width to increase readability for sentences.
max-width: $layout__max-width--text;
margin: auto;
padding-left: $layout__page-padding;
padding-right: $layout__page-padding;

a {
@extend %text-inline-link;
}

h2 {
@include typography($typo__h3);
}

h3 {
@include typography($typo__h4);
}

> * {
margin-bottom: $s-md;
}

ol > li,
ul > li {
$_dash-width: 21px;
$_dash-width--wide: 33px;

position: relative;
padding-left: $_dash-width + $s-md;
padding-bottom: $s-lg;

&::before {
position: absolute;
top: 0.8em;
left: 0;
width: $_dash-width;
text-align: center;
}

@include media-query__medium {
padding-left: $_dash-width--wide + $s-lg;

&::before {
width: $_dash-width--wide;
}
}
}

ul > li::before {
content: "";
height: 1px;
background-color: black;
}

ol {
counter-reset: list;

> li::before {
@include typography(
$typo__h4,
(
excludes: (
line-height,
),
)
);

font-weight: normal;
line-height: 0;
counter-increment: list;
content: counter(list) ".";
}
}
}
8 changes: 8 additions & 0 deletions src/styles/scss/tools/variables.layout.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
$layout__max-width: 1024px;
$layout__max-width--small: 768px;
$layout__max-width--large: 1440px;

$layout__max-width--text: 780px;
$layout__max-width--single-media: 896px;
$layout__max-width--multiple-medias: 1240px;

// Some elements should not go out to the edge of the screen on small screens.
// This is the padding that is always shown on the left and right.
$layout__page-padding: $s-xl;

0 comments on commit a5367c1

Please sign in to comment.