diff --git a/site/src/components/ActiveUserChart/ActiveUserChart.stories.tsx b/site/src/components/ActiveUserChart/ActiveUserChart.stories.tsx new file mode 100644 index 0000000000000..f6719fed3b071 --- /dev/null +++ b/site/src/components/ActiveUserChart/ActiveUserChart.stories.tsx @@ -0,0 +1,30 @@ +import type { Meta, StoryObj } from "@storybook/react"; +import { ActiveUserChart } from "./ActiveUserChart"; + +const meta: Meta = { + title: "components/ActiveUserChart", + component: ActiveUserChart, + args: { + data: [ + { date: "1/1/2024", amount: 5 }, + { date: "1/2/2024", amount: 6 }, + { date: "1/3/2024", amount: 7 }, + { date: "1/4/2024", amount: 8 }, + { date: "1/5/2024", amount: 9 }, + { date: "1/6/2024", amount: 10 }, + { date: "1/7/2024", amount: 11 }, + ], + interval: "day", + }, +}; + +export default meta; +type Story = StoryObj; + +export const Example: Story = {}; + +export const UserLimit: Story = { + args: { + userLimit: 10, + }, +}; diff --git a/site/src/components/CopyButton/CopyButton.stories.tsx b/site/src/components/CopyButton/CopyButton.stories.tsx new file mode 100644 index 0000000000000..3d30009d6463a --- /dev/null +++ b/site/src/components/CopyButton/CopyButton.stories.tsx @@ -0,0 +1,18 @@ +import type { Meta, StoryObj } from "@storybook/react"; +import { CopyButton } from "./CopyButton"; + +const meta: Meta = { + title: "components/CopyButton", + component: CopyButton, + args: { + children: "Get secret", + text: "cool secret", + }, +}; + +export default meta; +type Story = StoryObj; + +const Example: Story = {}; + +export { Example as CopyButton }; diff --git a/site/src/components/CopyButton/CopyButton.tsx b/site/src/components/CopyButton/CopyButton.tsx index f5027d6861470..b28823948facb 100644 --- a/site/src/components/CopyButton/CopyButton.tsx +++ b/site/src/components/CopyButton/CopyButton.tsx @@ -36,18 +36,7 @@ export const CopyButton: FC = ({
css` - border-radius: 8px; - padding: 8px; - min-width: 32px; - - &:hover { - background: ${theme.palette.background.paper}; - } - `, - buttonStyles, - ]} + css={[styles.button, buttonStyles]} onClick={copyToClipboard} size="small" aria-label={Language.ariaLabel} @@ -66,6 +55,15 @@ export const CopyButton: FC = ({ }; const styles = { + button: (theme) => css` + border-radius: 8px; + padding: 8px; + min-width: 32px; + + &:hover { + background: ${theme.palette.background.paper}; + } + `, copyIcon: css` width: 20px; height: 20px; diff --git a/site/src/components/CopyableValue/CopyableValue.stories.tsx b/site/src/components/CopyableValue/CopyableValue.stories.tsx new file mode 100644 index 0000000000000..aa69dbe13359f --- /dev/null +++ b/site/src/components/CopyableValue/CopyableValue.stories.tsx @@ -0,0 +1,18 @@ +import type { Meta, StoryObj } from "@storybook/react"; +import { CopyableValue } from "./CopyableValue"; + +const meta: Meta = { + title: "components/CopyableValue", + component: CopyableValue, + args: { + children: , + value: "cool secret", + }, +}; + +export default meta; +type Story = StoryObj; + +const Example: Story = {}; + +export { Example as CopyableValue }; diff --git a/site/src/components/CopyableValue/CopyableValue.tsx b/site/src/components/CopyableValue/CopyableValue.tsx index 7d2de18bce4e2..c2d14e322256d 100644 --- a/site/src/components/CopyableValue/CopyableValue.tsx +++ b/site/src/components/CopyableValue/CopyableValue.tsx @@ -1,9 +1,9 @@ import Tooltip, { type TooltipProps } from "@mui/material/Tooltip"; +import { type FC, type HTMLAttributes } from "react"; import { useClickable } from "hooks/useClickable"; import { useClipboard } from "hooks/useClipboard"; -import { type FC, type HTMLProps } from "react"; -interface CopyableValueProps extends HTMLProps { +interface CopyableValueProps extends HTMLAttributes { value: string; placement?: TooltipProps["placement"]; PopperProps?: TooltipProps["PopperProps"]; @@ -13,7 +13,8 @@ export const CopyableValue: FC = ({ value, placement = "bottom-start", PopperProps, - ...props + children, + ...attrs }) => { const { isCopied, copy } = useClipboard(value); const clickableProps = useClickable(copy); @@ -24,7 +25,9 @@ export const CopyableValue: FC = ({ placement={placement} PopperProps={PopperProps} > - + + {children} + ); };