From d7e11728f4b352f37d44f785f07a4c593e083bfc Mon Sep 17 00:00:00 2001 From: Myrta Sakellariou <66249294+myrta2302@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:45:24 +0200 Subject: [PATCH] feat(styles): updated sizing utility (no tokens) (#4012) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alizé Debray <33580481+alizedebray@users.noreply.github.com> Co-authored-by: Oliver Schürch --- .changeset/soft-pugs-dream.md | 6 + .changeset/violet-poems-attend.md | 6 + .../snapshots/utilities/sizing.snapshot.ts | 22 +++ .../select-custom-basic.sample.html | 2 +- .../select-custom-floating.sample.html | 2 +- .../components/slider/slider.stories.ts | 2 +- .../foundations/logo/logo.snapshot.stories.ts | 2 +- .../stories/foundations/logo/logo.stories.ts | 4 +- .../stories/utilities/sizing/sizing.docs.mdx | 61 +++---- .../utilities/sizing/sizing.module.scss | 18 +- .../sizing/sizing.snapshot.stories.ts | 139 ++++++++++++++++ .../utilities/sizing/sizing.stories.ts | 156 ++++++++++-------- .../utilities/sizing/sizing.styles.scss | 30 +++- .../utilities/spacing/spacing.stories.ts | 2 +- packages/documentation/src/utils/naming.ts | 3 + packages/migrations/src/utils/constants.ts | 1 + packages/styles/src/components/sizing.scss | 21 +-- .../src/themes/bootstrap/_utilities.scss | 13 ++ packages/styles/src/utilities/_variables.scss | 121 ++++++++++++++ packages/styles/src/variables/_index.scss | 1 + packages/styles/src/variables/_sizing.scss | 69 ++++++++ packages/styles/src/variables/_spacing.scss | 13 -- 22 files changed, 548 insertions(+), 146 deletions(-) create mode 100644 .changeset/soft-pugs-dream.md create mode 100644 .changeset/violet-poems-attend.md create mode 100644 packages/documentation/cypress/snapshots/utilities/sizing.snapshot.ts create mode 100644 packages/documentation/src/stories/utilities/sizing/sizing.snapshot.stories.ts create mode 100644 packages/documentation/src/utils/naming.ts create mode 100644 packages/styles/src/variables/_sizing.scss diff --git a/.changeset/soft-pugs-dream.md b/.changeset/soft-pugs-dream.md new file mode 100644 index 0000000000..10b4189721 --- /dev/null +++ b/.changeset/soft-pugs-dream.md @@ -0,0 +1,6 @@ +--- +'@swisspost/design-system-documentation': minor +'@swisspost/design-system-styles': minor +--- + +Updated the utility classes for sizing. diff --git a/.changeset/violet-poems-attend.md b/.changeset/violet-poems-attend.md new file mode 100644 index 0000000000..cfec36d36d --- /dev/null +++ b/.changeset/violet-poems-attend.md @@ -0,0 +1,6 @@ +--- +'@swisspost/design-system-documentation': minor +'@swisspost/design-system-styles': minor +--- + +Implemented new pixel based sizes. diff --git a/packages/documentation/cypress/snapshots/utilities/sizing.snapshot.ts b/packages/documentation/cypress/snapshots/utilities/sizing.snapshot.ts new file mode 100644 index 0000000000..e539797cc7 --- /dev/null +++ b/packages/documentation/cypress/snapshots/utilities/sizing.snapshot.ts @@ -0,0 +1,22 @@ +describe('Sizing', () => { + // Parent based sizing classes [e.g. .quarter, .third, .half, etc.] + it('Sizing Percentages', () => { + cy.visit('/iframe.html?id=snapshots--percentage-sizing'); + cy.get('.snapshot', { timeout: 30000 }).should('be.visible'); + cy.percySnapshot('Sizing', { widths: [320, 1440] }); + }); + + // Percentage sizing classes relative to viewport [e.g. vh-25, vw-33, min-vh-50, max-vw-100, etc.] + it('Sizing Viewport Percentages', () => { + cy.visit('/iframe.html?id=snapshots--percentage-vp-sizing'); + cy.get('.snapshot', { timeout: 30000 }).should('be.visible'); + cy.percySnapshot('Sizing', { widths: [320, 1440] }); + }); + + // Pixel based sizing classes [e.g. h-80, w-56, max-w-24, min-h-24, etc.] + it('Sizing Pixel Based', () => { + cy.visit('/iframe.html?id=snapshots--pixel-sizing'); + cy.get('.snapshot', { timeout: 30000 }).should('be.visible'); + cy.percySnapshot('Sizing', { widths: [320, 1440] }); + }); +}); diff --git a/packages/documentation/src/stories/components/select-custom/select-custom-basic.sample.html b/packages/documentation/src/stories/components/select-custom/select-custom-basic.sample.html index eb42edb536..0a98a341b4 100644 --- a/packages/documentation/src/stories/components/select-custom/select-custom-basic.sample.html +++ b/packages/documentation/src/stories/components/select-custom/select-custom-basic.sample.html @@ -12,7 +12,7 @@ Default custom-select -
+