From 18a4427391ffc3a9a5acffd6478f67ab555c3ad6 Mon Sep 17 00:00:00 2001 From: imagoiq <12294151+imagoiq@users.noreply.github.com> Date: Tue, 16 Jan 2024 10:22:06 +0100 Subject: [PATCH 1/2] fix(docs): Clean icon component controls from duplicate and null values --- .../icons/components/icon.stories.ts | 55 ++++++------------- 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/packages/documentation/src/stories/components/icons/components/icon.stories.ts b/packages/documentation/src/stories/components/icons/components/icon.stories.ts index a7861349f4..6f93b965b1 100644 --- a/packages/documentation/src/stories/components/icons/components/icon.stories.ts +++ b/packages/documentation/src/stories/components/icons/components/icon.stories.ts @@ -4,6 +4,7 @@ import { Components } from '@swisspost/design-system-components'; import { html } from 'lit'; import { ifDefined } from 'lit/directives/if-defined.js'; import { BADGE } from '../../../../../.storybook/constants'; +import { spreadArgs } from '../../../../utils'; const meta: Meta = { title: 'Components/Icons/Icon Component', @@ -12,78 +13,54 @@ const meta: Meta = { badges: [BADGE.NEEDS_REVISION, BADGE.SINCE_V1], }, args: { - 'name': '1022', - 'base': '', - 'flip-h': false, - 'flip-v': false, - 'scale': 1, - 'rotate': 0, - 'animation': null, + name: '1022', + base: '', + flipH: false, + flipV: false, + scale: null, + rotate: null, + animation: null, }, argTypes: { - 'name': { + name: { table: { category: 'General', }, }, - 'base': { + base: { table: { category: 'General', }, }, - 'flip-h': { - table: { - category: 'Transformation', - }, - }, - 'flip-v': { - table: { - category: 'Transformation', - }, - }, - 'scale': { + scale: { control: { type: 'number', min: 0.5, max: 3, step: 0.1, }, - table: { - category: 'Transformation', - }, }, - 'rotate': { + rotate: { control: { type: 'number', min: -360, max: 360, step: 1, }, - table: { - category: 'Transformation', - }, }, - 'animation': { + animation: { options: [null, 'cylon', 'cylon-vertical', 'spin', 'spin-reverse', 'fade', 'throb'], - table: { - category: 'Transformation', - }, }, }, render: args => html` - + `, }; function normalizeArgs(args: Args) { - return Object.assign({}, args, { - 'base': args.base || null, - 'scale': args.scale !== 1 ? args.scale : null, - 'rotate': args.rotate !== 0 ? args.rotate : null, - 'flip-h': args['flip-h'] !== false ? args['flip-h'] : null, - 'flip-v': args['flip-v'] !== false ? args['flip-v'] : null, - }); + // remove attribute with falsy values + return Object.fromEntries(Object.entries(args).filter(([_, v]) => v)); } const renderVariants = ( From e8f37c2995481938d91fa615bde0fa601192abc4 Mon Sep 17 00:00:00 2001 From: imagoiq <12294151+imagoiq@users.noreply.github.com> Date: Wed, 17 Jan 2024 15:54:31 +0100 Subject: [PATCH 2/2] Add changeset --- .changeset/blue-bottles-sing.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/blue-bottles-sing.md diff --git a/.changeset/blue-bottles-sing.md b/.changeset/blue-bottles-sing.md new file mode 100644 index 0000000000..e0050f2513 --- /dev/null +++ b/.changeset/blue-bottles-sing.md @@ -0,0 +1,5 @@ +--- +'@swisspost/design-system-documentation': patch +--- + +Cleaned icon component controls from duplicate and null values.