From 6fb442a006f1061616bffb4698e9ebada45021ad Mon Sep 17 00:00:00 2001 From: Alex Page Date: Thu, 30 Nov 2023 12:43:41 +1100 Subject: [PATCH 1/4] Add story for every Polaris Icon This will help us test and debug icon changes with visual regressions --- .../src/components/Icon/Icon.stories.tsx | 57 ++++++++++++------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/polaris-react/src/components/Icon/Icon.stories.tsx b/polaris-react/src/components/Icon/Icon.stories.tsx index c9950b50728..ee6c3ba5fb5 100644 --- a/polaris-react/src/components/Icon/Icon.stories.tsx +++ b/polaris-react/src/components/Icon/Icon.stories.tsx @@ -1,14 +1,15 @@ import React from 'react'; import type {ComponentMeta} from '@storybook/react'; -import {Icon, Text, BlockStack} from '@shopify/polaris'; -import {CirclePlusMinor} from '@shopify/polaris-icons'; +import {Icon, Text, BlockStack, InlineStack} from '@shopify/polaris'; +import * as polarisIcons from '@shopify/polaris-icons'; +import iconMetadata from '@shopify/polaris-icons/metadata'; export default { component: Icon, } as ComponentMeta; export function Default() { - return ; + return ; } export function Colored() { @@ -17,71 +18,74 @@ export function Colored() { Base tone - + Subdued tone - + Primary tone - + Info tone - + Success tone - + Caution tone - + Warning tone - + Critical tone - + Emphasis tone - + Magic tone - + Text Primary tone - + Text Caution tone - + Text Warning tone - + Text Critical tone - + Text Info tone - + Text Success tone - + Text Magic tone - + ); } @@ -115,3 +119,16 @@ export function WithCustomSVGAndColor() { return ; } + +export function PolarisIconsLibrary() { + return ( + + {Object.keys(iconMetadata).map((icon) => ( + + + {icon} + + ))} + + ); +} From c044ea5e11b1c25e49ba6c474ef69356087cd624 Mon Sep 17 00:00:00 2001 From: Alex Page Date: Thu, 30 Nov 2023 12:44:51 +1100 Subject: [PATCH 2/4] Create twenty-maps-applaud.md --- .changeset/twenty-maps-applaud.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/twenty-maps-applaud.md diff --git a/.changeset/twenty-maps-applaud.md b/.changeset/twenty-maps-applaud.md new file mode 100644 index 00000000000..04a871f3587 --- /dev/null +++ b/.changeset/twenty-maps-applaud.md @@ -0,0 +1,5 @@ +--- +'@shopify/polaris': minor +--- + +Add storybook example for all icons in @shopify/polaris-icons From 554d449f82f35284afa3113d417d49b71ab08d97 Mon Sep 17 00:00:00 2001 From: Alex Page Date: Fri, 1 Dec 2023 14:41:59 +1100 Subject: [PATCH 3/4] Update Icon.stories.tsx --- polaris-react/src/components/Icon/Icon.stories.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polaris-react/src/components/Icon/Icon.stories.tsx b/polaris-react/src/components/Icon/Icon.stories.tsx index ee6c3ba5fb5..23918abb186 100644 --- a/polaris-react/src/components/Icon/Icon.stories.tsx +++ b/polaris-react/src/components/Icon/Icon.stories.tsx @@ -122,7 +122,7 @@ export function WithCustomSVGAndColor() { export function PolarisIconsLibrary() { return ( - + {Object.keys(iconMetadata).map((icon) => ( From 7d6738c6597b808841fa7dce421ac74acc000ed7 Mon Sep 17 00:00:00 2001 From: Alex Page Date: Fri, 1 Dec 2023 14:44:04 +1100 Subject: [PATCH 4/4] Remove type casting --- .../src/components/Icon/Icon.stories.tsx | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/polaris-react/src/components/Icon/Icon.stories.tsx b/polaris-react/src/components/Icon/Icon.stories.tsx index 23918abb186..75c8f3b5212 100644 --- a/polaris-react/src/components/Icon/Icon.stories.tsx +++ b/polaris-react/src/components/Icon/Icon.stories.tsx @@ -8,8 +8,13 @@ export default { component: Icon, } as ComponentMeta; +interface Icons { + [key: string]: any; +} +const icons: Icons = polarisIcons; + export function Default() { - return ; + return ; } export function Colored() { @@ -18,74 +23,71 @@ export function Colored() { Base tone - + Subdued tone - + Primary tone - + Info tone - + Success tone - + Caution tone - + Warning tone - + Critical tone - + Emphasis tone - + Magic tone - + Text Primary tone - + Text Caution tone - + Text Warning tone - + Text Critical tone - + Text Info tone - + Text Success tone - + Text Magic tone - + ); }