Skip to content

Commit e2fa609

Browse files
authored
Merge pull request #14630 from alexandriaroberts/add_story_tests_for_DocLink_component
Added story for DocLink component [resolves #14595]
2 parents bc1e078 + 6f74897 commit e2fa609

File tree

2 files changed

+60
-3
lines changed

2 files changed

+60
-3
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import * as React from "react"
2+
import { VStack } from "@chakra-ui/react"
3+
import { Meta, StoryObj } from "@storybook/react"
4+
5+
import DocLink from "."
6+
7+
const meta = {
8+
title: "Molecules / Navigation / DocLink",
9+
component: DocLink,
10+
tags: ["autodocs"],
11+
} satisfies Meta<typeof DocLink>
12+
13+
export default meta
14+
15+
type Story = StoryObj<typeof meta>
16+
17+
export const Default: Story = {
18+
args: {
19+
href: "/history/",
20+
children: "History of Ethereum",
21+
},
22+
render: (args) => (
23+
<VStack spacing={4} align="stretch">
24+
<DocLink {...args} />
25+
</VStack>
26+
),
27+
}
28+
29+
export const ExternalLink: Story = {
30+
args: {
31+
href: "https://ethereum.org",
32+
children: "Ethereum Website",
33+
isExternal: true,
34+
},
35+
render: (args) => (
36+
<VStack spacing={4} align="stretch">
37+
<DocLink {...args} />
38+
</VStack>
39+
),
40+
}
41+
42+
export const MultipleLinks: Story = {
43+
args: {
44+
href: "#",
45+
},
46+
render: () => (
47+
<VStack spacing={4} align="stretch">
48+
<DocLink href="/history/">History of Ethereum</DocLink>
49+
<DocLink href="https://ethereum.org" isExternal>
50+
Ethereum Website
51+
</DocLink>
52+
<DocLink href="/developers/docs/intro-to-ethereum/">
53+
Introduction to Ethereum
54+
</DocLink>
55+
</VStack>
56+
),
57+
}

src/components/DocLink.tsx renamed to src/components/DocLink/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { AiOutlineArrowRight } from "react-icons/ai"
22

33
import { cn } from "@/lib/utils/cn"
44

5-
import { Center, Flex, Stack } from "./ui/flex"
6-
import { LinkBox, LinkOverlay } from "./ui/link-box"
7-
import Emoji from "./Emoji"
5+
import Emoji from "../Emoji"
6+
import { Center, Flex, Stack } from "../ui/flex"
7+
import { LinkBox, LinkOverlay } from "../ui/link-box"
88

99
import { useRtlFlip } from "@/hooks/useRtlFlip"
1010

0 commit comments

Comments
 (0)