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: component check list #3511

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft
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
6 changes: 6 additions & 0 deletions .changeset/old-beers-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@swisspost/design-system-documentation': minor
'@swisspost/design-system-styles': minor
---

Added Check List, which is an unordered list. Each list item is preceded with check icon.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as ListStories from './list.stories';

# Lists

<p className="lead">Use lists to group a collection of related items.</p>
<p className="lead">Use lists to group a collection of related items.</p>

There are three types of HTML lists: unordered lists, ordered lists, and description lists.
Utility classes allow you to style each of these lists in different ways.
Expand All @@ -29,7 +29,7 @@ This only applies to immediate child list items, meaning you will need to add th
Remove a list’s bullets and apply some light margin with a combination of two classes,
`.list-inline` and `.list-inline-item`.

<Canvas of={ListStories.InlineList} sourceState="shown"/>
<Canvas of={ListStories.InlineList} sourceState="shown" />

## Ordered List

Expand All @@ -40,6 +40,13 @@ It is created using a `<ol>` tag and list items are preceded by ascending number

<Canvas of={ListStories.OrderedList} sourceState="shown" />

## Check List

An unordered list groups related items in no specific order.
It is created using a `<ul>` tag with `list-checks` class. Each list item is preceded with check icon.

<Canvas of={ListStories.CheckList} sourceState="shown" />

## Description List

A description list is a list of terms, with a description of each term.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MetaExtended } from '@root/types';

const meta: MetaExtended = {
id: 'e76192bb-b2eb-487a-b9c1-ef938bccdfc4',
title: 'Utilities/List',
title: 'Components/List',
parameters: {
badges: [],
},
Expand Down Expand Up @@ -83,6 +83,24 @@ export const OrderedList: Story = {
`,
};

export const CheckList: Story = {
render: () => html`
<ul class="list-checks">
<li>This is a check list item.</li>
<li>And another one.</li>
<li>
Nested list:
<ul class="list-checks">
<li>This is a check list item.</li>
<li>And another one.</li>
<li>And one more.</li>
</ul>
</li>
<li>And another one.</li>
</ul>
`,
};

export const DescriptionList: Story = {
render: () => html`
<dl>
Expand Down
1 change: 1 addition & 0 deletions packages/styles/src/components/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
@use 'forms';
@use 'grid';
@use 'icons';
@use 'list';
@use 'list-group';
@use 'modal';
@use 'pagination';
Expand Down
54 changes: 54 additions & 0 deletions packages/styles/src/components/list.scss
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please update this file by replacing the bottom and left properties with block-end and inline-start?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bottom and left which have 0 value are reseting the reboot and can not be changed. The rest are changed accordingly.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
@use './../themes/bootstrap/core' as *;
@use '../tokens/components' as components;
@use '../functions/tokens' as tokens;
@use './../functions/icons';

tokens.$default-map: components.$post-list;

$sizing-icon: tokens.get('post-list-checks', 'sizing-icon');
$padding-icon: tokens.get('post-list-checks', 'spacing-padding-icon');

.list-checks {
list-style: none;
padding-left: 0;
padding-block: tokens.get('post-list-checks', 'spacing-padding-block-outer');
margin-bottom: 0;

> li {
position: relative;
padding-inline-start: calc(
#{tokens.get('post-list-checks', 'spacing-gap-inline-text'),
} + #{$sizing-icon}
);

&::before {
content: '';
position: absolute;
left: 0;
width: $sizing-icon;
height: $sizing-icon;
padding: $padding-icon;
background-repeat: no-repeat;
background-position-x: 50%;
background-position-y: center;
background-color: tokens.get('post-list-checks', 'color-icon-bg');
border-radius: 50%;
background-size: calc(#{$sizing-icon} - #{$padding-icon} * 2);
background-image: url('#{icons.get-colored-svg-url("2105", "white")}'); // 'white' should be changed with variable
}

@include media-breakpoint-down(sm) {
&::before {
margin: tokens.get('post-list-checks', 'spacing-padding-icon');
}
}

> ul {
padding-bottom: 0;
}
}

> li:not(:last-child) {
margin-block-end: tokens.get('post-list-checks', 'spacing-gap-block-text');
}
}
Loading