From 0c9cdce442434395547d104cc6ff8564a5747ffb Mon Sep 17 00:00:00 2001 From: Masoud Amjadi Date: Sat, 15 Feb 2025 00:41:25 -0500 Subject: [PATCH] fix(navigationheader): fixed inverted styles in sub components Buttons and InputSearch --- .storybook/preview.js | 153 +++++++++++++++++- .../__snapshots__/index.test.tsx.snap | 62 +++---- .../__snapshots__/banner.test.tsx.snap | 7 +- .../__snapshots__/index.test.tsx.snap | 5 +- packages/components/src/core/Button/index.tsx | 64 +++----- .../__snapshots__/index.test.tsx.snap | 9 +- .../__snapshots__/index.test.tsx.snap | 11 +- .../__snapshots__/index.test.tsx.snap | 83 +++++++--- .../__snapshots__/index.test.tsx.snap | 22 ++- .../__snapshots__/index.test.tsx.snap | 9 +- .../__snapshots__/index.test.tsx.snap | 2 +- .../components/src/core/InputSearch/index.tsx | 16 +- .../__snapshots__/index.test.tsx.snap | 14 +- .../src/core/NavigationHeader/index.tsx | 31 ++-- .../src/core/NavigationHeader/style.ts | 72 +++++++++ .../__snapshots__/index.test.tsx.snap | 7 +- .../__snapshots__/index.test.tsx.snap | 9 +- .../__snapshots__/index.test.tsx.snap | 7 +- 18 files changed, 424 insertions(+), 159 deletions(-) diff --git a/.storybook/preview.js b/.storybook/preview.js index 01fde1826..cee20836f 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -1,14 +1,163 @@ import CssBaseline from "@mui/material/CssBaseline"; -import { Theme } from "../packages/components/src/core/styles"; -import { ThemeProvider } from "@mui/material/styles"; +import { + makeThemeOptions, + Theme, +} from "../packages/components/src/core/styles"; +import { createTheme, ThemeProvider } from "@mui/material/styles"; import { BADGE } from "../packages/components/src/common/storybook/storybookBadges"; +import { makeSdsSemanticAppTheme } from "@czi-sds/components"; export const decorators = [ (Story, context) => { const { theme: storybookTheme } = context.globals; + // Temporary + + const LightColors = { + blue: { + 100: "#f23", + 200: "#f23", + 300: "#f23", + 400: "#f23", + 500: "#f23", + 600: "#f23", + 700: "#f23", + 800: "#f23", + }, + gray: { + 100: "#f3f3f3", + 200: "#dfdfdf", + 300: "#c3c3c3", + 400: "#a5a5a5", + 50: "#ffffff", + 500: "#969696", + 600: "#6c6c6c", + 700: "#3b3b3b", + 75: "#fafafa", + 800: "#1b1b1b", + 900: "#000000", + }, + green: { + 100: "#daf4de", + 200: "#b9ecc3", + 300: "#7fd693", + 400: "#50b96d", + 500: "#238444", + 600: "#105b2b", + 700: "#07431d", + 800: "#001f00", + }, + purple: { + 100: "#efeafe", + 200: "#e4dbfc", + 300: "#cbbaF8", + 400: "#b296f2", + 500: "#8b54e2", + 600: "#6526b5", + 700: "#490092", + 800: "#26004c", + }, + red: { + 100: "#ffe8e6", + 200: "#ffd6d2", + 300: "#ffafa8", + 400: "#ff7e78", + 500: "#db2131", + 600: "#980017", + 700: "#6f0008", + 800: "#340000", + }, + yellow: { + 100: "#fff3db", + 200: "#ffdb97", + 300: "#ffca5c", + 400: "#fab700", + 500: "#da9900", + 600: "#b07300", + 700: "#7c3e00", + 800: "#541700", + }, + }; + + const DarkColors = { + blue: { + 100: "#f85", + 200: "#f85", + 300: "#f85", + 400: "#f85", + 500: "#f85", + 600: "#f85", + 700: "#f85", + 800: "#f85", + }, + gray: { + 100: "#333333", + 200: "#494949", + 300: "#696969", + 400: "#9b9b9b", + 50: "#000000", + 500: "#aaaaaa", + 600: "#cdcdcd", + 700: "#ededed", + 75: "#101010", + 800: "#fafafa", + 900: "#ffffff", + }, + green: { + 100: "#082608", + 200: "#063617", + 300: "#10632e", + 400: "#278b48", + 500: "#4bae68", + 600: "#85d898", + 700: "#bcecc5", + 800: "#daf4de", + }, + purple: { + 100: "#331252", + 200: "#410f70", + 300: "#6429b2", + 400: "#905de6", + 500: "#aa89ef", + 600: "#cebef8", + 700: "#e4dcfc", + 800: "#f0ebfe", + }, + red: { + 100: "#330603", + 200: "#660a12", + 300: "#9e1c1c", + 400: "#c73028", + 500: "#e05043", + 600: "#ff988a", + 700: "#ffbdb3", + 800: "#ffd8d1", + }, + yellow: { + 100: "#361b07", + 200: "#52270a", + 300: "#965a0b", + 400: "#bd8804", + 500: "#d9a943", + 600: "#e5bc63", + 700: "#f5d789", + 800: "#ffe6a8", + }, + }; + + const semanticAppTheme = makeSdsSemanticAppTheme( + storybookTheme === "light" ? LightColors : DarkColors + ); + const themeOptions = makeThemeOptions(semanticAppTheme, storybookTheme); + const theme = createTheme(themeOptions, { + cssVariables: true, + }); + + // Temporary + return ( + {/* */} {/* CssBaseline provides light/dark background MUI theme for all stories */} diff --git a/packages/components/src/core/Autocomplete/__tests__/__snapshots__/index.test.tsx.snap b/packages/components/src/core/Autocomplete/__tests__/__snapshots__/index.test.tsx.snap index 5f88cc1c9..177bce31e 100644 --- a/packages/components/src/core/Autocomplete/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/components/src/core/Autocomplete/__tests__/__snapshots__/index.test.tsx.snap @@ -6,16 +6,16 @@ exports[` ControlledOpen story renders snapshot 1`] = ` >
ControlledOpen story renders snapshot 1`] = `
+
ControlledOpen story renders snapshot 1`] = ` class="MuiInputAdornment-root MuiInputAdornment-positionEnd MuiInputAdornment-outlined MuiInputAdornment-sizeSmall css-1is7ehy-MuiInputAdornment-root" >

ControlledOpen story renders snapshot 1`] = ` class="css-tiqrog" >
`; @@ -98,7 +110,7 @@ exports[` Dialog all sizes match the snapshots 4`] = ` >

Dialog all sizes match the snapshots 6`] = ` data-testid="dialog-actions" > `; @@ -176,7 +197,7 @@ exports[`

Dialog all sizes match the snapshots 7`] = ` >

Dialog all sizes match the snapshots 9`] = ` data-testid="dialog-actions" > `; @@ -254,7 +284,7 @@ exports[`

Dialog all sizes match the snapshots 10`] = ` >

Dialog all sizes match the snapshots 12`] = ` data-testid="dialog-actions" > `; @@ -330,18 +369,24 @@ exports[`

renders Dialog left positioned buttons 1`] = ` data-testid="dialog-actions" > `; diff --git a/packages/components/src/core/Dropdown/__tests__/__snapshots__/index.test.tsx.snap b/packages/components/src/core/Dropdown/__tests__/__snapshots__/index.test.tsx.snap index d1034b1fc..1f31fa2c6 100644 --- a/packages/components/src/core/Dropdown/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/components/src/core/Dropdown/__tests__/__snapshots__/index.test.tsx.snap @@ -3,7 +3,7 @@ exports[` Default story renders snapshot 1`] = ` `; @@ -45,7 +48,7 @@ exports[` Default story renders snapshot 1`] = ` exports[` MultiColumnWithButtons story renders snapshot 1`] = ` `; diff --git a/packages/components/src/core/InputDropdown/__tests__/__snapshots__/index.test.tsx.snap b/packages/components/src/core/InputDropdown/__tests__/__snapshots__/index.test.tsx.snap index 5c2ff5c9c..88b08a2c1 100644 --- a/packages/components/src/core/InputDropdown/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/components/src/core/InputDropdown/__tests__/__snapshots__/index.test.tsx.snap @@ -4,7 +4,7 @@ exports[` Default story renders snapshot 1`] = `
+ `; diff --git a/packages/components/src/core/InputSearch/__tests__/__snapshots__/index.test.tsx.snap b/packages/components/src/core/InputSearch/__tests__/__snapshots__/index.test.tsx.snap index 626efebeb..1b604ded8 100644 --- a/packages/components/src/core/InputSearch/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/components/src/core/InputSearch/__tests__/__snapshots__/index.test.tsx.snap @@ -2,7 +2,7 @@ exports[` Default story renders snapshot 1`] = `