Skip to content

Commit f4fd6a6

Browse files
committed
refactor: use generic centralised to render markdown with ignored parts
1 parent 4b1f772 commit f4fd6a6

File tree

7 files changed

+31
-27
lines changed

7 files changed

+31
-27
lines changed

packages/docs/pages/src/changelog.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Meta } from "@storybook/blocks";
2-
import { Markdown } from "@storybook/blocks";
2+
import { Markdown } from "@react-ck/story-config";
33
import text from "../../../../CHANGELOG.md?raw";
44

55
<Meta title="Changelog" />
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Meta } from "@storybook/blocks";
2+
import { Markdown } from "@react-ck/story-config";
3+
import text from "../../../../docs/ROADMAP.md?raw";
4+
5+
<Meta title="Roadmap" />
6+
7+
<Markdown>{text}</Markdown>
Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,7 @@
11
import { Meta } from "@storybook/blocks";
2-
import { Markdown } from "@storybook/blocks";
2+
import { Markdown } from "@react-ck/story-config";
33
import text from "../../../../README.md?raw";
44

55
<Meta title="Welcome" />
66

77
<Markdown>{text}</Markdown>
8-
9-
## Story
10-
11-
Born from the culmination of experiences in two diverse design systems within different corporate realms, RCK stands as a labor of love and dedication. Having actively participated in shaping the visual identities of two prominent companies, Mr. Crocodile recognized the need for a platform that not only showcased their knowledge but also served as a valuable resource for fellow developers and designers worldwide. Thus, RCK was conceived – a hub where expertise meets innovation.
12-
13-
## Misson
14-
15-
The RCK mission is simple: to empower developers and designers with a meticulously crafted repository of React components. We understand the challenges faced in the ever-evolving landscape of web development, and our goal is to provide you with a toolkit that not only simplifies your workflow but also enhances the user experience of your projects.
16-
17-
## What RCK Provides
18-
19-
RCK prides itself on its commitment to quality, usability, and versatility. Every component featured here is a result of hands-on experience, industry insights, and a keen eye for detail. Whether you're building a cutting-edge web application or working on a sleek user interface, RCK components are designed to seamlessly integrate, ensuring a smooth development process.
20-
21-
- **Expertly Crafted Components**: Our components are meticulously designed and thoroughly tested, guaranteeing top-notch performance and reliability.
22-
- **Community-Driven**: RCK is more than just a toolkit; it's a community of like-minded developers and designers. Join us in shaping the future of web development.
23-
- **Continuous Innovation**: We are constantly evolving, keeping up with the latest trends and technologies to bring you innovative solutions that stand the test of time.
24-
25-
---
26-
27-
We invite you to explore the world of RCK and witness the difference expertise can make in your projects.
28-
Whether you're a seasoned developer or a budding enthusiast, there's a place for you in this project.
29-
Let's embark on this exciting journey together, where creativity knows no bounds, and excellence is the standard.
30-
31-
Thank you, let's revolutionize the way we build the web, one component at a time.

packages/docs/storybook/addons/package-info/manager.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { type PackageInfo } from "../../scripts/package-info/types";
66
import { useData, UseDataReturn } from "@react-ck/react-hooks/src";
77
import { isPackageInfoList } from "../../scripts/package-info/type-guards";
88
// https://storybook.js.org/docs/react/addons/addon-knowledge-base#storybook-components
9-
import { Markdown } from "@storybook/blocks";
9+
import { Markdown } from "@react-ck/story-config";
1010

1111
const CONFIG = {
1212
id: "package-info",
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React, { useMemo } from "react";
2+
import { Markdown as StorybookMarkdown } from "@storybook/blocks";
3+
4+
export interface MarkdownProps {
5+
children: string;
6+
}
7+
8+
export const Markdown = ({ children }: Readonly<MarkdownProps>): React.ReactElement => {
9+
const computedContent = useMemo(() => {
10+
const [filtered] = children.split("<!-- storybook-ignore -->");
11+
12+
if (!filtered) throw new Error("No content to render");
13+
14+
return filtered;
15+
}, [children]);
16+
17+
return <StorybookMarkdown>{computedContent}</StorybookMarkdown>;
18+
};
File renamed without changes.

packages/infra/story/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from "./configure-story";
2+
3+
export * from "./Markdown";

0 commit comments

Comments
 (0)