From 9e88b6eb1503c7a0d756590f28a2f0ad6199fef7 Mon Sep 17 00:00:00 2001 From: Christian Vuerings Date: Mon, 18 Mar 2024 07:43:44 -0700 Subject: [PATCH 1/2] Button/IconButton/LinkButton: add 'on' lightBackground or darkBackground prop --- packages/syntax-core/package.json | 2 +- .../syntax-core/src/Button/Button.stories.tsx | 32 +++++++++ packages/syntax-core/src/Button/Button.tsx | 13 +++- .../src/IconButton/IconButton.module.css | 7 -- .../src/IconButton/IconButton.stories.tsx | 26 +++++++ .../syntax-core/src/IconButton/IconButton.tsx | 12 +++- .../src/LinkButton/LinkButton.stories.tsx | 30 +++++++- .../syntax-core/src/LinkButton/LinkButton.tsx | 11 ++- .../syntax-core/src/colors/backgroundColor.ts | 68 +++++++++++++------ .../syntax-core/src/colors/foregroundColor.ts | 47 +++++++++---- 10 files changed, 195 insertions(+), 53 deletions(-) diff --git a/packages/syntax-core/package.json b/packages/syntax-core/package.json index c9bff360..386b4655 100644 --- a/packages/syntax-core/package.json +++ b/packages/syntax-core/package.json @@ -14,7 +14,7 @@ "scripts": { "build": "tsup", "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist", - "dev": "NODE_OPTIONS=--max_old_space_size=4096 tsup --watch", + "dev": "NODE_OPTIONS=--max_old_space_size=8192 tsup --watch", "lint": "TIMING=1 eslint \"src/**/*.ts*\" --max-warnings 0", "stylelint": "stylelint \"**/*.css\"", "stylelint:fix": "npm run stylelint --fix", diff --git a/packages/syntax-core/src/Button/Button.stories.tsx b/packages/syntax-core/src/Button/Button.stories.tsx index aa75c506..6b100952 100644 --- a/packages/syntax-core/src/Button/Button.stories.tsx +++ b/packages/syntax-core/src/Button/Button.stories.tsx @@ -1,6 +1,7 @@ import { type StoryObj, type Meta } from "@storybook/react"; import Button from "./Button"; import FavoriteBorder from "@mui/icons-material/FavoriteBorder"; +import Box from "../Box/Box"; export default { title: "Components/Button", @@ -11,6 +12,20 @@ export default { url: "https://www.figma.com/file/p7LKna9JMU0JEkcKamzs53/Cambly-Design-System-(Draft)?node-id=994%3A2346", }, }, + args: { + text: "Call to action", + color: "primary", + on: "lightBackground", + size: "md", + disabled: false, + loading: false, + fullWidth: false, + "data-testid": "", + loadingText: "", + accessibilityLabel: "", + tooltip: "", + type: "button", + }, argTypes: { color: { options: [ @@ -29,6 +44,10 @@ export default { ], control: { type: "radio" }, }, + on: { + options: ["lightBackground", "darkBackground"], + control: { type: "radio" }, + }, size: { options: ["sm", "md", "lg"], control: { type: "radio" }, @@ -43,12 +62,25 @@ export default { control: "boolean", }, onClick: { action: "clicked" }, + type: { + options: ["button", "submit", "reset"], + }, }, tags: ["autodocs"], } as Meta; export const Default: StoryObj = { args: { text: "Call to action" }, + render: (args) => { + return ( + +