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): tokenize the Link component styles #3590

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

alionazherdetska
Copy link
Contributor

No description provided.

@alionazherdetska alionazherdetska requested a review from a team as a code owner September 26, 2024 08:44
@alionazherdetska alionazherdetska linked an issue Sep 26, 2024 that may be closed by this pull request
5 tasks
Copy link

changeset-bot bot commented Sep 26, 2024

🦋 Changeset detected

Latest commit: f9aab11

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@swisspost/design-system-styles Minor
@swisspost/design-system-documentation Minor
@swisspost/design-system-components-angular-workspace Patch
@swisspost/design-system-components Minor
@swisspost/internet-header Patch
@swisspost/design-system-intranet-header-workspace Patch
@swisspost/design-system-nextjs-integration Patch
@swisspost/design-system-styles-primeng-workspace Patch
@swisspost/design-system-intranet-header Minor
@swisspost/design-system-styles-primeng Minor
@swisspost/design-system-components-react Minor
@swisspost/design-system-components-angular Minor
@swisspost/design-system-intranet-header-showcase Patch
@swisspost/design-system-tokens Minor
@swisspost/design-system-icons Minor
@swisspost/design-system-migrations Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@swisspost-bot
Copy link
Contributor

swisspost-bot commented Sep 26, 2024

Related Previews

@alionazherdetska alionazherdetska changed the title [component]: Text link feat(styles): tokenize the Link component styles Sep 26, 2024
Copy link
Contributor

@alizedebray alizedebray left a comment

Choose a reason for hiding this comment

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

Good job 👍
Do not hesitate to contact me if one of my comments is not clear

packages/styles/src/elements/link.scss Outdated Show resolved Hide resolved
);
}

@include utilities.high-contrast-mode() {
Copy link
Contributor

Choose a reason for hiding this comment

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

The link is missing a hover and focus state on high contrast mode, you can check w3 website to know how they handle this: https://www.w3.org/WAI/ARIA/apg/practices/names-and-descriptions/

Copy link
Contributor

Choose a reason for hiding this comment

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

There is also a mixin to do this in the design-system:

// example
@include high-contrast-mode() {
  color: LinkText;
  
  &:hover {
    color: HighlightText;
  }
}
```

Here you can find he available color names: https://www.w3.org/TR/css-color-4/#css-system-colors

import { MetaComponent } from '@root/types';

const meta: MetaComponent = {
id: 'link-component',
Copy link
Contributor

Choose a reason for hiding this comment

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

We usually use random UUID here, you can generate one on this website for axample: https://www.uuidgenerator.net/

Use links to navigate users to another location, such as a different site, resource, or section within the same page.
</div>

Apply the override classes for custom styling as needed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure I get this sentence, what do you mean?

Copy link
Contributor

Choose a reason for hiding this comment

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

When you create a new snapshot file you also need to create the matching visual regression test here: https://github.com/swisspost/design-system/tree/main/packages/documentation/cypress/snapshots/components

<div>
${['bg-white', 'bg-dark'].map(
bg => html`
<div class="${bg} d-flex flex-column gap-regular p-regular mt-regular">
Copy link
Contributor

Choose a reason for hiding this comment

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

Here you also have to set a data-color-mode="light" or data-color-mode="dark" attribute so that the correct set of token is used.

Copy link
Contributor

@oliverschuerch oliverschuerch left a comment

Choose a reason for hiding this comment

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

Please relocate this component so it appears under "Foundations/Typography/Link"!
And also move the files.

.changeset/lazy-gorillas-admire.md Outdated Show resolved Hide resolved
);
}

@include utilities.high-contrast-mode() {
Copy link
Contributor

Choose a reason for hiding this comment

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

There is also a mixin to do this in the design-system:

// example
@include high-contrast-mode() {
  color: LinkText;
  
  &:hover {
    color: HighlightText;
  }
}
```

Here you can find he available color names: https://www.w3.org/TR/css-color-4/#css-system-colors

Copy link

sonarcloud bot commented Oct 8, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[component]: Text link
5 participants