-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(component): add main navigation styles (#4148)
This PR is only about styling the main navigation according to the design. The behavior will come with another PR. --------- Co-authored-by: Philipp Gfeller <[email protected]>
- Loading branch information
1 parent
041d6fe
commit c24101c
Showing
6 changed files
with
142 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 70 additions & 43 deletions
113
packages/components/src/components/post-mainnavigation/post-mainnavigation.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,87 @@ | ||
@use '@swisspost/design-system-styles/mixins/button'; | ||
@use '@swisspost/design-system-styles/mixins/icons'; | ||
@use '@swisspost/design-system-styles/mixins/media'; | ||
@use '@swisspost/design-system-styles/mixins/utilities'; | ||
@use '@swisspost/design-system-styles/functions/tokens'; | ||
@use '@swisspost/design-system-styles/tokens/elements'; | ||
@use '@swisspost/design-system-styles/variables/animation'; | ||
|
||
*, | ||
::before, | ||
::after { | ||
box-sizing: border-box; | ||
} | ||
post-mainnavigation { | ||
// reset links and buttons | ||
post-list-item { | ||
a { | ||
text-decoration: none; | ||
border-radius: 0; | ||
} | ||
|
||
slot[name='back-button'], | ||
[slot='back-button'] { | ||
@include media.min(lg) { | ||
display: none; | ||
} | ||
} | ||
button { | ||
@include button.reset-button; | ||
text-align: start; | ||
} | ||
|
||
h2 { | ||
@include media.min(lg) { | ||
@include utilities.visuallyhidden(); | ||
a, | ||
button { | ||
&:hover { | ||
color: tokens.get('post-link-hover-fg', elements.$post-link); | ||
} | ||
} | ||
} | ||
} | ||
|
||
post-mainnavigation { | ||
height: 100%; | ||
} | ||
// desktop styles | ||
@include media.min(lg) { | ||
post-list > [role="list"] { | ||
flex-direction: row; | ||
} | ||
|
||
:host { | ||
height: 100%; | ||
display: block; | ||
} | ||
post-list-item { | ||
a, | ||
button { | ||
padding-inline: var(--post-core-dimension-12); | ||
height: var(--post-core-dimension-56); | ||
border-block: var(--post-core-dimension-4) solid transparent; | ||
display: flex; | ||
align-items: center; | ||
gap: var(--post-core-dimension-4); | ||
font-size: var(--post-core-font-size-16); | ||
} | ||
|
||
.main-navigation { | ||
margin-block: 0; | ||
list-style: none; | ||
display: flex; | ||
padding-left: 0; | ||
gap: 1rem; | ||
// styles specific to for the mega-dropdown buttons | ||
button { | ||
padding-inline-end: var(--post-core-dimension-12); | ||
transition: border-block-end-color animation.$transition-base-timing; | ||
|
||
@include media.max(lg) { | ||
flex-direction: column; | ||
} | ||
&::after { | ||
content: ''; | ||
@include icons.icon(2113); | ||
height: var(--post-core-dimension-24); | ||
width: var(--post-core-dimension-24); | ||
transition: transform animation.$transition-base-timing; | ||
} | ||
|
||
> post-list { | ||
display: flex; | ||
align-items: stretch; | ||
gap: 1rem; | ||
height: 100%; | ||
&.selected { | ||
border-block-end-color: currentColor; | ||
font-weight: var(--post-core-font-weight-700); | ||
|
||
@include media.max(lg) { | ||
flex-direction: column; | ||
&::after { | ||
transform: rotate(180deg); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
a, | ||
post-megadropdown-toggle { | ||
height: 100%; | ||
display: flex; | ||
align-items: center; | ||
// tablet/mobile styles | ||
@include media.max(lg) { | ||
post-list-item { | ||
a, | ||
button { | ||
display: block; | ||
width: 100%; | ||
padding-block: var(--post-core-dimension-12); | ||
padding-inline-end: var(--post-core-dimension-12); | ||
border-bottom: var(--post-core-dimension-1) solid currentColor; | ||
font-weight: var(--post-core-font-weight-700); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters