Skip to content

Commit 4158959

Browse files
authored
Merge pull request #14521 from TylerAPfledderer/fix/ButtonTwoLines-split-renders
fix(ButtonTwoLines): split rendering of button or link
2 parents 6810b25 + 81da546 commit 4158959

File tree

7 files changed

+159
-175
lines changed

7 files changed

+159
-175
lines changed

src/components/BugBountyCards.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ const CardRow = ({ children }: ChildOnlyProp) => (
1414
<Flex className="mx-4 my-16 flex-wrap justify-between">{children}</Flex>
1515
)
1616

17-
const SubmitBugBountyButton = ({ children, ...props }: ButtonLinkProps) => (
17+
const SubmitBugBountyButton = ({
18+
children,
19+
...props
20+
}: Omit<ButtonLinkProps, "href">) => (
1821
<ButtonLink
1922
className="m-4"
2023
href="https://forms.gle/Gnh4gzGh66Yc3V7G8"

src/components/Buttons/ButtonTwoLines/index.tsx

Lines changed: 0 additions & 113 deletions
This file was deleted.

src/components/Buttons/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
export { default as Button, type ButtonProps, checkIsSecondary } from "./Button"
22
export { default as ButtonLink, type ButtonLinkProps } from "./ButtonLink"
3-
export { default as ButtonTwoLines } from "./ButtonTwoLines"
43
export { default as IconButton } from "./IconButton"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { BiCircle } from "react-icons/bi"
2+
import type { Meta, StoryObj } from "@storybook/react"
3+
4+
import { ButtonLinkTwoLines as ButtonLinkTwoLinesComponent } from "../buttons/ButtonTwoLines"
5+
import { Stack } from "../flex"
6+
7+
const meta = {
8+
title: "Atoms / Form / Buttons / ButtonTwoLines",
9+
component: ButtonLinkTwoLinesComponent,
10+
} satisfies Meta<typeof ButtonLinkTwoLinesComponent>
11+
12+
export default meta
13+
14+
type Story = StoryObj<typeof meta>
15+
16+
export const ButtonLinkTwoLines: Story = {
17+
args: {
18+
icon: BiCircle,
19+
mainText: "Main Text",
20+
helperText: "Helper Text",
21+
className: "w-[300px]",
22+
href: "#",
23+
},
24+
render: (args) => (
25+
<Stack className="gap-8">
26+
<ButtonLinkTwoLinesComponent {...args} />
27+
<ButtonLinkTwoLinesComponent
28+
{...args}
29+
iconAlignment="end"
30+
size="sm"
31+
reverseTextOrder
32+
/>
33+
</Stack>
34+
),
35+
}

src/components/ui/__stories__/ButtonTwoLines.stories.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { BiCircle } from "react-icons/bi"
2-
import { Stack } from "@chakra-ui/react"
32
import { Meta, StoryObj } from "@storybook/react"
43

5-
import ButtonTwoLinesComponent from "../buttons/ButtonTwoLines"
4+
import { ButtonTwoLines as ButtonTwoLinesComponent } from "../buttons/ButtonTwoLines"
5+
import { Stack } from "../flex"
66

77
const meta = {
88
title: "Atoms / Form / Buttons / ButtonTwoLines",
@@ -15,14 +15,13 @@ type Story = StoryObj<typeof meta>
1515

1616
export const ButtonTwoLines: Story = {
1717
args: {
18-
componentType: "button",
1918
icon: BiCircle,
2019
mainText: "Main Text",
2120
helperText: "Helper Text",
2221
className: "w-[300px]",
2322
},
2423
render: (args) => (
25-
<Stack spacing="8">
24+
<Stack className="gap-8">
2625
<ButtonTwoLinesComponent {...args} />
2726
<ButtonTwoLinesComponent
2827
{...args}

src/components/ui/buttons/Button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
126126
)
127127
Button.displayName = "Button"
128128

129-
type ButtonLinkProps = LinkProps &
129+
type ButtonLinkProps = Omit<LinkProps, "href"> &
130130
Pick<ButtonProps, "size" | "variant" | "isSecondary"> & {
131+
href: string
131132
buttonProps?: Omit<ButtonProps, "size" | "variant">
132133
customEventOptions?: MatomoEventOptions
133134
}

0 commit comments

Comments
 (0)