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(components): header hcm #4262

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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/serious-rockets-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@swisspost/design-system-components': patch
'@swisspost/design-system-styles': patch
---

Added high contrast mode styles for header.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@use '@swisspost/design-system-styles/mixins/utilities';

post-closebutton button post-icon {
myrta2302 marked this conversation as resolved.
Show resolved Hide resolved
@include utilities.high-contrast-mode() {
color: LinkText !important;
myrta2302 marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { version } from '@root/package.json';
@Component({
tag: 'post-closebutton',
shadow: false,
styleUrl: 'post-closebutton.scss',
})
export class PostClosebutton {
@Element() host: HTMLPostClosebuttonElement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@use '@swisspost/design-system-styles/mixins/media';
@use '@swisspost/design-system-styles/variables/animation';
@use '@swisspost/design-system-styles/mixins/utilities';

*,
::before,
Expand All @@ -12,6 +13,9 @@
--global-header-minimal-height: 24px;
--main-header-height: 56px;
--header-height: calc(var(--global-header-height) + var(--main-header-height));
@include utilities.high-contrast-mode() {
display: block;
myrta2302 marked this conversation as resolved.
Show resolved Hide resolved
}

@include media.min(lg) {
display: block;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
@use '@swisspost/design-system-styles/core' as post;
@use '@swisspost/design-system-styles/mixins/utilities';

:host {
display: inline-block;
width: fit-content;
@include utilities.high-contrast-mode() {
color: LinkText;
}
}

button {
Expand Down Expand Up @@ -34,6 +38,9 @@ a {
&[aria-current='page'] {
background-color: #050400;
color: #fff;
@include utilities.high-contrast-mode() {
background-color: SelectedItem;
}
}
}

Expand All @@ -45,6 +52,10 @@ a {

&[aria-current='true'],
&[aria-current='page'] {
@include utilities.high-contrast-mode() {
background-color: SelectedItem;
}

&::after {
content: '';
left: -2px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ tokens.$default-map: components.$post-button;
@include utilities-mx.focus-style;
@include utilities-mx.not-disabled-hover() {
@include button-mx.button-variant-def('hover', 'tertiary');
@include utilities-mx.high-contrast-mode() {
color: LinkText;
}
}

post-icon {
height: var(--post-core-dimension-16);
width: var(--post-core-dimension-16);
}
@include utilities-mx.high-contrast-mode() {
color: LinkText;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
@use '@swisspost/design-system-styles/tokens/elements';
@use '@swisspost/design-system-styles/variables/animation';
@use '@swisspost/design-system-styles/components/header/mixins' as header-mx;
@use '@swisspost/design-system-styles/mixins/utilities';

$nav-height: var(--post-core-dimension-56);

post-mainnavigation {
// reset links and buttons
// reset links and buttons;
post-list-item {
> a {
text-decoration: none;
Expand All @@ -30,12 +31,18 @@ post-mainnavigation {

&:hover {
color: tokens.get('post-link-hover-fg', elements.$post-link);
@include utilities.high-contrast-mode() {
color: LinkText;
}
}

&:focus-visible {
border-radius: var(--post-core-dimension-4);
z-index: 1;
}
@include utilities.high-contrast-mode() {
color: LinkText;
}
}
}

Expand Down Expand Up @@ -68,7 +75,9 @@ post-mainnavigation {
font-size: var(--post-core-font-size-16);
border-block: 0 solid transparent;
border-block-end-color: currentColor;

@include utilities.high-contrast-mode() {
border-block-end-color: LinkText;
}
&:hover {
border-block-width: var(--post-core-dimension-2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
@use '@swisspost/design-system-styles/tokens/helpers';

:host {
@include utilities.high-contrast-mode() {
color: LinkText !important;
}
cursor: pointer;
outline-offset: tokens.get('focus-outline-offset', helpers.$post-focus) !important;
outline: tokens.get('focus-outline-color', helpers.$post-focus) none
tokens.get('focus-outline-width', helpers.$post-focus) !important;
tokens.get('focus-outline-width', helpers.$post-focus) !important;
}

:host(:focus-visible) {
Expand All @@ -17,14 +20,14 @@
}
}

:host([aria-pressed="true"]) {
::slotted([data-showwhen="untoggled"]) {
:host([aria-pressed='true']) {
::slotted([data-showwhen='untoggled']) {
display: none;
}
}

:host([aria-pressed="false"]) {
::slotted([data-showwhen="toggled"]) {
:host([aria-pressed='false']) {
::slotted([data-showwhen='toggled']) {
display: none;
}
}
5 changes: 4 additions & 1 deletion packages/styles/src/components/header/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
@use 'mixins' as *;

post-header {
ul[slot="meta-navigation"] {
@include utilities.high-contrast-mode() {
border-bottom: 2px solid LinkText !important;
}
ul[slot='meta-navigation'] {
gap: var(--post-core-dimension-4);

@include media.max(lg) {
Expand Down
Loading