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

chore(styles, documentation): update styles of btn-link #4200

Merged
merged 7 commits into from
Dec 12, 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
6 changes: 6 additions & 0 deletions .changeset/twenty-chairs-kick.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
---

Updated `.btn-link` to look like a regular link and old `.btn-link` is now `.btn-tertiary .px-0`.
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ const meta: MetaComponent = {
'btn-primary': 'Primary',
'btn-secondary': 'Secondary',
'btn-tertiary': 'Tertiary',
'btn-link': 'Link (no padding)',
'btn-tertiary px-0': 'Tertiary (no padding)',
'btn-link': 'Link',
},
},
options: ['btn-primary', 'btn-secondary', 'btn-tertiary', 'btn-link'],
options: ['btn-primary', 'btn-secondary', 'btn-tertiary', 'btn-tertiary px-0', 'btn-link'],
table: {
category: 'General',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,9 @@ export const FormIntegration: Story = {
${args.radioValidity === 'false' ? invalidFeedback : nothing}
</fieldset>
<div class="mt-16 d-flex gap-16 justify-content-end">
<button type="reset" class="btn btn-link"><post-icon name="2042"></post-icon>Reset</button>
<button type="reset" class="btn btn-tertiary px-0">
<post-icon name="2042"></post-icon>Reset
</button>
<button type="submit" class="btn btn-primary"><span>Submit</span></button>
</div>
</form>`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export function render(args: Args) {
? html` <div class="form-footer-primary-actions">${primaryButton} ${secondaryButton}</div> `
: null}
${args.showTertiaryButton
? html`<button class="btn btn-link">
? html`<button class="btn btn-tertiary px-0">
<post-icon aria-hidden="true" name="${args.tertiaryButtonIcon}"></post-icon
>${args.tertiaryButtonText}
</button>`
Expand Down
23 changes: 17 additions & 6 deletions packages/styles/src/components/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
@use './../placeholders/button' as button-ph;
@use '../functions/tokens';
@use '../tokens/components';
@use '../tokens/elements';

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

Expand All @@ -39,9 +40,13 @@ tokens.$default-map: components.$post-button;
color: var(--post-gray-80);
font-family: inherit;
font-weight: tokens.get('button-label-font-weight');
text-decoration: none !important; // For <a> tags, !important for hover
text-decoration: none;
white-space: nowrap; // Long content should never break in buttons

&:hover {
text-decoration: none;
}

@include button-mx.button-size();

&:disabled {
Expand Down Expand Up @@ -88,8 +93,6 @@ tokens.$default-map: components.$post-button;
}
}

// Tertiary
.btn-link,
.btn-tertiary {
// Styles to improve accessibility in high contrast mode
@include utilities.high-contrast-mode() {
Expand All @@ -105,8 +108,16 @@ tokens.$default-map: components.$post-button;
}
}

// Tertiary with no padding (overrides the padding defined by the sizing classes above)
.btn-link {
padding-inline-start: 0;
padding-inline-end: 0;
text-decoration: tokens.get('link-decoration', elements.$post-link);
border: 0 none;
border-radius: tokens.get('link-border-radius', elements.$post-link);
min-height: 0;
font-size: inherit;
font-weight: inherit;
padding: 0;

&:hover {
color: tokens.get('link-hover-fg', elements.$post-link);
}
}
Loading