From fdd50b124ef317bd9562361c0eff06bccdac42c8 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Wed, 21 Feb 2024 10:25:45 -0500 Subject: [PATCH] Shared button component (WIP) --- .../replay-next/components/Button.module.css | 50 ++++++ packages/replay-next/components/Button.tsx | 24 +++ packages/replay-next/pages/variables.css | 6 +- .../debugger/src/components/WelcomeBox.tsx | 156 +++++++++++------- 4 files changed, 176 insertions(+), 60 deletions(-) create mode 100644 packages/replay-next/components/Button.module.css create mode 100644 packages/replay-next/components/Button.tsx diff --git a/packages/replay-next/components/Button.module.css b/packages/replay-next/components/Button.module.css new file mode 100644 index 00000000000..74d6e8ec35c --- /dev/null +++ b/packages/replay-next/components/Button.module.css @@ -0,0 +1,50 @@ +.Button { + font-family: var(--font-family-default); + font-size: var(--font-size-regular); + font-weight: 500; + padding: 0.5rem 1rem; + border-radius: 0.375rem; +} +.Button:disabled { + --accent-color: var(--background-color-disabled-button); + --accent-color-hover: var(--background-color-disabled-button); + --contrast-color: var(--color-disabled-button); + + color: var(--color-dimmer); +} + +.Button[data-color="primary"]:not(:disabled) { + --accent-color: var(--primary-accent); + --accent-color-hover: var(--primary-accent-hover); + --contrast-color: var(--color-primary-button); +} +.Button[data-color="secondary"]:not(:disabled) { + --accent-color: var(--secondary-accent); + --accent-color-hover: var(--secondary-accent-hover); + --contrast-color: var(--color-secondary-button); +} + +.Button[data-variant="outline"] { + border: 1px solid var(--accent-color); +} +.Button[data-variant="outline"]:hover { + border-color: var(--accent-color-hover); +} +.Button[data-variant="solid"] { + background-color: var(--accent-color); + color: var(--contrast-color); +} +.Button[data-variant="solid"]:hover { + background-color: var(--accent-color-hover); +} + +.Button[data-size="large"] { + font-size: var(--font-size-large); + padding: 0.75rem 1.25rem; + border-radius: 0.5rem; +} +.Button[data-size="small"] { + font-size: var(--font-size-small); + padding: 0.25rem 0.5rem; + border-radius: 0.25rem; +} diff --git a/packages/replay-next/components/Button.tsx b/packages/replay-next/components/Button.tsx new file mode 100644 index 00000000000..25b517d6bd5 --- /dev/null +++ b/packages/replay-next/components/Button.tsx @@ -0,0 +1,24 @@ +import { ButtonHTMLAttributes } from "react"; + +import styles from "./Button.module.css"; + +export function Button({ + color, + size = "normal", + variant = "solid", + ...rest +}: ButtonHTMLAttributes & { + color?: "primary" | "secondary"; + size?: "normal" | "large" | "small"; + variant?: "outline" | "solid"; +}) { + return ( + + + + + + + - return ( -
-
-
-
-
-
Command palette
-
- -
-
-
-
Go to file
-
- -
-
-
-
Find in file
-
- {" "} - -
-
+
+ + + + + +
-
- -
- Discord -
+ +
+ + + + + +