Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ButtonTwoLines): split rendering of button or link #14521

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious, is the intention of this change to make the field required? looks good if so

buttonProps?: Omit<ButtonProps, "size" | "variant">
customEventOptions?: MatomoEventOptions
}
Expand Down
Loading
Loading