diff --git a/src/core/Icon.tsx b/src/core/Icon.tsx index 740a5ae55..a6e4370e8 100644 --- a/src/core/Icon.tsx +++ b/src/core/Icon.tsx @@ -4,7 +4,7 @@ import { IconName } from "./Icon/types"; import { ColorClass } from "./styles/colors/types"; import { convertTailwindClassToVar } from "./styles/colors/utils"; -type IconProps = { +export type IconProps = { name: IconName; size?: string; color?: ColorClass; diff --git a/src/core/Icon/EncapsulatedIcon.tsx b/src/core/Icon/EncapsulatedIcon.tsx new file mode 100644 index 000000000..709ab2177 --- /dev/null +++ b/src/core/Icon/EncapsulatedIcon.tsx @@ -0,0 +1,35 @@ +import React from "react"; +import Icon, { IconProps } from "../Icon"; +import { determineThemeColor } from "../styles/colors/utils"; +import { ColorClass, Theme } from "../styles/colors/types"; + +type EncapsulatedIconProps = { + theme?: Theme; + className?: string; +} & IconProps; + +const EncapsulatedIcon = ({ + theme = "dark", + size = "40px", + className, + ...iconProps +}: EncapsulatedIconProps) => { + const t = (color: ColorClass) => determineThemeColor("dark", theme, color); + const numericalSize = parseInt(size, 10); + + return ( +
+
+ +
+
+ ); +}; + +export default EncapsulatedIcon; diff --git a/src/core/Icon/Icon.stories.tsx b/src/core/Icon/Icon.stories.tsx index 0921487f3..c1f537232 100644 --- a/src/core/Icon/Icon.stories.tsx +++ b/src/core/Icon/Icon.stories.tsx @@ -1,7 +1,9 @@ import React from "react"; import Icon from "../Icon"; +import EncapsulatedIcon from "./EncapsulatedIcon"; import loadIcons from "../icons"; import { IconName, iconNames } from "./types"; +import { Theme } from "../styles/colors/types"; export default { title: "JS Components/Icon", @@ -12,7 +14,11 @@ export default { tags: ["autodocs"], }; -const renderIcons = (iconSet: IconName[]) => { +const renderIcons = ( + iconSet: IconName[], + encapsulated?: boolean, + theme?: Theme, +) => { loadIcons(); return ( @@ -25,12 +31,16 @@ const renderIcons = (iconSet: IconName[]) => { {icon}
- + {encapsulated ? ( + + ) : ( + + )}
@@ -88,3 +98,11 @@ export const IconWithSecondaryColor = { }, }, }; + +export const DarkEncapsulatedIcons = { + render: () => renderIcons([...iconNames.product], true), +}; + +export const LightEncapsulatedIcons = { + render: () => renderIcons([...iconNames.product], true, "light"), +}; diff --git a/src/core/Icon/__snapshots__/Icon.stories.tsx.snap b/src/core/Icon/__snapshots__/Icon.stories.tsx.snap index 84e4effbd..797b5639e 100644 --- a/src/core/Icon/__snapshots__/Icon.stories.tsx.snap +++ b/src/core/Icon/__snapshots__/Icon.stories.tsx.snap @@ -1,5 +1,148 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`JS Components/Icon DarkEncapsulatedIcons smoke-test 1`] = ` +
+
+ + icon-product-asset-tracking + +
+
+
+
+ + + + +
+
+
+
+
+
+ + icon-product-chat + +
+
+
+
+ + + + +
+
+
+
+
+
+ + icon-product-liveobjects + +
+
+
+
+ + + + +
+
+
+
+
+
+ + icon-product-livesync + +
+
+
+
+ + + + +
+
+
+
+
+
+ + icon-product-pubsub + +
+
+
+
+ + + + +
+
+
+
+
+
+ + icon-product-spaces + +
+
+
+
+ + + + +
+
+
+
+
+
+`; + exports[`JS Components/Icon DisplayIcons smoke-test 1`] = `
@@ -1812,128 +1955,181 @@ exports[`JS Components/Icon IconWithSecondaryColor smoke-test 1`] = `
`; -exports[`JS Components/Icon Other smoke-test 1`] = ` +exports[`JS Components/Icon LightEncapsulatedIcons smoke-test 1`] = `
- quote + icon-product-asset-tracking
- - - - +
+ + + + +
+
-
-`; - -exports[`JS Components/Icon ProductIcons smoke-test 1`] = ` -
- icon-product-asset-tracking + icon-product-chat
- - - - +
+ + + + +
+
- icon-product-chat + icon-product-liveobjects
- - - - +
+ + + + +
+
- icon-product-liveobjects + icon-product-livesync
- - - - +
+ + + + +
+
- icon-product-livesync + icon-product-pubsub
- - - - +
+ + + + +
+
- icon-product-pubsub + icon-product-spaces
- - - - +
+ + + + +
+
+ +`; + +exports[`JS Components/Icon Other smoke-test 1`] = ` +
- icon-product-spaces + quote
- +
+
+`; + +exports[`JS Components/Icon ProductIcons smoke-test 1`] = ` +
- icon-product-pubsub-encapsulated + icon-product-asset-tracking
- +
@@ -1941,14 +2137,14 @@ exports[`JS Components/Icon ProductIcons smoke-test 1`] = `
- icon-product-chat-encapsulated + icon-product-chat
- +
@@ -1956,14 +2152,14 @@ exports[`JS Components/Icon ProductIcons smoke-test 1`] = `
- icon-product-spaces-encapsulated + icon-product-liveobjects
- +
@@ -1971,14 +2167,14 @@ exports[`JS Components/Icon ProductIcons smoke-test 1`] = `
- icon-product-livesync-encapsulated + icon-product-livesync
- +
@@ -1986,14 +2182,14 @@ exports[`JS Components/Icon ProductIcons smoke-test 1`] = `
- icon-product-asset-tracking-encapsulated + icon-product-pubsub
- +
@@ -2001,14 +2197,14 @@ exports[`JS Components/Icon ProductIcons smoke-test 1`] = `
- icon-product-liveobjects-encapsulated + icon-product-spaces
- +
diff --git a/src/core/Icon/types.ts b/src/core/Icon/types.ts index aefadceb5..58effbccd 100644 --- a/src/core/Icon/types.ts +++ b/src/core/Icon/types.ts @@ -180,12 +180,6 @@ const productIcons = [ "icon-product-livesync", "icon-product-pubsub", "icon-product-spaces", - "icon-product-pubsub-encapsulated", - "icon-product-chat-encapsulated", - "icon-product-spaces-encapsulated", - "icon-product-livesync-encapsulated", - "icon-product-asset-tracking-encapsulated", - "icon-product-liveobjects-encapsulated", ] as const; export const iconNames = { diff --git a/src/core/ProductTile/__snapshots__/ProductTile.stories.tsx.snap b/src/core/ProductTile/__snapshots__/ProductTile.stories.tsx.snap index 9118fd954..387e61f46 100644 --- a/src/core/ProductTile/__snapshots__/ProductTile.stories.tsx.snap +++ b/src/core/ProductTile/__snapshots__/ProductTile.stories.tsx.snap @@ -2,13 +2,21 @@ exports[`JS Components/Product Tile ProductTileWithOverriddenStylesAndClick smoke-test 1`] = `
-
- +
- - - +
+ + + + +
+

Ably @@ -27,13 +35,21 @@ exports[`JS Components/Product Tile ProductTileWithOverriddenStylesAndClick smok exports[`JS Components/Product Tile ProductTiles smoke-test 1`] = `

-
- +
- - - +
+ + + + +
+

Ably @@ -48,13 +64,21 @@ exports[`JS Components/Product Tile ProductTiles smoke-test 1`] = `

-
- +
- - - +
+ + + + +
+

Ably @@ -69,13 +93,21 @@ exports[`JS Components/Product Tile ProductTiles smoke-test 1`] = `

-
- +
- - - +
+ + + + +
+

Ably @@ -90,13 +122,21 @@ exports[`JS Components/Product Tile ProductTiles smoke-test 1`] = `

-
- +
- - - +
+ + + + +
+

Ably @@ -111,13 +151,21 @@ exports[`JS Components/Product Tile ProductTiles smoke-test 1`] = `

-
- +
- - - +
+ + + + +
+

Ably @@ -132,7 +180,7 @@ exports[`JS Components/Product Tile ProductTiles smoke-test 1`] = `

-
+

Ably @@ -143,7 +191,7 @@ exports[`JS Components/Product Tile ProductTiles smoke-test 1`] = `

-
+
COMING SOON
@@ -156,28 +204,36 @@ exports[`JS Components/Product Tile ProductTiles smoke-test 1`] = ` exports[`JS Components/Product Tile SelectedProductTiles smoke-test 1`] = `
-
-
- +
+
- - - +
+ + + + +
+

Ably

-

+

PubSub

-

+

Low-level APIs to build any realtime experience

View docs @@ -190,13 +246,21 @@ exports[`JS Components/Product Tile SelectedProductTiles smoke-test 1`] = `
-
- +
- - - +
+ + + + +
+

Ably @@ -210,28 +274,36 @@ exports[`JS Components/Product Tile SelectedProductTiles smoke-test 1`] = ` Rapidly build chat features and roll-out at scale

-
-
- +
+
- - - +
+ + + + +
+

Ably

-

+

Spaces

-

+

Create collaborative environments in a few lines of code

Explore @@ -244,13 +316,21 @@ exports[`JS Components/Product Tile SelectedProductTiles smoke-test 1`] = `
-
- +
- - - +
+ + + + +
+

Ably @@ -264,28 +344,36 @@ exports[`JS Components/Product Tile SelectedProductTiles smoke-test 1`] = ` Sync database changes with frontend clients

-
-
- +
+
- - - +
+ + + + +
+

Ably

-

+

Asset Tracking

-

+

Simple APIs to build realtime tracking applications

Explore @@ -298,7 +386,7 @@ exports[`JS Components/Product Tile SelectedProductTiles smoke-test 1`] = `
-
+

Ably @@ -309,7 +397,7 @@ exports[`JS Components/Product Tile SelectedProductTiles smoke-test 1`] = `

-
+
COMING SOON
diff --git a/src/core/icons/icon-product-asset-tracking-encapsulated.svg b/src/core/icons/icon-product-asset-tracking-encapsulated.svg deleted file mode 100644 index cb5c0337a..000000000 --- a/src/core/icons/icon-product-asset-tracking-encapsulated.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/src/core/icons/icon-product-chat-encapsulated.svg b/src/core/icons/icon-product-chat-encapsulated.svg deleted file mode 100644 index 4965f978b..000000000 --- a/src/core/icons/icon-product-chat-encapsulated.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/core/icons/icon-product-livesync-encapsulated.svg b/src/core/icons/icon-product-livesync-encapsulated.svg deleted file mode 100644 index 21e142549..000000000 --- a/src/core/icons/icon-product-livesync-encapsulated.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/src/core/icons/icon-product-pubsub-encapsulated.svg b/src/core/icons/icon-product-pubsub-encapsulated.svg deleted file mode 100644 index bdd4491e6..000000000 --- a/src/core/icons/icon-product-pubsub-encapsulated.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/src/core/icons/icon-product-spaces-encapsulated.svg b/src/core/icons/icon-product-spaces-encapsulated.svg deleted file mode 100644 index 2818dbb6c..000000000 --- a/src/core/icons/icon-product-spaces-encapsulated.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - -