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

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f3b2a68
feat: add list style file
Sep 5, 2024
dd1750b
feat: add list-check documentation
Sep 5, 2024
f90299a
chore: add nested unordered list
Sep 6, 2024
9ffa7d3
Merge branch 'main' into 3438-component-check-list
Sep 9, 2024
5bd951d
feat: add basic style of check list
Sep 9, 2024
64165d2
chore: adjust spaces
Sep 9, 2024
7bbe725
style clean-up variable
Sep 9, 2024
c3cb103
chore: move list to Components
Sep 9, 2024
d1d08b7
Merge branch 'main' into 3438-component-check-list
bashirkarimi Sep 9, 2024
1741047
chore: remove extra paragraphs
Sep 9, 2024
e753c90
fix: remove unnecessary nested selector
Sep 9, 2024
025ade8
Merge branch 'main' into 3438-component-check-list
Sep 10, 2024
33b23f1
feat: implement tokens with get function
Sep 10, 2024
3450d87
feat: add changeset
Sep 10, 2024
968b0d7
Merge branch 'main' into 3438-component-check-list
Sep 10, 2024
a4a3011
Merge branch 'main' into 3438-component-check-list
Sep 10, 2024
7ef2afa
chore: add space to check mark on mobile
Sep 10, 2024
438d838
Merge branch 'main' into 3438-component-check-list
bashirkarimi Sep 11, 2024
cb16621
Merge branch 'main' into 3438-component-check-list
bashirkarimi Sep 12, 2024
4edb8a9
chore: reformat the css properties
Sep 13, 2024
e089735
Merge branch 'main' into 3438-component-check-list
bashirkarimi Sep 16, 2024
8a73022
Merge branch 'main' into 3438-component-check-list
bashirkarimi Sep 18, 2024
ce49461
Merge branch 'main' into 3438-component-check-list
gfellerph Sep 27, 2024
9796f64
Merge branch 'main' into 3438-component-check-list
Sep 30, 2024
a3b0fc2
chore: adjust check mark size and use icon mixin
Oct 1, 2024
1ab8058
style: format code
Oct 1, 2024
0c7d64f
Merge branch 'main' into 3438-component-check-list
bashirkarimi Oct 1, 2024
5d27550
fix: update tokens
Oct 1, 2024
2016e74
fix: adjust space between icon and text
Oct 1, 2024
801f284
Merge branch 'main' into 3438-component-check-list
Oct 4, 2024
1ee084e
feat: add style for high contrast mode
Oct 4, 2024
6b32e06
Merge branch 'main' into 3438-component-check-list
bashirkarimi Oct 7, 2024
a40ec70
fix: update token name
Oct 7, 2024
70bf8f4
Merge branch 'main' into 3438-component-check-list
Oct 18, 2024
e9edf80
fix: change token set and remove keys
Oct 18, 2024
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,29 @@ 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 long text to check how it look like. Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text
ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make
a type specimen book
</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 @@ -22,6 +22,7 @@
@use 'forms';
@use 'grid';
@use 'icons';
@use 'list';
@use 'lead';
@use 'list-group';
@use 'modal';
Expand Down
74 changes: 74 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,74 @@
@use '../mixins/media';
@use '../mixins/icons';
@use '../mixins/utilities';
@use '../functions/tokens';
@use '../tokens/components';

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

$sizing-icon: tokens.get('list-simple-checks-sizing-icon');
$padding-icon: tokens.get('list-simple-checks-padding-icon');

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

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

&::before,
&::after {
content: '';
position: absolute;
}

&::before {
@include icons.icon(2105);
left: calc($padding-icon);
top: calc($padding-icon);
width: $sizing-icon;
height: $sizing-icon;
background-color: tokens.get('list-checks-color-icon-fg');
z-index: 2;

@include utilities.high-contrast-mode() {
background-color: Canvas;
}
}

&::after {
left: 0;
top: 0;
width: calc(#{$sizing-icon} + (#{$padding-icon} * 2));
height: calc(#{$sizing-icon} + (#{$padding-icon} * 2));
background-color: tokens.get('list-checks-color-icon-bg');
border-radius: 50%;

@include utilities.high-contrast-mode() {
background-color: CanvasText;
color: Canvas;
}
}

@include media.max(400px) {
&::before,
&::after {
margin-inline: tokens.get('list-simple-checks-icon-container-inline');
margin-block: tokens.get('list-simple-checks-icon-container-block');
}
}

> ul {
padding-bottom: 0;
}
}

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