Skip to content

Commit 9a82216

Browse files
authored
Merge pull request #14905 from TylerAPfledderer/refactor/remove-remaining-chakra-components
refactor(components): remove remaining Chakra imports
2 parents 3bd7a11 + 6e56963 commit 9a82216

File tree

28 files changed

+114
-207
lines changed

28 files changed

+114
-207
lines changed

src/components/Banners/DismissableBanner/DismissableBanner.stories.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React from "react"
22
import { FaInfoCircle } from "react-icons/fa"
3-
import { Center, Container, Icon, Text } from "@chakra-ui/react"
43
import { Meta, StoryObj } from "@storybook/react"
54

5+
import { Center } from "@/components/ui/flex"
6+
67
import DismissableBanner from "."
78

89
const meta = {
@@ -13,9 +14,9 @@ const meta = {
1314
},
1415
decorators: [
1516
(Story) => (
16-
<Container mx="auto" maxW="1504px">
17+
<div className="mx-auto max-w-[1504px]">
1718
<Story />
18-
</Container>
19+
</div>
1920
),
2021
],
2122
} satisfies Meta<typeof DismissableBanner>
@@ -26,19 +27,19 @@ type Story = StoryObj<typeof meta>
2627
export const Basic: Story = {
2728
args: {
2829
storageKey: "dismissable-banner-1",
29-
children: <Text>This is a dismissable banner notification.</Text>,
30+
children: <p>This is a dismissable banner notification.</p>,
3031
},
3132
}
3233

