Skip to content

Commit

Permalink
Merge pull request #14521 from TylerAPfledderer/fix/ButtonTwoLines-sp…
Browse files Browse the repository at this point in the history
…lit-renders

fix(ButtonTwoLines): split rendering of button or link
  • Loading branch information
pettinarip authored Dec 23, 2024
2 parents 6810b25 + 81da546 commit 4158959
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 175 deletions.
5 changes: 4 additions & 1 deletion src/components/BugBountyCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ const CardRow = ({ children }: ChildOnlyProp) => (
<Flex className="mx-4 my-16 flex-wrap justify-between">{children}</Flex>
)

const SubmitBugBountyButton = ({ children, ...props }: ButtonLinkProps) => (
const SubmitBugBountyButton = ({
children,
...props
}: Omit<ButtonLinkProps, "href">) => (
<ButtonLink
className="m-4"
href="https://forms.gle/Gnh4gzGh66Yc3V7G8"
Expand Down
113 changes: 0 additions & 113 deletions src/components/Buttons/ButtonTwoLines/index.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/components/Buttons/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { default as Button, type ButtonProps, checkIsSecondary } from "./Button"
export { default as ButtonLink, type ButtonLinkProps } from "./ButtonLink"
export { default as ButtonTwoLines } from "./ButtonTwoLines"
export { default as IconButton } from "./IconButton"
35 changes: 35 additions & 0 deletions src/components/ui/__stories__/ButtonLinkTwoLines.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { BiCircle } from "react-icons/bi"
import type { Meta, StoryObj } from "@storybook/react"

import { ButtonLinkTwoLines as ButtonLinkTwoLinesComponent } from "../buttons/ButtonTwoLines"
import { Stack } from "../flex"

const meta = {
title: "Atoms / Form / Buttons / ButtonTwoLines",
component: ButtonLinkTwoLinesComponent,
} satisfies Meta<typeof ButtonLinkTwoLinesComponent>

export default meta

type Story = StoryObj<typeof meta>

export const ButtonLinkTwoLines: Story = {
args: {
icon: BiCircle,
mainText: "Main Text",
helperText: "Helper Text",
className: "w-[300px]",
href: "#",
},
render: (args) => (
<Stack className="gap-8">
<ButtonLinkTwoLinesComponent {...args} />
<ButtonLinkTwoLinesComponent
{...args}
iconAlignment="end"
size="sm"
reverseTextOrder
/>
</Stack>
),
}
7 changes: 3 additions & 4 deletions src/components/ui/__stories__/ButtonTwoLines.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BiCircle } from "react-icons/bi"
import { Stack } from "@chakra-ui/react"
import { Meta, StoryObj } from "@storybook/react"

import ButtonTwoLinesComponent from "../buttons/ButtonTwoLines"
import { ButtonTwoLines as ButtonTwoLinesComponent } from "../buttons/ButtonTwoLines"
import { Stack } from "../flex"

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

export const ButtonTwoLines: Story = {
args: {
componentType: "button",
icon: BiCircle,
mainText: "Main Text",
helperText: "Helper Text",
className: "w-[300px]",
},
render: (args) => (
<Stack spacing="8">
<Stack className="gap-8">
<ButtonTwoLinesComponent {...args} />
<ButtonTwoLinesComponent
{...args}
Expand Down
3 changes: 2 additions & 1 deletion src/components/ui/buttons/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
)
Button.displayName = "Button"

type ButtonLinkProps = LinkProps &
type ButtonLinkProps = Omit<LinkProps, "href"> &
Pick<ButtonProps, "size" | "variant" | "isSecondary"> & {
href: string
buttonProps?: Omit<ButtonProps, "size" | "variant">
customEventOptions?: MatomoEventOptions
}
Expand Down
Loading

0 comments on commit 4158959

Please sign in to comment.