-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Design system: Modular CSS support, Color palette, Ant theme update (#…
- Loading branch information
1 parent
e5f240d
commit e3d2fe8
Showing
16 changed files
with
514 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,65 @@ | ||
import { AntThemeConfig } from "fidesui"; | ||
import palette from "fidesui/src/palette/palette.module.scss"; | ||
|
||
/** | ||
* Order of priority for styling | ||
* 1. Ant Design default theme | ||
* 2. FidesUI palette colors | ||
* 3. Ant Design custom theme (this file, which also includes some custom override colors not found in the palette) | ||
* 4. global CSS variables (as a last resort when styling Ant components, should rely on the palette vars) | ||
* 5. tailwindcss (for layout and spacing only) | ||
* 6. SCSS modules (for custom-component-specific styles) | ||
*/ | ||
|
||
export const antTheme: AntThemeConfig = { | ||
cssVar: true, | ||
token: { | ||
colorPrimary: "#2b2e35", | ||
colorInfo: "#2b2e35", | ||
colorSuccess: "#5a9a68", | ||
colorWarning: "#e59d47", | ||
colorError: "#d9534f", | ||
colorLink: "#2272ce", | ||
colorBgBase: "#ffffff", | ||
colorPrimary: palette.FIDESUI_MINOS, | ||
colorInfo: palette.FIDESUI_MINOS, | ||
colorSuccess: palette.FIDESUI_SUCCESS, | ||
colorWarning: palette.FIDESUI_WARNING, | ||
colorError: palette.FIDESUI_ERROR, | ||
colorLink: palette.LINK, | ||
colorBgBase: palette.FIDESUI_FULL_WHITE, | ||
borderRadius: 4, | ||
wireframe: true, | ||
colorTextBase: "#2b2e35", | ||
colorErrorBg: "#ffdcd6", | ||
colorErrorBorder: "#f2aca5", | ||
colorWarningBg: "#ffecc9", | ||
colorWarningBorder: "#ffdba1", | ||
colorSuccessBorder: "#5a9a68", | ||
colorPrimaryBg: "#e3e0d9", | ||
colorBorder: "#e6e6e8", | ||
colorTextBase: palette.FIDESUI_MINOS, | ||
colorErrorBg: "#ffdcd6", // custom override | ||
colorErrorBorder: "#f2aca5", // custom override | ||
colorWarningBg: "#ffecc9", // custom override | ||
colorWarningBorder: "#ffdba1", // custom override | ||
colorSuccessBorder: palette.FIDESUI_SUCCESS, | ||
colorPrimaryBg: palette.FIDESUI_SANDSTONE, | ||
colorBorder: palette.FIDESUI_NEUTRAL_100, | ||
zIndexPopupBase: 1500, // supersede Chakra's modal z-index | ||
}, | ||
components: { | ||
Alert: { | ||
colorInfoBg: palette.FIDESUI_FULL_WHITE, | ||
colorInfo: palette.FIDESUI_NEUTRAL_500, | ||
}, | ||
Button: { | ||
primaryShadow: "", | ||
defaultShadow: "", | ||
dangerShadow: "", | ||
defaultBg: "#ffffff", | ||
primaryShadow: undefined, | ||
defaultShadow: undefined, | ||
dangerShadow: undefined, | ||
defaultBg: palette.FIDESUI_FULL_WHITE, | ||
}, | ||
Input: { | ||
colorBgContainer: palette.FIDESUI_FULL_WHITE, | ||
}, | ||
Layout: { | ||
bodyBg: "rgb(250,250,250)", | ||
bodyBg: palette.FIDESUI_NEUTRAL_50, | ||
}, | ||
Alert: { | ||
colorInfoBg: "rgb(255,255,255)", | ||
colorInfo: "rgb(147,150,154)", | ||
Select: { | ||
optionActiveBg: palette.FIDESUI_SANDSTONE, | ||
}, | ||
Tooltip: { | ||
colorBgSpotlight: "rgb(43,46,53)", | ||
colorText: "rgb(250,250,250)", | ||
colorTextLightSolid: "rgb(250,250,250)", | ||
colorBgSpotlight: palette.FIDESUI_MINOS, | ||
colorText: palette.FIDESUI_NEUTRAL_50, | ||
colorTextLightSolid: palette.FIDESUI_NEUTRAL_50, | ||
}, | ||
Transfer: { | ||
controlItemBgActiveHover: "rgb(206,202,194)", | ||
}, | ||
Input: { | ||
colorBgContainer: "#ffffff", | ||
controlItemBgActiveHover: palette.FIDESUI_SANDSTONE, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
@import "fidesui/src/palette/palette.module.scss"; | ||
|
||
/** | ||
* Adds the color variables from the palette to the root element | ||
*/ | ||
:root { | ||
@each $color, $value in $colors { | ||
#{getPrefixedColor("--fidesui-", unquote($color))}: $value; | ||
} | ||
} | ||
|
||
/** | ||
* Styles for Ant components where tokens are not available | ||
*/ | ||
.ant-input-compact-item.ant-input-css-var { | ||
--ant-color-border: var(--fidesui-neutral-200); | ||
--ant-input-hover-border-color: var(--fidesui-neutral-200); | ||
} | ||
.ant-btn-compact-item.ant-btn-variant-outlined { | ||
--ant-button-default-border-color: var(--fidesui-neutral-200); | ||
--ant-button-default-hover-border-color: var(--fidesui-neutral-200); | ||
--ant-button-default-hover-bg: var(--fidesui-neutral-200); | ||
--ant-button-default-bg: var(--fidesui-neutral-50); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
$colors: ( | ||
"full-black": #000000, | ||
"full-white": #ffffff, | ||
|
||
// Neutral // | ||
"neutral-50": #fafafa, | ||
"neutral-75": #f5f5f5, | ||
"neutral-100": #e6e6e8, | ||
"neutral-200": #d1d2d4, | ||
"neutral-300": #bcbec1, | ||
"neutral-400": #a8aaad, | ||
"neutral-500": #93969a, | ||
"neutral-600": #7e8185, | ||
"neutral-700": #696c71, | ||
"neutral-800": #53575c, | ||
"neutral-900": #2b2e35, | ||
|
||
// Brand // | ||
"corinth": #fafafa, | ||
"bg-corinth": #fafafa, | ||
"limestone": #f1efee, | ||
"minos": #2b2e35, | ||
"bg-minos": #4f525b, | ||
"terracotta": #b9704b, | ||
"bg-terracotta": #f1b193, | ||
"olive": #999b83, | ||
"bg-olive": #d4d5c8, | ||
"marble": #cdd2d3, | ||
"bg-marble": #e1e5e6, | ||
"sandstone": #cecac2, | ||
"bg-sandstone": #e3e0d9, | ||
"nectar": #f0ebc1, | ||
"bg-nectar": #f5f2d7, | ||
|
||
// Functional // | ||
"error": #d9534f, | ||
"bg-error": #f7c2c2, | ||
"warning": #e59d47, | ||
"bg-warning": #fbddb5, | ||
"bg-caution": #f6e3a4, | ||
"success": #5a9a68, | ||
"bg-success": #c3e6b2, | ||
"info": #4a90e2, | ||
"bg-info": #a5d6f3, | ||
"alert": #7b4ea9, | ||
"bg-alert": #d9b0d7, | ||
|
||
// Type // | ||
"error-text": #d32f2f, | ||
"success-text": #388e3c, | ||
"link": #2272ce, | ||
); | ||
|
||
@function getPrefixedColor($prefix, $name) { | ||
@return $prefix + $name; | ||
} | ||
|
||
@function str-replace($string, $search, $replace: "") { | ||
$index: str-index($string, $search); | ||
|
||
@if $index { | ||
@return str-slice($string, 1, $index - 1) + $replace + | ||
str-replace( | ||
str-slice($string, $index + str-length($search)), | ||
$search, | ||
$replace | ||
); | ||
} | ||
|
||
@return $string; | ||
} | ||
|
||
/** | ||
* exports a typescript object with the colors | ||
* @example | ||
* ```tsx | ||
* import { palette } from 'fidesui/src/palette/palette.module.scss'; | ||
* console.log(palette.FIDESUI_MINOS); | ||
* ``` | ||
*/ | ||
:export { | ||
@each $color, $value in $colors { | ||
#{to-upper-case(getPrefixedColor("FIDESUI_", str-replace(unquote($color), '-', '_')))}: $value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare module "*.module.scss" { | ||
const palette: { readonly [key: string]: string }; | ||
export default palette; | ||
} |
Oops, something went wrong.