3334
export const WithLongText: Story = {
3435
args: {
3536
storageKey: "dismissable-banner-2",
3637
children: (
37-
<Text>
38+
<p>
3839
This is a dismissable banner with a very long text content to see how it
3940
handles overflow and wrapping. It should be able to manage the text
4041
properly without breaking the layout.
41-
</Text>
42+
</p>
4243
),
4344
},
4445
}
@@ -48,7 +49,7 @@ export const WithIcon: Story = {
4849
storageKey: "dismissable-banner-3",
4950
children: (
5051
<Center>
51-
<Icon as={FaInfoCircle} mr={2} />
52+
<FaInfoCircle className="me-2" />
5253
This banner includes an icon.
5354
</Center>
5455
),

src/components/Breadcrumbs/Breadcrumbs.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import * as React from "react"
2-
import { Stack } from "@chakra-ui/react"
31
import { Meta, type StoryObj } from "@storybook/react"
42

3+
import { Stack } from "../ui/flex"
4+
55
import BreadcrumbsComponent from "."
66

77
const meta = {
@@ -13,7 +13,7 @@ export default meta
1313

1414
export const Breadcrumbs: StoryObj = {
1515
render: () => (
16-
<Stack spacing="8">
16+
<Stack className="gap-8">
1717
<BreadcrumbsComponent slug="/en/staking/" />
1818
<BreadcrumbsComponent slug="/en/staking/solo/" />
1919
<BreadcrumbsComponent slug="/en/roadmap/merge/issuance/" />

src/components/Card/Card.stories.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Box } from "@chakra-ui/react"
21
import { Meta, type StoryObj } from "@storybook/react"
32

43
import { getTranslation } from "@/storybook-utils"
@@ -11,9 +10,9 @@ const meta = {
1110
component: CardComponent,
1211
decorators: [
1312
(Story) => (
14-
<Box maxW="342px" margin="0 auto">
13+
<div className="max-w-[342px]">
1514
<Story />
16-
</Box>
15+
</div>
1716
),
1817
],
1918
} satisfies Meta<typeof CardComponent>

src/components/DocLink/DocLink.stories.tsx

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import * as React from "react"
2-
import { VStack } from "@chakra-ui/react"
31
import { Meta, StoryObj } from "@storybook/react"
42

3+
import { VStack } from "../ui/flex"
4+
55
import DocLink from "."
66

77
const meta = {
88
title: "Molecules / Navigation / DocLink",
99
component: DocLink,
10-
tags: ["autodocs"],
1110
} satisfies Meta<typeof DocLink>
1211

1312
export default meta
@@ -19,11 +18,6 @@ export const Default: Story = {
1918
href: "/history/",
2019
children: "History of Ethereum",
2120
},
22-
render: (args) => (
23-
<VStack spacing={4} align="stretch">
24-
<DocLink {...args} />
25-
</VStack>
26-
),
2721
}
2822

2923
export const ExternalLink: Story = {
@@ -32,19 +26,14 @@ export const ExternalLink: Story = {
3226
children: "Ethereum Website",
3327
isExternal: true,
3428
},
35-
render: (args) => (
36-
<VStack spacing={4} align="stretch">
37-
<DocLink {...args} />
38-
</VStack>
39-
),
4029
}
4130

4231
export const MultipleLinks: Story = {
4332
args: {
4433
href: "#",
4534
},
4635
render: () => (
47-
<VStack spacing={4} align="stretch">
36+
<VStack className="items-stretch gap-4">
4837
<DocLink href="/history/">History of Ethereum</DocLink>
4938
<DocLink href="https://ethereum.org" isExternal>
5039
Ethereum Website

src/components/FeedbackWidget/FeedbackWidget.stories.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import * as React from "react"
2-
import { Box, Stack } from "@chakra-ui/react"
32
import { Meta, StoryObj } from "@storybook/react"
43
import { expect, fireEvent, waitFor, within } from "@storybook/test"
54

5+
import { Stack } from "../ui/flex"
6+
67
import FeedbackWidget from "./"
78

89
const meta = {
@@ -13,8 +14,8 @@ const meta = {
1314
component: FeedbackWidget,
1415
decorators: [
1516
(Story) => (
16-
<Stack minH="100vh" position="relative">
17-
<Box flex="1" />
17+
<Stack className="relative min-h-[100vh] gap-0">
18+
<div className="flex-1" />
1819
<Story />
1920
</Stack>
2021
),
@@ -25,12 +26,9 @@ export default meta
2526

2627
type Story = StoryObj<typeof meta>
2728

28-
export const WidgetButton: Story = {
29-
render: () => <FeedbackWidget />,
30-
}
29+
export const WidgetButton: Story = {}
3130

3231
export const WidgetModal: Story = {
33-
render: () => <FeedbackWidget />,
3432
play: async ({ canvasElement }) => {
3533
// Add delay for snapshot capture of the modal
3634
const canvas = within(canvasElement)

src/components/Glossary/GlossaryTooltip/GlossaryTooltip.stories.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { Center } from "@chakra-ui/react"
21
import { Meta, StoryObj } from "@storybook/react"
32

3+
import { Center } from "@/components/ui/flex"
4+
45
import GlossaryTooltipComponent from "."
56

67
const meta = {
@@ -12,7 +13,7 @@ const meta = {
1213
},
1314
decorators: [
1415
(Story) => (
15-
<Center boxSize="md">
16+
<Center className="size-128">
1617
<Story />
1718
</Center>
1819
),

src/components/Heading/index.tsx

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

src/components/Hero/HubHero/HubHero.stories.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import * as React from "react"
2-
import { Box } from "@chakra-ui/react"
1+
import type { CSSProperties } from "react"
32
import { Meta, StoryObj } from "@storybook/react"
43

4+
import { screens } from "@/lib/utils/screen"
5+
56
import { getTranslation } from "@/storybook-utils"
67

78
import { langViewportModes } from "../../../../.storybook/modes"
@@ -23,9 +24,12 @@ const meta = {
2324
},
2425
decorators: [
2526
(Story) => (
26-
<Box maxW="container.2xl" mx="auto">
27+
<div
28+
style={{ "--hero-decorator-max-w": screens["2xl"] } as CSSProperties}
29+
className="mx-auto max-w-[var(--hero-decorator-max-w)]"
30+
>
2731
<Story />
28-
</Box>
32+
</div>
2933
),
3034
],
3135
} satisfies Meta<typeof HubHeroComponent>

src/components/Hero/MdxHero/MdxHero.stories.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import { HStack } from "@chakra-ui/react"
1+
import type { CSSProperties } from "react"
22
import { Meta, StoryObj } from "@storybook/react"
33

4+
import { HStack } from "@/components/ui/flex"
5+
6+
import { screens } from "@/lib/utils/screen"
7+
48
import { langViewportModes } from "../../../../.storybook/modes"
59

610
import MdxHeroComponent from "./"
@@ -18,7 +22,10 @@ const meta = {
1822
},
1923
decorators: [
2024
(Story) => (
21-
<HStack maxW="container.2xl" m="auto" height="100vh">
25+
<HStack
26+
style={{ "--hero-decorator-max-w": screens["2xl"] } as CSSProperties}
27+
className="mx-auto h-[100vh] max-w-[var(--hero-decorator-max-w)]"
28+
>
2229
<Story />
2330
</HStack>
2431
),

src/components/MergeInfographic/MergeInfographic.stories.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Box } from "@chakra-ui/react"
21
import { Meta, StoryObj } from "@storybook/react"
32

43
import { langViewportModes } from "../../../.storybook/modes"
@@ -18,9 +17,9 @@ const meta = {
1817
},
1918
decorators: [
2019
(Story) => (
21-
<Box maxW="1008px" mx="auto">
20+
<div className="mx-auto max-w-[1008px]">
2221
<Story />
23-
</Box>
22+
</div>
2423
),
2524
],
2625
} satisfies Meta<typeof MergeInfographicComponent>

0 commit comments

Comments
 (0)