From f86da147ff846a896a906971d3f71ac6d4167fbd Mon Sep 17 00:00:00 2001 From: Jamie Henson Date: Thu, 19 Sep 2024 12:43:55 +0100 Subject: [PATCH] chore: add theming to ProductTile --- src/core/ProductTile.tsx | 27 ++++---- .../ProductTile.stories.tsx.snap | 66 +++++++++---------- src/core/ProductTile/data.ts | 10 +-- 3 files changed, 54 insertions(+), 49 deletions(-) diff --git a/src/core/ProductTile.tsx b/src/core/ProductTile.tsx index e0653de03..2c3fb134f 100644 --- a/src/core/ProductTile.tsx +++ b/src/core/ProductTile.tsx @@ -1,7 +1,9 @@ import React from "react"; -import Icon from "./Icon"; +import EncapsulatedIcon from "./Icon/EncapsulatedIcon"; import FeaturedLink from "./FeaturedLink"; import { ProductName, products } from "./ProductTile/data"; +import { ColorClass } from "./styles/colors/types"; +import { determineThemeColor } from "./styles/colors/utils"; type ProductTileProps = { name: ProductName; @@ -20,23 +22,28 @@ const ProductTile = ({ }: ProductTileProps) => { const { icon, label, description, link, unavailable } = products[name] ?? {}; + const t = (color: ColorClass) => + determineThemeColor("dark", selected ? "light" : "dark", color); + return (
-
- {icon ? : null} +
+ {icon ? ( + + ) : null}

Ably{" "}

{label}

@@ -44,21 +51,19 @@ const ProductTile = ({
{unavailable ? (
-
+
COMING SOON
) : null}

{description}

{selected && link ? ( diff --git a/src/core/ProductTile/__snapshots__/ProductTile.stories.tsx.snap b/src/core/ProductTile/__snapshots__/ProductTile.stories.tsx.snap index 24770ab7a..9118fd954 100644 --- a/src/core/ProductTile/__snapshots__/ProductTile.stories.tsx.snap +++ b/src/core/ProductTile/__snapshots__/ProductTile.stories.tsx.snap @@ -10,15 +10,15 @@ exports[`JS Components/Product Tile ProductTileWithOverriddenStylesAndClick smok
-

+

Ably

-

+

PubSub

-

+

Low-level APIs to build any realtime experience

@@ -35,15 +35,15 @@ exports[`JS Components/Product Tile ProductTiles smoke-test 1`] = `
-

+

Ably

-

+

PubSub

-

+

Low-level APIs to build any realtime experience

@@ -56,15 +56,15 @@ exports[`JS Components/Product Tile ProductTiles smoke-test 1`] = `
-

+

Ably

-

+

Chat

-

+

Rapidly build chat features and roll-out at scale

@@ -77,15 +77,15 @@ exports[`JS Components/Product Tile ProductTiles smoke-test 1`] = `
-

+

Ably

-

+

Spaces

-

+

Create collaborative environments in a few lines of code

@@ -98,15 +98,15 @@ exports[`JS Components/Product Tile ProductTiles smoke-test 1`] = `
-

+

Ably

-

+

LiveSync

-

+

Sync database changes with frontend clients

@@ -119,25 +119,25 @@ exports[`JS Components/Product Tile ProductTiles smoke-test 1`] = `
-

+

Ably

-

+

Asset Tracking

-

+

Simple APIs to build realtime tracking applications

-

+

Ably

-

+

LiveObjects

@@ -147,7 +147,7 @@ exports[`JS Components/Product Tile ProductTiles smoke-test 1`] = ` COMING SOON
-

+

Sync application state across multiple devices

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

+

Ably

@@ -198,15 +198,15 @@ exports[`JS Components/Product Tile SelectedProductTiles smoke-test 1`] = `

-

+

Ably

-

+

Chat

-

+

Rapidly build chat features and roll-out at scale

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

+

Ably

@@ -252,15 +252,15 @@ exports[`JS Components/Product Tile SelectedProductTiles smoke-test 1`] = `

-

+

Ably

-

+

LiveSync

-

+

Sync database changes with frontend clients

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

+

Ably

@@ -300,10 +300,10 @@ exports[`JS Components/Product Tile SelectedProductTiles smoke-test 1`] = `

-

+

Ably

-

+

LiveObjects

@@ -313,7 +313,7 @@ exports[`JS Components/Product Tile SelectedProductTiles smoke-test 1`] = ` COMING SOON
-

+

Sync application state across multiple devices

diff --git a/src/core/ProductTile/data.ts b/src/core/ProductTile/data.ts index 185aa8cb9..6b75c00a2 100644 --- a/src/core/ProductTile/data.ts +++ b/src/core/ProductTile/data.ts @@ -23,31 +23,31 @@ export const products: Products = { pubsub: { label: "PubSub", description: "Low-level APIs to build any realtime experience", - icon: "icon-product-pubsub-encapsulated", + icon: "icon-product-pubsub", link: "/docs/products/channels", }, chat: { label: "Chat", description: "Rapidly build chat features and roll-out at scale", - icon: "icon-product-chat-encapsulated", + icon: "icon-product-chat", link: "/docs/products/chat", }, spaces: { label: "Spaces", description: "Create collaborative environments in a few lines of code", - icon: "icon-product-spaces-encapsulated", + icon: "icon-product-spaces", link: "/docs/products/spaces", }, liveSync: { label: "LiveSync", description: "Sync database changes with frontend clients", - icon: "icon-product-livesync-encapsulated", + icon: "icon-product-livesync", link: "/docs/products/livesync", }, assetTracking: { label: "Asset Tracking", description: "Simple APIs to build realtime tracking applications", - icon: "icon-product-asset-tracking-encapsulated", + icon: "icon-product-asset-tracking", link: "/docs/products/asset-tracking", }, liveObjects: {