Skip to content

Commit 4d1b9dd

Browse files
committed
refactor: extract ui/divider
1 parent 78cf2ef commit 4d1b9dd

File tree

12 files changed

+31
-57
lines changed

12 files changed

+31
-57
lines changed

src/components/MdComponents/index.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import LocaleDateTime from "../LocaleDateTime"
2727
import MainArticle from "../MainArticle"
2828
import { StandaloneQuizWidget } from "../Quiz/QuizWidget"
2929
import { ButtonLink } from "../ui/buttons/Button"
30+
import { Divider } from "../ui/divider"
3031
import { Flex } from "../ui/flex"
3132
import { ListItem, OrderedList, UnorderedList } from "../ui/list"
3233
import { mdxTableComponents } from "../ui/Table"
@@ -180,10 +181,6 @@ export const MobileButtonDropdown = ({
180181
<StyledButtonDropdown className={cn("mb-0", className)} {...props} />
181182
)
182183

183-
export const Divider = () => (
184-
<div className="my-16 h-1 w-[10%] bg-primary-high-contrast" />
185-
)
186-
187184
// All custom React components
188185
export const reactComponents = {
189186
Badge,

src/components/ui/divider.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { forwardRef } from "react"
2+
3+
import { cn } from "@/lib/utils/cn"
4+
5+
const Divider = forwardRef<
6+
HTMLDivElement,
7+
React.HTMLAttributes<HTMLDivElement>
8+
>(({ className, ...props }, ref) => (
9+
<div
10+
ref={ref}
11+
className={cn("my-16 h-1 w-[10%] bg-primary-high-contrast", className)}
12+
{...props}
13+
/>
14+
))
15+
16+
Divider.displayName = "Divider"
17+
18+
export { Divider }

src/layouts/Docs.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
Badge,
55
Box,
66
type BoxProps,
7-
Divider as ChakraDivider,
87
Flex,
98
type FlexProps,
109
type ListProps,
@@ -42,6 +41,7 @@ import SideNav from "@/components/SideNav"
4241
import SideNavMobile from "@/components/SideNavMobile"
4342
import TableOfContents from "@/components/TableOfContents"
4443
import Translation from "@/components/Translation"
44+
import { Divider } from "@/components/ui/divider"
4545
import { mdxTableComponents } from "@/components/ui/Table"
4646
import YouTube from "@/components/YouTube"
4747

@@ -58,15 +58,6 @@ const Page = (props: ChildOnlyProp & Pick<FlexProps, "dir">) => (
5858
/>
5959
)
6060

61-
const Divider = () => (
62-
<ChakraDivider
63-
my={16}
64-
w="10%"
65-
borderBottomWidth={1}
66-
borderColor="homeDivider"
67-
/>
68-
)
69-
7061
type ContentContainerProps = Pick<BoxProps, "children" | "dir">
7162

7263
const ContentContainer = (props: ContentContainerProps) => (

src/pages/bug-bounty.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import OldHeading from "@/components/OldHeading"
2828
import Text from "@/components/OldText"
2929
import PageMetadata from "@/components/PageMetadata"
3030
import Translation from "@/components/Translation"
31+
import { Divider } from "@/components/ui/divider"
3132

3233
import { existsNamespace } from "@/lib/utils/existsNamespace"
3334
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
@@ -168,10 +169,6 @@ const FullLeaderboardContainer = (props: ChildOnlyProp) => (
168169

169170
const On = () => <Box w="8px" h="8px" bg="success400" borderRadius="64px" />
170171

171-
const Divider = () => (
172-
<Box my="16" mx="0" w="10%" h="1" backgroundColor="homeDivider" />
173-
)
174-
175172
const Contact = (props: ChildOnlyProp) => (
176173
<Box
177174
borderRadius="2px"

src/pages/community.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { Image } from "@/components/Image"
2424
import MainArticle from "@/components/MainArticle"
2525
import OldHeading from "@/components/OldHeading"
2626
import PageMetadata from "@/components/PageMetadata"
27+
import { Divider } from "@/components/ui/divider"
2728

2829
import { existsNamespace } from "@/lib/utils/existsNamespace"
2930
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
@@ -79,10 +80,6 @@ const Content = ({ children }: ChildOnlyProp) => {
7980
)
8081
}
8182

82-
const Divider = () => {
83-
return <Box my={16} w="10%" h={1} bgColor="homeDivider" />
84-
}
85-
8683
const Page = ({ children }: ChildOnlyProp) => {
8784
return (
8885
<Flex

src/pages/dapps.tsx

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import {
1414
Box,
1515
Button,
1616
type ButtonProps,
17-
Divider as ChakraDivider,
18-
type DividerProps,
1917
Flex,
2018
type FlexProps,
2119
Heading,
@@ -48,6 +46,7 @@ import ProductListComponent, {
4846
type ProductListProps,
4947
} from "@/components/ProductList"
5048
import Translation from "@/components/Translation"
49+
import { Divider } from "@/components/ui/divider"
5150

5251
import { existsNamespace } from "@/lib/utils/existsNamespace"
5352
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
@@ -137,19 +136,6 @@ const Page = (props: ChildOnlyProp & FlexProps) => (
137136
/>
138137
)
139138

140-
const Divider = (props: DividerProps) => (
141-
<ChakraDivider
142-
opacity={1}
143-
my={16}
144-
w="10%"
145-
borderBottomWidth="0.25rem"
146-
borderColor="homeDivider"
147-
{...props}
148-
/>
149-
)
150-
151-
const CenterDivider = () => <Divider display="flex" justifyContent="center" />
152-
153139
const Content = (props: ChildOnlyProp) => (
154140
<Box py={4} px={8} w="full" {...props} />
155141
)
@@ -1826,7 +1812,7 @@ const DappsPage = () => {
18261812
)}
18271813
{/* General content for all categories */}
18281814
<Content>
1829-
<CenterDivider />
1815+
<Divider />
18301816
{categories[selectedCategory].benefits && (
18311817
<Box mt={12}>
18321818
<H2>

src/pages/eth.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import Text from "@/components/OldText"
3232
import PageMetadata from "@/components/PageMetadata"
3333
import { StandaloneQuizWidget } from "@/components/Quiz/QuizWidget"
3434
import Translation from "@/components/Translation"
35+
import { Divider } from "@/components/ui/divider"
3536

3637
import { existsNamespace } from "@/lib/utils/existsNamespace"
3738
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
@@ -59,10 +60,6 @@ const Content = (props: ChildOnlyProp) => (
5960
<Box w="full" px={8} py={4} {...props} />
6061
)
6162

62-
const Divider = () => (
63-
<Box my={16} mx={0} w="10%" h={1} backgroundColor="homeDivider" />
64-
)
65-
6663
const GrayContainer = (props: ChildOnlyProp) => (
6764
<Box
6865
width="full"

src/pages/gas.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import PageHero from "@/components/PageHero"
4040
import PageMetadata from "@/components/PageMetadata"
4141
import Pill from "@/components/Pill"
4242
import Translation from "@/components/Translation"
43+
import { Divider } from "@/components/ui/divider"
4344

4445
import { existsNamespace } from "@/lib/utils/existsNamespace"
4546
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
@@ -55,10 +56,6 @@ import whatIsEthereumImg from "@/public/images/what-is-ethereum.png"
5556

5657
const Content = (props: BoxProps) => <Box px={8} w="full" {...props} />
5758

58-
const Divider = (props: BoxProps) => (
59-
<Box my={16} w="10%" h={1} bg="homeDivider" {...props} />
60-
)
61-
6259
const Page = (props: FlexProps) => (
6360
<Flex
6461
as={MainArticle}

src/pages/run-a-node.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import PageHero from "@/components/PageHero"
3939
import PageMetadata from "@/components/PageMetadata"
4040
import { StandaloneQuizWidget as QuizWidget } from "@/components/Quiz/QuizWidget"
4141
import Translation from "@/components/Translation"
42+
import { Divider } from "@/components/ui/divider"
4243
import { Stack, VStack } from "@/components/ui/flex"
4344

4445
import { cn } from "@/lib/utils/cn"
@@ -57,8 +58,6 @@ import ethereumInside from "@/public/images/run-a-node/ethereum-inside.png"
5758
import Terminal from "@/public/images/run-a-node/terminal.svg"
5859
import leslie from "@/public/images/upgrades/upgrade_rhino.png"
5960

60-
const Divider = () => <Box my="16" w="10%" h="1" bg="homeDivider" />
61-
6261
const GappedPage = (props: ChildOnlyProp) => (
6362
<Flex
6463
as={MainArticle}

src/pages/stablecoins.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import StablecoinBoxGrid from "@/components/StablecoinBoxGrid"
3535
import StablecoinsTable from "@/components/StablecoinsTable"
3636
import Tooltip from "@/components/Tooltip"
3737
import Translation from "@/components/Translation"
38+
import { Divider } from "@/components/ui/divider"
3839

3940
import { cn } from "@/lib/utils/cn"
4041
import { existsNamespace } from "@/lib/utils/existsNamespace"
@@ -194,8 +195,6 @@ export const getStaticProps = (async ({ locale }) => {
194195

195196
const Content = (props: BoxProps) => <Box py={4} px={8} w="full" {...props} />
196197

197-
const Divider = () => <Box my={16} w="10%" h={1} bg="homeDivider" />
198-
199198
const EditorsChoice = (props: FlexProps) => (
200199
<Flex
201200
flexDirection={{ base: "column-reverse", lg: "row" }}

0 commit comments

Comments
 (0)