Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sbb-lead-container): add spacing class support for notification #3019

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/elements/lead-container/lead-container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
margin-block-start: 0;
}

::slotted(sbb-notification.sbb-lead-container-spacing) {
margin-block-end: var(--sbb-spacing-responsive-xxxs);
}

::slotted(.sbb-lead-container-lead-text) {
margin-block: 0 var(--sbb-spacing-responsive-s);
}
Expand Down
8 changes: 7 additions & 1 deletion src/elements/lead-container/lead-container.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import '../alert.js';
import '../breadcrumb.js';
import '../image.js';
import '../link/block-link/block-link.js';
import '../notification.js';
import '../title.js';
import './lead-container.js';

Expand All @@ -16,7 +17,7 @@ const DefaultTemplate = (): TemplateResult => html`
<sbb-lead-container>
<style>
p.other-content {
margin-block-end: 0;
margin-block: 0;
}
</style>
<sbb-image
Expand Down Expand Up @@ -55,6 +56,11 @@ const DefaultTemplate = (): TemplateResult => html`
ultricies in tincidunt quis, mattis eu quam. Nulla sit amet lorem fermentum, molestie nunc ut,
hendrerit risus.
</p>
<sbb-notification type="info" class="sbb-lead-container-spacing">
Vestibulum rutrum elit et lacus sollicitudin, quis malesuada lorem vehicula. Suspendisse at
augue quis tellus vulputate tempor. Vivamus urna velit, varius nec est ac, mollis efficitur
lorem. Quisque non nisl eget massa interdum tempus. Praesent vel feugiat metus.
</sbb-notification>
<p class="sbb-text-m other-content">
Other content. Vestibulum rutrum elit et lacus sollicitudin, quis malesuada lorem vehicula.
Suspendisse at augue quis tellus vulputate tempor. Vivamus urna velit, varius nec est ac,
Expand Down
8 changes: 7 additions & 1 deletion src/elements/lead-container/lead-container.visual.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import '../alert.js';
import '../breadcrumb.js';
import '../image.js';
import '../link/block-link/block-link.js';
import '../notification.js';
import '../title.js';
import './lead-container.js';

Expand All @@ -27,7 +28,7 @@ describe(`sbb-lead-container`, () => {
<sbb-lead-container>
<style>
p.other-content {
margin-block-end: 0;
margin-block: 0;
}
</style>
${image}
Expand Down Expand Up @@ -59,6 +60,11 @@ describe(`sbb-lead-container`, () => {
tincidunt quis, mattis eu quam. Nulla sit amet lorem fermentum, molestie nunc ut, hendrerit
risus.
</p>
<sbb-notification type="info" class="sbb-lead-container-spacing">
Vestibulum rutrum elit et lacus sollicitudin, quis malesuada lorem vehicula. Suspendisse at
augue quis tellus vulputate tempor. Vivamus urna velit, varius nec est ac, mollis efficitur
lorem. Quisque non nisl eget massa interdum tempus. Praesent vel feugiat metus.
</sbb-notification>
<p class="sbb-text-m other-content">
Other content. Vestibulum rutrum elit et lacus sollicitudin, quis malesuada lorem vehicula.
Suspendisse at augue quis tellus vulputate tempor. Vivamus urna velit, varius nec est ac,
Expand Down
11 changes: 10 additions & 1 deletion src/elements/lead-container/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ However, consumers can use the predefined classes
As per design rules, the spacings are defined as following:

```html
<sbb-alert-group></sbb-alert-group>
<!-- var(--sbb-spacing-responsive-m) -->
<sbb-breadcrump-group></sbb-breadcrump-group>
<!-- var(--sbb-spacing-4x) -->
<sbb-block-link></sbb-block-link>
Expand All @@ -15,6 +17,8 @@ As per design rules, the spacings are defined as following:
<!-- var(--sbb-spacing-responsive-s) -->
<p></p>
<!-- var(--sbb-spacing-responsive-s) -->
<sbb-notification></sbb-notification>
<!-- var(--sbb-spacing-responsive-xxxs) -->
...
<!-- The last element should have zero block-end spacing to the container -->
```
Expand All @@ -25,7 +29,7 @@ Full example with applied spacings (CSS classes) in content:
<sbb-lead-container>
<style>
p.other-content {
margin-block-end: 0;
margin-block: 0;
}
</style>
<sbb-image
Expand Down Expand Up @@ -57,6 +61,11 @@ Full example with applied spacings (CSS classes) in content:
</sbb-block-link>
<sbb-title class="sbb-lead-container-spacing">Title</sbb-title>
<p class="sbb-text-xl sbb-lead-container-lead-text">Lead text.</p>
<sbb-notification type="info" class="sbb-lead-container-spacing">
Vestibulum rutrum elit et lacus sollicitudin, quis malesuada lorem vehicula. Suspendisse at
augue quis tellus vulputate tempor. Vivamus urna velit, varius nec est ac, mollis efficitur
lorem. Quisque non nisl eget massa interdum tempus. Praesent vel feugiat metus.
</sbb-notification>
<p class="sbb-text-m other-content">Other content.</p>
</sbb-lead-container>
```
Expand Down
Loading