Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: add additional stories to storybook#11524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
aslilac merged 1 commit intomainfromadd-stories-1
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
import type { Meta, StoryObj } from "@storybook/react";
import { ActiveUserChart } from "./ActiveUserChart";

const meta: Meta<typeof ActiveUserChart> = {
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<typeof ActiveUserChart>;

export const Example: Story = {};

export const UserLimit: Story = {
args: {
userLimit: 10,
},
};
18 changes: 18 additions & 0 deletionssite/src/components/CopyButton/CopyButton.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
import type { Meta, StoryObj } from "@storybook/react";
import { CopyButton } from "./CopyButton";

const meta: Meta<typeof CopyButton> = {
title: "components/CopyButton",
component: CopyButton,
args: {
children: "Get secret",
text: "cool secret",
},
};

export default meta;
type Story = StoryObj<typeof CopyButton>;

const Example: Story = {};

export { Example as CopyButton };
22 changes: 10 additions & 12 deletionssite/src/components/CopyButton/CopyButton.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,18 +36,7 @@ export const CopyButton: FC<CopyButtonProps> = ({
<Tooltip title={tooltipTitle} placement="top">
<div css={[{ display: "flex" }, wrapperStyles]}>
<IconButton
css={[
(theme) => 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}
Expand All@@ -66,6 +55,15 @@ export const CopyButton: FC<CopyButtonProps> = ({
};

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;
Expand Down
18 changes: 18 additions & 0 deletionssite/src/components/CopyableValue/CopyableValue.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
import type { Meta, StoryObj } from "@storybook/react";
import { CopyableValue } from "./CopyableValue";

const meta: Meta<typeof CopyableValue> = {
title: "components/CopyableValue",
component: CopyableValue,
args: {
children: <button>Get secret</button>,
value: "cool secret",
},
};

export default meta;
type Story = StoryObj<typeof CopyableValue>;

const Example: Story = {};

export { Example as CopyableValue };
11 changes: 7 additions & 4 deletionssite/src/components/CopyableValue/CopyableValue.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -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 extendsHTMLProps<HTMLDivElement> {
interface CopyableValueProps extendsHTMLAttributes<HTMLSpanElement> {
value: string;
placement?: TooltipProps["placement"];
PopperProps?: TooltipProps["PopperProps"];
Expand All@@ -13,7 +13,8 @@ export const CopyableValue: FC<CopyableValueProps> = ({
value,
placement = "bottom-start",
PopperProps,
...props
children,
...attrs
}) => {
const { isCopied, copy } = useClipboard(value);
const clickableProps = useClickable<HTMLSpanElement>(copy);
Expand All@@ -24,7 +25,9 @@ export const CopyableValue: FC<CopyableValueProps> = ({
placement={placement}
PopperProps={PopperProps}
>
<span {...props} {...clickableProps} css={{ cursor: "pointer" }} />
<span {...attrs} {...clickableProps} css={{ cursor: "pointer" }}>
{children}
</span>
</Tooltip>
);
};

[8]ページ先頭

©2009-2025 Movatter.jp