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(styles): implemented Bootsrap typography classes to DS #4679

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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/long-walls-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@swisspost/design-system-documentation': patch
'@swisspost/design-system-styles': patch
---

Moved the Bootstrap `.text-start`, `.text-center` and `.text-end` helper classes to design system styles.
6 changes: 6 additions & 0 deletions .changeset/orange-bears-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@swisspost/design-system-documentation': patch
'@swisspost/design-system-styles': patch
---

Implemented `.fs-small`, `.fs-regular` and `.fs-large` helper classes and documented them.
10 changes: 10 additions & 0 deletions packages/documentation/src/stories/utilities/text/text.docs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ The font style classes available are `.fst-normal` and `.fst-italic`.

<Canvas of={TextStories.FontStyle} sourceState="shown" />

### Font Size

<div class="alert alert-warning">
`.small` class for font-size is deprecated and will be replaced with `.fs-small`.
</div>

The font size classes available are `.fs-small`, `.fs-regular`, and `.fs-large`.

<Canvas of={TextStories.TextSize} sourceState="shown" />

### Line Heights

The line height classes available are `.lh-1`, `.lh-sm` and `.lh-lg`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ function getTextUtility(type: string) {
(val: string) => html`<p class="fw-${val}">Font weight ${val}</p>`,
)}
`;
case 'Text Size':
return html`
${['small', 'regular', 'large'].map(
val => html`<p class="fs-${val}">This text has a ${val} font size.</p>`,
)}
`;
case 'Line height':
return html`
${['1', 'sm', 'lg'].map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ export const FontStyle: Story = {
`,
};

export const TextSize: Story = {
render: () => html`
<p class="fs-small">This text has a small font size.</p>
<p class="fs-regular">This text has a regular font size.</p>
<p class="fs-large">This text has a large font size.</p>
`,
};

export const LineHeight: Story = {
render: () =>
html`
Expand Down
2 changes: 2 additions & 0 deletions packages/styles/src/helpers/_index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use 'clearfix';
@use 'visually-hidden';
@use 'focus-ring';
@use 'text-align';
@use 'text-size';
11 changes: 11 additions & 0 deletions packages/styles/src/helpers/text-align.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.text-start {
text-align: left !important;
}

.text-center {
text-align: center !important;
}

.text-end {
text-align: right !important;
}
17 changes: 17 additions & 0 deletions packages/styles/src/helpers/text-size.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@use './../tokens/utilities' as utilities;
@use './../functions/tokens' as tokens;

tokens.$default-map: utilities.$post-typo;

.small,
.fs-small {
font-size: tokens.get('utility-font-size-sm');
}

.fs-regular {
font-size: tokens.get('utility-font-size-md');
}

.fs-large {
font-size: tokens.get('utility-font-size-lg');
}
Loading