Skip to content

Commit 239f35a

Browse files
committed
components: Button fixes
1 parent 0f322a5 commit 239f35a

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

packages/components/src/Button/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { ButtonHTMLAttributes, ReactNode } from "react";
22

3-
type Color = "default" | "red" | "green" | "dark" | "white" | "gradient";
3+
export type Color = "default" | "red" | "green" | "dark" | "white" | "gradient";
44
type Size = "small" | "medium" | "large";
5-
type Shape = "default" | "pill";
5+
export type Shape = "default" | "pill";
66

77
type VariantProps = {
88
color?: Color;

packages/components/src/CopyButton/index.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@ import cx from "classnames";
44
import React from "react";
55
import CopyToClipboard from "react-copy-to-clipboard";
66
import Button from "../Button";
7+
import { Color } from "../Button/types";
78
import css from "./index.module.css";
89

910
type Props = {
1011
text: string;
11-
light?: boolean;
12+
color?: Color;
1213
};
1314

14-
export default function CopyButton({ text, light }: Props) {
15+
export default function CopyButton({ text, color }: Props) {
1516
const success = useDelay(3000);
1617
return (
1718
<CopyToClipboard text={text} onCopy={success.start}>
1819
<Button
19-
className={cx(css.copy, { [css.light]: light })}
20-
white={light}
20+
className={cx(css.copy, { [css.light]: color === "white" })}
21+
color={color}
2122
size="small"
2223
>
23-
{light && <IoCopyOutline />}
24+
{color === "white" && <IoCopyOutline />}
2425
{success.active ? "Copied" : "Copy"}
2526
</Button>
2627
</CopyToClipboard>

packages/components/src/Modal/ForForm.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { SyntheticEvent } from "react";
22
import { ModalButtons, ModalInner, ModalOuter, OuterProps } from ".";
33
import Button from "../Button";
4+
import { Color, Shape } from "../Button/types";
45

56
type Props = OuterProps & {
67
onSubmit: (e: SyntheticEvent) => void | Promise<void>;
@@ -9,10 +10,11 @@ type Props = OuterProps & {
910
// Button props
1011
btnText: string;
1112
buttonDataCy?: string;
12-
pill?: boolean;
13-
red?: boolean;
13+
shape?: Shape;
14+
color?: Color;
15+
// red?: boolean;
1416
disabled?: boolean;
15-
gradient?: boolean;
17+
// gradient?: boolean;
1618
};
1719

1820
export default function FormModal({ children, ...props }: Props) {
@@ -23,9 +25,10 @@ export default function FormModal({ children, ...props }: Props) {
2325
<ModalButtons onRequestClose={props.onRequestClose} err={props.err}>
2426
<Button
2527
type="submit"
26-
pill={props.pill}
27-
red={props.red}
28-
gradient={props.gradient}
28+
shape={props.shape}
29+
color={props.color}
30+
// red={props.red}
31+
// gradient={props.gradient}
2932
disabled={props.disabled}
3033
data-cy={props.buttonDataCy}
3134
>

packages/components/src/__stories__/CopyButton.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ export const Default: Story = {
2020
export const Light: Story = {
2121
args: {
2222
...Default.args,
23-
light: true,
23+
color: "white",
2424
},
2525
};

0 commit comments

Comments
 (0)