Skip to content

Commit

Permalink
Merge pull request #486 from ably/14.6.0-pricing-stuff
Browse files Browse the repository at this point in the history
[WEB-3841] 14.6.0 - PricingCards component
  • Loading branch information
jamiehenson authored Sep 19, 2024
2 parents e6bea89 + 024830b commit b1bb438
Show file tree
Hide file tree
Showing 17 changed files with 2,144 additions and 46 deletions.
19 changes: 7 additions & 12 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<DocsContainer context={context} {...props}>
{children}
</DocsContainer>
);
};

initialize({
onUnhandledRequest: "bypass",
serviceWorker: {
Expand All @@ -29,6 +19,12 @@ initialize({
});

const preview: Preview = {
decorators: [
(Story) => {
loadIcons();
return <Story />;
},
],
parameters: {
controls: {
matchers: {
Expand All @@ -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: {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions src/core/FeaturedLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "",
Expand Down Expand Up @@ -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}
</>
Expand All @@ -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"
/>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`JS Components/Featured Link Default smoke-test 1`] = `
style="--featured-link-icon-size: var(--fs-p2);"
>
Featured link
<svg class="text-cool-black align-middle ml-8 relative -top-1 -left-4 transition-all group-hover:left-0"
<svg class=" align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover:left-0"
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand All @@ -21,7 +21,7 @@ exports[`JS Components/Featured Link Large smoke-test 1`] = `
style="--featured-link-icon-size: var(--fs-p1);"
>
Featured link
<svg class="text-cool-black align-middle ml-8 relative -top-1 -left-4 transition-all group-hover:left-0"
<svg class=" align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover:left-0"
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand All @@ -36,7 +36,7 @@ exports[`JS Components/Featured Link Pink smoke-test 1`] = `
style="--featured-link-icon-size: var(--fs-p2);"
>
Featured link
<svg class="text-pink-500 align-middle ml-8 relative -top-1 -left-4 transition-all group-hover:left-0"
<svg class="text-pink-500 align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover:left-0"
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand All @@ -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);"
>
<svg class="text-cool-black align-middle mr-8 relative -top-1 -right-4 transition-all group-hover:right-0 transform rotate-180"
<svg class=" align-middle mr-8 relative -top-1 -right-4 transition-[right] group-hover:right-0 transform rotate-180"
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand All @@ -66,7 +66,7 @@ exports[`JS Components/Featured Link Small smoke-test 1`] = `
style="--featured-link-icon-size: var(--fs-p3);"
>
Featured link
<svg class="text-cool-black align-middle ml-8 relative -top-1 -left-4 transition-all group-hover:left-0"
<svg class=" align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover:left-0"
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand Down
4 changes: 1 addition & 3 deletions src/core/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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",
Expand Down
14 changes: 7 additions & 7 deletions src/core/Meganav/__snapshots__/Meganav.stories.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ exports[`JS Components/Meganav Default smoke-test 1`] = `
style="--featured-link-icon-size: var(--fs-p2);"
>
Explore how it works
<svg class="text-cool-black align-middle ml-8 relative -top-1 -left-4 transition-all group-hover:left-0"
<svg class=" align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover:left-0"
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand Down Expand Up @@ -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
<svg class="text-cool-black align-middle ml-8 relative -top-1 -left-4 transition-all group-hover:left-0"
<svg class=" align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover:left-0"
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand Down Expand Up @@ -762,7 +762,7 @@ exports[`JS Components/Meganav Default smoke-test 1`] = `
style="--featured-link-icon-size: var(--fs-p3);"
>
More from our Blog
<svg class="text-cool-black align-middle ml-8 relative -top-1 -left-4 transition-all group-hover:left-0"
<svg class=" align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover:left-0"
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand Down Expand Up @@ -1174,7 +1174,7 @@ exports[`JS Components/Meganav Default smoke-test 1`] = `
style="--featured-link-icon-size: var(--fs-p2);"
>
Support
<svg class="text-cool-black align-middle ml-8 relative -top-1 -left-4 transition-all group-hover:left-0"
<svg class=" align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover:left-0"
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand Down Expand Up @@ -1375,7 +1375,7 @@ exports[`JS Components/Meganav Default smoke-test 1`] = `
style="--featured-link-icon-size: var(--fs-p2);"
>
Explore how it works
<svg class="text-cool-black align-middle ml-8 relative -top-1 -left-4 transition-all group-hover:left-0"
<svg class=" align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover:left-0"
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand Down Expand Up @@ -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
<svg class="text-cool-black align-middle ml-8 relative -top-1 -left-4 transition-all group-hover:left-0"
<svg class=" align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover:left-0"
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand Down Expand Up @@ -2093,7 +2093,7 @@ exports[`JS Components/Meganav Default smoke-test 1`] = `
style="--featured-link-icon-size: var(--fs-p3);"
>
More from our Blog
<svg class="text-cool-black align-middle ml-8 relative -top-1 -left-4 transition-all group-hover:left-0"
<svg class=" align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover:left-0"
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand Down
41 changes: 41 additions & 0 deletions src/core/Pricing/PricingCards.stories.tsx
Original file line number Diff line number Diff line change
@@ -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) => (
<div className={`${theme === "dark" ? "bg-neutral-1300" : ""} p-32`}>
<PricingCards data={data} theme={theme} delimiter={delimiter} />
</div>
);

export const PlansDarkMode = {
render: () => <Template data={planData} />,
};

export const PlansLightMode = {
render: () => <Template data={planData} theme="light" />,
};

export const ConsumptionDarkMode = {
render: () => <Template data={consumptionData} delimiter="icon-gui-plus" />,
};

export const ConsumptionLightMode = {
render: () => (
<Template data={consumptionData} theme="light" delimiter="icon-gui-plus" />
),
};
Loading

0 comments on commit b1bb438

Please sign in to comment.