Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🥧[WEB-4164] - Adding Pricing Card CTA Arrow Icon #582

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ably/ui",
"version": "15.1.10",
"version": "15.1.11",
"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 Down
14 changes: 10 additions & 4 deletions src/core/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { PropsWithChildren } from "react";
import { IconName } from "./Icon/types";
import Icon from "./Icon";
import cn from "./utils/cn";
import { ColorClass, ColorThemeSet } from "./styles/colors/types";

export type ButtonType = "priority" | "primary" | "secondary";

Expand All @@ -28,6 +29,10 @@ export type ButtonPropsBase = {
* Optional classes to add to the button element.
*/
className?: string;
/**
* Optional color to apply to the icon on either left and/or right side of the button.
*/
iconColor?: ColorClass | ColorThemeSet;
};

type ButtonProps = ButtonPropsBase &
Expand Down Expand Up @@ -81,12 +86,12 @@ export const commonButtonProps = (props: ButtonPropsBase) => {
export const commonButtonInterior = (
props: PropsWithChildren<ButtonPropsBase>,
) => {
const { leftIcon, rightIcon, children } = props;
const { leftIcon, rightIcon, iconColor, children } = props;
return (
<>
{leftIcon ? <Icon name={leftIcon} /> : null}
{leftIcon ? <Icon name={leftIcon} additionalCSS={iconColor} /> : null}
{children}
{rightIcon ? <Icon name={rightIcon} /> : null}
{rightIcon ? <Icon name={rightIcon} additionalCSS={iconColor} /> : null}
</>
);
};
Expand All @@ -98,14 +103,15 @@ const Button: React.FC<PropsWithChildren<ButtonProps>> = ({
rightIcon,
children,
className,
iconColor,
...rest
}) => {
return (
<button
{...commonButtonProps({ variant, size, leftIcon, rightIcon, className })}
{...(rest as React.ButtonHTMLAttributes<HTMLButtonElement>)}
>
{commonButtonInterior({ leftIcon, rightIcon, children })}
{commonButtonInterior({ leftIcon, rightIcon, iconColor, children })}
</button>
);
};
Expand Down
5 changes: 4 additions & 1 deletion src/core/LinkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import {
commonButtonProps,
} from "./Button";
import cn from "./utils/cn";
import { ColorClass, ColorThemeSet } from "./styles/colors/types";

export type LinkButtonProps = ButtonPropsBase & {
disabled?: boolean;
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
iconColor?: ColorClass | ColorThemeSet;
} & React.AnchorHTMLAttributes<HTMLAnchorElement>;

const LinkButton: React.FC<LinkButtonProps> = ({
Expand All @@ -20,6 +22,7 @@ const LinkButton: React.FC<LinkButtonProps> = ({
className,
disabled,
onClick,
iconColor,
...rest
}) => {
const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
Expand All @@ -46,7 +49,7 @@ const LinkButton: React.FC<LinkButtonProps> = ({
onClick={handleClick}
{...(rest as React.AnchorHTMLAttributes<HTMLAnchorElement>)}
>
{commonButtonInterior({ leftIcon, rightIcon, children })}
{commonButtonInterior({ leftIcon, rightIcon, iconColor, children })}
</a>
);
};
Expand Down
2 changes: 2 additions & 0 deletions src/core/Pricing/PricingCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ const PricingCards = ({ data, delimiter }: PricingCardsProps) => {
href={cta.url}
onClick={cta.onClick}
disabled={cta.disabled}
rightIcon="icon-gui-arrow-right"
iconColor={cta.iconColor}
>
{cta.text}
</LinkButton>
Expand Down
13 changes: 11 additions & 2 deletions src/core/Pricing/data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ export const planData: PricingDataFeature[] = [
color: "text-neutral-800 dark:text-neutral-500",
},
price: { amount: "$0" },
cta: { text: "Start for free", url: "/sign-up" },
cta: {
text: "Start for free",
url: "/sign-up",
iconColor: "text-neutral-700 dark:text-neutral-600",
},
sections: [
{
title: "Limits",
Expand Down Expand Up @@ -69,6 +73,7 @@ export const planData: PricingDataFeature[] = [
cta: {
text: "Get started",
url: "/users/paid_sign_up?package=standard",
iconColor: "text-blue-600 dark:text-blue-400",
},
sections: [
{
Expand Down Expand Up @@ -120,7 +125,11 @@ export const planData: PricingDataFeature[] = [
</>
),
},
cta: { text: "Get started", url: "/users/paid_sign_up?package=pro" },
cta: {
text: "Get started",
url: "/users/paid_sign_up?package=pro",
iconColor: "text-blue-600 dark:text-blue-400",
},
sections: [
{
title: "Limits",
Expand Down
1 change: 1 addition & 0 deletions src/core/Pricing/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type PricingDataFeatureCta = {
className?: string;
disabled?: boolean;
onClick?: () => void;
iconColor?: ColorClass | ColorThemeSet;
};

export type PricingDataFeatureSection = {
Expand Down
Loading