-
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(components): add composable footer (#4190)
Co-authored-by: Philipp Gfeller <[email protected]>
- Loading branch information
1 parent
b4179db
commit 14b4de9
Showing
43 changed files
with
953 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@swisspost/design-system-components': minor | ||
'@swisspost/design-system-styles': minor | ||
--- | ||
|
||
Added composable footer component. |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@swisspost/design-system-components': patch | ||
--- | ||
|
||
Added a fixed slot `post-list-item` on the `post-list-item` host element, so it is no longer necessary to add it manually. |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@swisspost/design-system-components': patch | ||
--- | ||
|
||
Fixed the used `headingLevel` in the `post-accorddion-item` component. The component now uses the value from its closest `post-accorddion` parent component, if this is specified and falls back to `h2` if not specified. |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@swisspost/design-system-styles': patch | ||
--- | ||
|
||
Fixed the `btn-icon` styles, so icons within can no longer be rendered too small, because of the inline-padding on the button. |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@swisspost/design-system-components': minor | ||
--- | ||
|
||
Added the parts `button` and `body` in the `post-accordion-item` component, so one can override styles from the outside. |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@swisspost/design-system-styles': patch | ||
--- | ||
|
||
Fixed the appstore-badge styles to get rid of the inline gap below. |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@swisspost/design-system-styles': minor | ||
--- | ||
|
||
Added the possibility to define a `$child-selector` parameter with our list mixins, so they can be used also with custom elements. |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@swisspost/design-system-documentation': minor | ||
'@swisspost/design-system-components': minor | ||
--- | ||
|
||
Added the css parts `button` and `body` in the `post-accorddion-item` component. |
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const FOOTER_ID = 'd97528b3-a9ef-4201-bf28-9caf6e8997dc'; | ||
|
||
describe('Footer', () => { | ||
describe('Structure & Props', () => { | ||
beforeEach(() => { | ||
cy.getComponent('footer', FOOTER_ID); | ||
cy.get('@footer').find('> footer h2.visually-hidden').as('label'); | ||
}); | ||
|
||
it('should render', () => { | ||
cy.get('@footer').should('exist'); | ||
}); | ||
|
||
it('should set label text according to "label" prop', () => { | ||
cy.get('@label').should('have.text', 'Footer label'); | ||
}); | ||
|
||
it('should render the post-accorddion on mobile', () => { | ||
cy.viewport('iphone-3'); | ||
cy.get('@footer').find('post-accorddion').as('accorddion'); | ||
|
||
cy.get('@accorddion').should('exist'); | ||
}); | ||
|
||
it('should have accorddion-items with slotted elements on mobile', () => { | ||
cy.viewport('iphone-3'); | ||
cy.get('@footer').find('post-accorddion').as('accorddion'); | ||
cy.get('@accorddion').find('post-accordion-item').as('accordionItems'); | ||
|
||
cy.get('@accordionItems').should('have.length', 4); | ||
cy.get('@accordionItems') | ||
.find('slot[name="header"]') | ||
.each($slot => { | ||
const headerSlot = $slot.get(0) as HTMLSlotElement; | ||
|
||
expect(headerSlot.assignedElements().length).to.be.greaterThan(0); | ||
}); | ||
cy.get('@accordionItems') | ||
.find('slot:not([name])') | ||
.each($slot => { | ||
const slotDefault = $slot.get(0) as HTMLSlotElement; | ||
|
||
expect(slotDefault.assignedElements().length).to.be.greaterThan(0); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('Accessibility', () => { | ||
it('Has no detectable a11y violations', () => { | ||
cy.getSnapshots('footer'); | ||
cy.checkA11y('#root-inner'); | ||
}); | ||
}); | ||
}); |
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
153 changes: 153 additions & 0 deletions
153
packages/components/src/components/post-footer/post-footer.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 |
---|---|---|
@@ -0,0 +1,153 @@ | ||
@use '@swisspost/design-system-styles/variables/color'; | ||
@use '@swisspost/design-system-styles/mixins/media'; | ||
@use '@swisspost/design-system-styles/mixins/list'; | ||
@use '@swisspost/design-system-styles/mixins/utilities'; | ||
|
||
:host { | ||
display: block; | ||
} | ||
|
||
footer { | ||
background-color: color.$yellow; | ||
|
||
// mobile | ||
--post-footer-container-padding-block: 32px; | ||
--post-footer-container-padding-inline: 16px; | ||
--post-footer-container-max-width: 1200px; | ||
|
||
--post-footer-grid-template: auto / auto; | ||
--post-footer-grid-row-gap: 0; | ||
--post-footer-grid-column-gap: 0; | ||
--post-footer-grid-margin-block-end: 24px; | ||
--post-footer-grid-padding-block-end: 0; | ||
|
||
--post-footer-column-flex-direction: column; | ||
--post-footer-column-align-items: start; | ||
--post-footer-column-gap: 0; | ||
|
||
--post-footer-post-list-flex-direction: column; | ||
--post-footer-post-list-gap: 8px; | ||
--post-footer-post-list-align-items: start; | ||
|
||
--post-footer-socialmedia-margin-block-end: var(--post-footer-grid-margin-block-end); | ||
--post-footer-app-margin-block-end: var(--post-footer-grid-margin-block-end); | ||
--post-footer-businesssectors-margin-block-end: var(--post-footer-grid-margin-block-end); | ||
|
||
--post-footer-meta-margin-block-end: 16px; | ||
--post-footer-meta-font-size: inherit; | ||
|
||
--post-footer-copyright-font-size: var(--post-footer-meta-font-size); | ||
|
||
// tablet sm | ||
@include media.min(sm) { | ||
--post-footer-container-padding-block: 40px; | ||
|
||
--post-footer-grid-template: repeat(2, auto) / repeat(2, auto); | ||
--post-footer-grid-row-gap: 32px; | ||
--post-footer-grid-column-gap: 16px; | ||
--post-footer-grid-margin-block-end: 32px; | ||
--post-footer-grid-padding-block-end: 32px; | ||
|
||
--post-footer-post-list-flex-direction: row; | ||
--post-footer-post-list-gap: 16px; | ||
--post-footer-post-list-align-items: center; | ||
|
||
--post-footer-meta-margin-block-end: 8px; | ||
} | ||
|
||
// tablet md | ||
@include media.min(md) { | ||
--post-footer-container-padding-inline: 40px; | ||
} | ||
|
||
// desktop lg | ||
@include media.min(lg) { | ||
--post-footer-container-padding-block: 56px; | ||
|
||
--post-footer-grid-template: auto / repeat(4, auto); | ||
--post-footer-grid-row-gap: 0; | ||
--post-footer-grid-column-gap: 24px; | ||
--post-footer-grid-margin-block-end: 40px; | ||
|
||
--post-footer-column-flex-direction: row; | ||
--post-footer-column-align-items: center; | ||
--post-footer-column-gap: 32px; | ||
|
||
--post-footer-post-list-gap: 24px; | ||
|
||
--post-footer-businesssectors-margin-block-end: 24px; | ||
|
||
--post-footer-meta-font-size: 16px; | ||
} | ||
} | ||
|
||
.visually-hidden { | ||
@include utilities.visuallyhidden(); | ||
} | ||
|
||
.footer-container { | ||
box-sizing: content-box; | ||
margin: 0 auto; | ||
padding: var(--post-footer-container-padding-block) var(--post-footer-container-padding-inline); | ||
max-width: var(--post-footer-container-max-width); | ||
} | ||
|
||
.footer-grid { | ||
display: grid; | ||
grid-template: var(--post-footer-grid-template); | ||
row-gap: var(--post-footer-grid-row-gap); | ||
column-gap: var(--post-footer-grid-column-gap); | ||
margin-block-end: var(--post-footer-grid-margin-block-end); | ||
padding-block-end: var(--post-footer-grid-padding-block-end); | ||
|
||
// post-accordion-item | ||
::part(button), | ||
::part(body) { | ||
padding-inline: 0; | ||
} | ||
} | ||
|
||
.footer-column { | ||
display: flex; | ||
flex-direction: var(--post-footer-column-flex-direction); | ||
flex-wrap: wrap; | ||
justify-content: space-between; | ||
align-items: var(--post-footer-column-align-items); | ||
column-gap: var(--post-footer-column-gap); | ||
} | ||
|
||
.footer-socialmedia, | ||
.footer-app, | ||
.footer-businesssectors, | ||
.footer-meta { | ||
::slotted(post-list) { | ||
display: flex !important; | ||
flex-direction: var(--post-footer-post-list-flex-direction) !important; | ||
gap: var(--post-footer-post-list-gap) !important; | ||
align-items: var(--post-footer-post-list-align-items) !important; | ||
} | ||
} | ||
|
||
.footer-socialmedia { | ||
margin-block-end: var(--post-footer-socialmedia-margin-block-end); | ||
} | ||
|
||
.footer-app { | ||
margin-block-end: var(--post-footer-app-margin-block-end); | ||
} | ||
|
||
.footer-businesssectors { | ||
margin-block-end: var(--post-footer-businesssectors-margin-block-end); | ||
} | ||
|
||
.footer-meta { | ||
margin-block-end: var(--post-footer-meta-margin-block-end); | ||
font-size: var(--post-footer-meta-font-size); | ||
} | ||
|
||
.footer-copyright { | ||
display: flex; | ||
flex-wrap: wrap; | ||
column-gap: 0.5rem; | ||
font-size: var(--post-footer-copyright-font-size); | ||
} |
Oops, something went wrong.