diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx index 40c359bfd..e40889146 100644 --- a/.storybook/preview.tsx +++ b/.storybook/preview.tsx @@ -8,16 +8,6 @@ import theme, { brandImage, brandImageDark } from "./theme"; import loadIcons from "../src/core/icons"; import { Preview } from "@storybook/react"; -const docsContainer = ({ children, context, ...props }) => { - loadIcons(); - - return ( - - {children} - - ); -}; - initialize({ onUnhandledRequest: "bypass", serviceWorker: { @@ -29,6 +19,12 @@ initialize({ }); const preview: Preview = { + decorators: [ + (Story) => { + loadIcons(); + return ; + }, + ], parameters: { controls: { matchers: { @@ -38,12 +34,11 @@ const preview: Preview = { }, docs: { theme, - container: docsContainer, }, options: { storySort: { method: "alphabetical", - order: ["CSS", "JS Components", "Brand"], + order: ["CSS", "Features", "JS Components", "Brand"], }, }, darkMode: { diff --git a/package.json b/package.json index 482d21428..466542078 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ably/ui", - "version": "14.6.0", + "version": "14.6.0-dev.fd4036a", "description": "Home of the Ably design system library ([design.ably.com](https://design.ably.com)). It provides a showcase, development/test environment and a publishing pipeline for different distributables.", "repository": { "type": "git", @@ -27,6 +27,7 @@ "@storybook/test-runner": "^0.19.1", "@swc/cli": "^0.4.0", "@swc/core": "^1.4.11", + "@tailwindcss/container-queries": "^0.1.1", "@types/dompurify": "^3.0.5", "@types/js-cookie": "^3.0.6", "@types/lodash.throttle": "^4.1.9", diff --git a/src/core/FeaturedLink.tsx b/src/core/FeaturedLink.tsx index d6664617d..26e1020db 100644 --- a/src/core/FeaturedLink.tsx +++ b/src/core/FeaturedLink.tsx @@ -39,7 +39,7 @@ const buildTargetAndRel = (url: string, newWindow: boolean) => { const FeaturedLink = ({ url, textSize = "text-p2", - iconColor = "text-cool-black", + iconColor, flush = false, reverse = false, additionalCSS = "", @@ -72,7 +72,7 @@ const FeaturedLink = ({ name="icon-gui-link-arrow" size={`calc(var(--featured-link-icon-size) * 1.25)`} color={iconColor} - additionalCSS="align-middle mr-8 relative -top-1 -right-4 transition-all group-hover:right-0 transform rotate-180" + additionalCSS="align-middle mr-8 relative -top-1 -right-4 transition-[right] group-hover:right-0 transform rotate-180" /> {children} @@ -83,7 +83,7 @@ const FeaturedLink = ({ name="icon-gui-link-arrow" size={`calc(var(--featured-link-icon-size) * 1.25)`} color={iconColor} - additionalCSS="align-middle ml-8 relative -top-1 -left-4 transition-all group-hover:left-0" + additionalCSS="align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover:left-0" /> )} diff --git a/src/core/FeaturedLink/__snapshots__/FeaturedLink.stories.tsx.snap b/src/core/FeaturedLink/__snapshots__/FeaturedLink.stories.tsx.snap index dc23694c2..b09459935 100644 --- a/src/core/FeaturedLink/__snapshots__/FeaturedLink.stories.tsx.snap +++ b/src/core/FeaturedLink/__snapshots__/FeaturedLink.stories.tsx.snap @@ -6,7 +6,7 @@ exports[`JS Components/Featured Link Default smoke-test 1`] = ` style="--featured-link-icon-size: var(--fs-p2);" > Featured link - @@ -21,7 +21,7 @@ exports[`JS Components/Featured Link Large smoke-test 1`] = ` style="--featured-link-icon-size: var(--fs-p1);" > Featured link - @@ -36,7 +36,7 @@ exports[`JS Components/Featured Link Pink smoke-test 1`] = ` style="--featured-link-icon-size: var(--fs-p2);" > Featured link - @@ -50,7 +50,7 @@ exports[`JS Components/Featured Link Reverse smoke-test 1`] = ` class="font-sans font-bold block text-gui-default hover:text-gui-hover focus:text-gui-focus focus:outline-gui-focus group ui-text-p2 py-8 " style="--featured-link-icon-size: var(--fs-p2);" > - @@ -66,7 +66,7 @@ exports[`JS Components/Featured Link Small smoke-test 1`] = ` style="--featured-link-icon-size: var(--fs-p3);" > Featured link - diff --git a/src/core/Icon.tsx b/src/core/Icon.tsx index c97ec61c3..740a5ae55 100644 --- a/src/core/Icon.tsx +++ b/src/core/Icon.tsx @@ -2,6 +2,7 @@ import React, { CSSProperties } from "react"; import { defaultIconSecondaryColor } from "./Icon/secondary-colors"; import { IconName } from "./Icon/types"; import { ColorClass } from "./styles/colors/types"; +import { convertTailwindClassToVar } from "./styles/colors/utils"; type IconProps = { name: IconName; @@ -11,9 +12,6 @@ type IconProps = { additionalCSS?: string; }; -const convertTailwindClassToVar = (className: string) => - className.replace(/(text|bg)-([a-z0-9-]+)/gi, "var(--color-$2)"); - const Icon = ({ name, size = "0.75rem", diff --git a/src/core/Meganav/__snapshots__/Meganav.stories.tsx.snap b/src/core/Meganav/__snapshots__/Meganav.stories.tsx.snap index d22e2eba0..e513d1c92 100644 --- a/src/core/Meganav/__snapshots__/Meganav.stories.tsx.snap +++ b/src/core/Meganav/__snapshots__/Meganav.stories.tsx.snap @@ -69,7 +69,7 @@ exports[`JS Components/Meganav Default smoke-test 1`] = ` style="--featured-link-icon-size: var(--fs-p2);" > Explore how it works - @@ -211,7 +211,7 @@ exports[`JS Components/Meganav Default smoke-test 1`] = ` style="--featured-link-icon-size: var(--fs-p3);" > Explore Four Pillars of Dependability - @@ -762,7 +762,7 @@ exports[`JS Components/Meganav Default smoke-test 1`] = ` style="--featured-link-icon-size: var(--fs-p3);" > More from our Blog - @@ -1174,7 +1174,7 @@ exports[`JS Components/Meganav Default smoke-test 1`] = ` style="--featured-link-icon-size: var(--fs-p2);" > Support - @@ -1375,7 +1375,7 @@ exports[`JS Components/Meganav Default smoke-test 1`] = ` style="--featured-link-icon-size: var(--fs-p2);" > Explore how it works - @@ -1517,7 +1517,7 @@ exports[`JS Components/Meganav Default smoke-test 1`] = ` style="--featured-link-icon-size: var(--fs-p3);" > Explore Four Pillars of Dependability - @@ -2093,7 +2093,7 @@ exports[`JS Components/Meganav Default smoke-test 1`] = ` style="--featured-link-icon-size: var(--fs-p3);" > More from our Blog - diff --git a/src/core/Pricing/PricingCards.stories.tsx b/src/core/Pricing/PricingCards.stories.tsx new file mode 100644 index 000000000..51a5b3202 --- /dev/null +++ b/src/core/Pricing/PricingCards.stories.tsx @@ -0,0 +1,41 @@ +import React from "react"; +import PricingCards, { PricingCardsProps } from "./PricingCards"; +import { consumptionData, planData } from "./data"; + +export default { + title: "Features/Pricing Cards", + component: PricingCards, + tags: ["autodocs"], + parameters: { + docs: { + description: { + component: + "A reusable component that forms the basis of two sections of the pricing page. It is used to display pricing plans and consumption pricing. The presence of a `delimiter` prop changes the UX to focus around intermediate icon columns.", + }, + }, + }, +}; + +const Template = ({ data, theme = "dark", delimiter }: PricingCardsProps) => ( +
+ +
+); + +export const PlansDarkMode = { + render: () =>