Skip to content

Commit b3b59c9

Browse files
revert(pages/learn): revert import location for links, buttons
1 parent 7953917 commit b3b59c9

File tree

4 files changed

+13
-25
lines changed

4 files changed

+13
-25
lines changed

src/pages/learn.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { HTMLAttributes, ReactNode } from "react"
55

66
import type { BasePageProps, ChildOnlyProp, Lang, ToCItem } from "@/lib/types"
77

8+
import ButtonLink from "@/components/Buttons/ButtonLink"
89
import OriginalCard, {
910
type CardProps as OriginalCardProps,
1011
} from "@/components/Card"
@@ -14,6 +15,7 @@ import { HubHero } from "@/components/Hero"
1415
import type { HubHeroProps } from "@/components/Hero/HubHero"
1516
import { Image, type ImageProps } from "@/components/Image"
1617
import LeftNavBar from "@/components/LeftNavBar"
18+
import InlineLink from "@/components/Link"
1719
import MainArticle from "@/components/MainArticle"
1820
import { ContentContainer } from "@/components/MdComponents"
1921
import PageMetadata from "@/components/PageMetadata"
@@ -24,9 +26,6 @@ import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
2426
import { getLocaleTimestamp } from "@/lib/utils/time"
2527
import { getRequiredNamespacesForPage } from "@/lib/utils/translations"
2628

27-
import InlineLink from "../../tailwind/Link"
28-
import { ButtonLink } from "../../tailwind/ui/buttons/Button"
29-
3029
import developersEthBlocks from "@/public/images/developers-eth-blocks.png"
3130
import dogeComputer from "@/public/images/doge-computer.png"
3231
import enterprise from "@/public/images/enterprise-eth.png"

tailwind/ui/__stories__/Button.stories.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ export const OverrideStyles: Story = {
117117
<Button aria-label="toggle" className="px-1.5">
118118
<MdNightlight />
119119
</Button>
120-
<ButtonLink className="rounded-full px-0 py-0" href="#">
120+
<ButtonLink
121+
className="rounded-full px-0 py-0"
122+
linkProps={{ href: "#" }}
123+
>
121124
<Translation id="get-involved" />
122125
</ButtonLink>
123126
</VStack>

tailwind/ui/buttons/Button.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
106106
)
107107
Button.displayName = "Button"
108108

109-
type ButtonLinkProps = LinkProps & {
110-
buttonProps?: ButtonProps
109+
type ButtonLinkProps = ButtonProps & {
110+
linkProps: LinkProps
111111
customEventOptions?: MatomoEventOptions
112112
}
113113

114114
const ButtonLink = React.forwardRef<HTMLAnchorElement, ButtonLinkProps>(
115-
({ buttonProps, customEventOptions, children, ...linkProps }, ref) => {
115+
({ linkProps, customEventOptions, children, ...buttonProps }, ref) => {
116116
const handleClick = () => {
117117
customEventOptions && trackCustomEvent(customEventOptions)
118118
}
@@ -123,7 +123,7 @@ const ButtonLink = React.forwardRef<HTMLAnchorElement, ButtonLinkProps>(
123123
activeStyle={{}}
124124
// TODO: Redress this override when migrating the link component
125125
color={
126-
buttonProps?.variant === "solid" ? "background.base" : undefined
126+
buttonProps.variant === "solid" ? "background.base" : undefined
127127
}
128128
textDecor="none"
129129
_hover={{

tailwind/ui/buttons/ButtonTwoLines.tsx

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,9 @@ const ButtonTwoLines = ({
6363
)
6464

6565
if (props.componentType === "link") {
66-
const { buttonProps, ...rest } = props
6766
return (
68-
<ButtonLink
69-
className={commonClassStyles}
70-
size={size}
71-
buttonProps={buttonProps}
72-
{...rest}
73-
>
74-
<ChildContent
75-
{...rest}
76-
size={size}
77-
isSecondary={buttonProps?.isSecondary}
78-
isIconLeft={isIconLeft}
79-
/>
67+
<ButtonLink className={commonClassStyles} size={size} {...props}>
68+
<ChildContent {...props} size={size} isIconLeft={isIconLeft} />
8069
</ButtonLink>
8170
)
8271
}
@@ -90,10 +79,7 @@ const ButtonTwoLines = ({
9079
export default ButtonTwoLines
9180

9281
const ChildContent = (
93-
props: Omit<ButtonTwoLinesProps, "iconAlignment" | "buttonProps"> & {
94-
isIconLeft: boolean
95-
isSecondary?: boolean
96-
}
82+
props: Omit<ButtonTwoLinesProps, "iconAlignment"> & { isIconLeft: boolean }
9783
) => {
9884
const {
9985
reverseTextOrder = false,

0 commit comments

Comments
 (0)