Skip to content

Commit 689cb44

Browse files
committed
apps > guide, 'Installed' 마크다운 파일 추가 및 렌더링 테스트
1 parent 306ed03 commit 689cb44

16 files changed

Lines changed: 158 additions & 26 deletions

File tree

apps/guide/scripts/syncRegistry.ts

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

apps/guide/src/Router.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ const Router = () => {
1212
<Routes>
1313
<Route path={"/"} element={<h2>Main</h2>} />
1414
<Route path={"/foundations"} element={<h2>Foundations</h2>} />
15+
16+
{routes?.["get-started"]?.map(({ path, importer }, index) => {
17+
let componentName = path.split("get-started/")[1];
18+
componentName =
19+
componentName[0].toUpperCase() + componentName.slice(1);
20+
const LazyElement = lazy(
21+
importer as () => Promise<{ default: ComponentType }>
22+
);
23+
return (
24+
<Route
25+
key={`route-get_started-key-${index}`}
26+
path={path}
27+
element={<LazyElement />}
28+
/>
29+
);
30+
})}
1531
{routes?.foundations?.map(({ path, importer }, index) => {
1632
let componentName = path.split("foundations/")[1];
1733
componentName =

apps/guide/src/layouts/Sidebar.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ export type SidebarMenu = {
77
};
88

99
interface SidebarProps {
10-
menus?: { foundations: SidebarMenu[]; components: SidebarMenu[] };
10+
menus?: {
11+
"get-started": SidebarMenu[];
12+
foundations: SidebarMenu[];
13+
components: SidebarMenu[];
14+
};
1115
}
1216

1317
const sidebarCls = "app-sidebar";
@@ -42,6 +46,24 @@ const Sidebar: FC<SidebarProps> = (props) => {
4246
🇺🇸
4347
</button>
4448
</div>
49+
<Link
50+
className={sidebarGroupMenuCls}
51+
to={"/get-started"}
52+
data-active={pathname === "/get-started"}
53+
>
54+
Get Started
55+
</Link>
56+
{menus?.["get-started"]?.map((menu, index) => (
57+
<Link
58+
key={`sidebar-menu-get_started-key-${index}`}
59+
className={sidebarMenuCls}
60+
data-active={pathname === menu.href}
61+
to={menu.href}
62+
>
63+
{menu.label}
64+
</Link>
65+
))}
66+
<div className={sidebarGroupDividerCls} />
4567
<Link
4668
className={sidebarGroupMenuCls}
4769
to={"/foundations"}

apps/guide/src/layouts/components/CodeBlock.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import { FC } from "react";
66

77
interface CodeBlockProps {
88
code?: string;
9+
noCopy?: boolean;
910
}
10-
const CodeBlock: FC<CodeBlockProps> = ({ code }) => {
11+
const CodeBlock: FC<CodeBlockProps> = (props) => {
12+
const { code, noCopy } = props;
1113
const handleClickCopy = () => {
1214
if (!code) return;
1315
const filteredCode = code.replace(/```[a-zA-Z]+\n|```/g, "");
@@ -16,9 +18,11 @@ const CodeBlock: FC<CodeBlockProps> = ({ code }) => {
1618
if (!code?.trim()) return null;
1719
return (
1820
<div className={"app-guide-codeblock"}>
19-
<div className={"app-guide-codeblock-copy-button"}>
20-
<button onClick={handleClickCopy}>copy</button>
21-
</div>
21+
{noCopy ? null : (
22+
<div className={"app-guide-codeblock-copy-button"}>
23+
<button onClick={handleClickCopy}>copy</button>
24+
</div>
25+
)}
2226
<ReactMarkdown
2327
components={{
2428
code: (props: any) => {

apps/guide/src/layouts/components/GuideTitle.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { FC, PropsWithChildren, useId, useMemo } from "react";
22

3-
type GuideTitleTags = "h2" | "h3";
3+
type GuideTitleTags = "h2" | "h3" | "h4";
44
interface GuideTitleProps extends PropsWithChildren {
55
type?: GuideTitleTags;
66
}
@@ -9,6 +9,7 @@ const getTitleCls = (type: GuideTitleTags) => {
99
const mapTypeToCls: { [key in GuideTitleTags]: string } = {
1010
h2: "app-guide-h2-title",
1111
h3: "app-guide-h3-title",
12+
h4: "app-guide-h4-title",
1213
};
1314
return mapTypeToCls[type];
1415
};

apps/guide/src/layouts/styles/components/guide_title.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,14 @@
1313
margin-bottom: 10px;
1414
font-weight: 400;
1515
}
16+
17+
.app-guide-h4-title {
18+
color: var(--app-main-color);
19+
border-radius: 5px;
20+
width: fit-content;
21+
22+
margin: 0px;
23+
margin-top: 15px;
24+
margin-bottom: 5px;
25+
font-weight: bold;
26+
}

apps/guide/src/layouts/utils/getGuideFiles.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class GuideFiles {
6969
components: CustomRoutes[];
7070
};
7171
readonly routeMenus: {
72+
"get-started": SidebarMenu[];
7273
foundations: SidebarMenu[];
7374
components: SidebarMenu[];
7475
};
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import CodeBlock from "@layouts/components/CodeBlock";
2+
import GuideDivider from "@layouts/components/GuideDivider";
3+
import GuideTitle from "@layouts/components/GuideTitle";
4+
import { GET_STARTED_MARKDOWNS } from "@utils/markdown";
5+
6+
const Installed = () => {
7+
return (
8+
<>
9+
<GuideTitle>Install CLI</GuideTitle>
10+
<CodeBlock
11+
code={GET_STARTED_MARKDOWNS["Installation"]?.Install_Cli ?? ""}
12+
/>
13+
<GuideDivider />
14+
<GuideTitle>Initialize</GuideTitle>
15+
<CodeBlock code={GET_STARTED_MARKDOWNS["Installation"]?.Init ?? ""} />
16+
<GuideTitle type={"h4"}>{`> Select BaseColor`}</GuideTitle>
17+
<CodeBlock
18+
noCopy
19+
code={GET_STARTED_MARKDOWNS["Installation"]?.BaseColor_Prompt ?? ""}
20+
/>
21+
<GuideTitle type={"h4"}>{`> Check created manifest file.`}</GuideTitle>
22+
<CodeBlock
23+
noCopy
24+
code={GET_STARTED_MARKDOWNS["Installation"]?.Created_Manifest ?? ""}
25+
/>
26+
</>
27+
);
28+
};
29+
export default Installed;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
```text
2+
🚀 Start initialize hw-rui-cli...
3+
⠋ Get foundation-manifest from hw-rui-hub...
4+
5+
✔ Succes to fetch foundation-manifest.
6+
7+
? Select from the usable base color.
8+
ASH
9+
❯ FOG
10+
PEBBLE
11+
GRAPHITE
12+
```
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
```json
2+
// hw-rui-manifest.json
3+
{
4+
"tsx": true,
5+
"packageManager": "npm",
6+
"baseColor": "ash",
7+
"timestamp": 1756899539754
8+
}
9+
```

0 commit comments

Comments
 (0)