diff --git a/frontends/ol-components/src/components/Button/Button.mdx b/frontends/ol-components/src/components/Button/Button.mdx index 6c97def52d..cda40de939 100644 --- a/frontends/ol-components/src/components/Button/Button.mdx +++ b/frontends/ol-components/src/components/Button/Button.mdx @@ -6,7 +6,7 @@ import * as ButtonStories from "./Button.stories" # Button -Use prop `variant="primary" | "secondary" | "tertiary" | "text"` to set the button variant: +Use prop `variant="primary" | "secondary" | "tertiary" | "bordered" | "noBorder" | "inverted" | "success" | "text"` to set the button variant: diff --git a/frontends/ol-components/src/components/Button/Button.stories.tsx b/frontends/ol-components/src/components/Button/Button.stories.tsx index 499e408c33..d7e7e71175 100644 --- a/frontends/ol-components/src/components/Button/Button.stories.tsx +++ b/frontends/ol-components/src/components/Button/Button.stories.tsx @@ -34,9 +34,11 @@ const meta: Meta = { "primary", "secondary", "tertiary", - "text", + "bordered", + "noBorder", "inverted", - "text-secondary", + "success", + "text", ], control: { type: "select" }, }, @@ -88,15 +90,21 @@ export const VariantStory: Story = { - + + ), } @@ -149,9 +157,21 @@ export const DisabledStory: Story = { - + + + + @@ -217,7 +237,16 @@ export const IconOnlyStory: Story = { const EDGES = ["rounded", "circular", "none"] as const -const VARIANTS = ["primary", "secondary", "tertiary", "text"] as const +const VARIANTS = [ + "primary", + "secondary", + "tertiary", + "bordered", + "noBorder", + "success", + "inverted", + "text", +] as const const EXTRA_PROPS = [ {}, /** diff --git a/frontends/ol-components/src/components/Button/Button.tsx b/frontends/ol-components/src/components/Button/Button.tsx index d30d7c6ac1..da81927726 100644 --- a/frontends/ol-components/src/components/Button/Button.tsx +++ b/frontends/ol-components/src/components/Button/Button.tsx @@ -10,10 +10,11 @@ type ButtonVariant = | "primary" | "secondary" | "tertiary" - | "text" + | "bordered" | "noBorder" | "inverted" | "success" + | "text" type ButtonSize = "small" | "medium" | "large" type ButtonEdge = "circular" | "rounded" | "none" @@ -98,7 +99,7 @@ const buildStyles = (props: ButtonStyleProps & { theme: Theme }) => { ...props, } const { colors } = theme.custom - const hasBorder = variant === "secondary" + const hasBorder = variant === "secondary" || variant === "bordered" return css([ { color: theme.palette.text.primary, @@ -142,11 +143,6 @@ const buildStyles = (props: ButtonStyleProps & { theme: Theme }) => { boxShadow: "none", }, }, - hasBorder && { - backgroundColor: "transparent", - borderColor: "currentcolor", - borderStyle: "solid", - }, variant === "success" && { backgroundColor: colors.darkGreen, color: colors.white, @@ -163,13 +159,11 @@ const buildStyles = (props: ButtonStyleProps & { theme: Theme }) => { boxShadow: "none", }, }, - hasBorder && { + variant === "secondary" && { + color: colors.red, backgroundColor: "transparent", borderColor: "currentcolor", borderStyle: "solid", - }, - variant === "secondary" && { - color: colors.red, ":hover:not(:disabled)": { backgroundColor: tinycolor(colors.brightRed).setAlpha(0.06).toString(), }, @@ -188,6 +182,20 @@ const buildStyles = (props: ButtonStyleProps & { theme: Theme }) => { color: colors.silverGray, }, }, + variant === "bordered" && { + backgroundColor: colors.white, + color: colors.silverGrayDark, + border: `1px solid ${colors.silverGrayLight}`, + ":hover:not(:disabled)": { + backgroundColor: colors.lightGray1, + color: colors.darkGray2, + }, + ":disabled": { + backgroundColor: colors.lightGray2, + border: `1px solid ${colors.lightGray2}`, + color: colors.silverGrayDark, + }, + }, variant === "noBorder" && { backgroundColor: colors.white, color: colors.darkGray2,