-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: stackflow, preview, installation
- Loading branch information
1 parent
20ab8a0
commit b780cd5
Showing
64 changed files
with
956 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"recommendations": ["biomejs.biome"] | ||
"recommendations": ["biomejs.biome", "formulahendry.auto-close-tag"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+128 KB
.yarn/cache/@stackflow-plugin-basic-ui-npm-1.8.4-c234a92980-98df6bf718.zip
Binary file not shown.
Binary file removed
BIN
-48.9 KB
.yarn/cache/@stackflow-plugin-history-sync-npm-1.5.0-18b4de062d-c6f2710e02.zip
Binary file not shown.
Binary file added
BIN
+59.8 KB
.yarn/cache/@stackflow-plugin-history-sync-npm-1.6.0-6f9fbcb2ed-70fb8b93ca.zip
Binary file not shown.
Binary file added
BIN
+6.62 KB
.yarn/cache/@stackflow-plugin-renderer-basic-npm-1.1.11-bafa2010dc-38e5383e5f.zip
Binary file not shown.
Binary file removed
BIN
-5.95 KB
.yarn/cache/@stackflow-plugin-renderer-basic-npm-1.1.8-00e9b1d33d-82ddee97f6.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15 KB
.yarn/cache/@vanilla-extract-recipes-npm-0.5.3-520cb7a00b-2ddf10ce34.zip
Binary file not shown.
Binary file renamed
BIN
+73.9 KB
...xer-npm-10.4.19-7c86a73b2f-3a4bc5bace.zip → ...xer-npm-10.4.20-dd5fd05d27-187cec2ec3.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import * as React from "react"; | ||
import { AppScreen } from "@stackflow/plugin-basic-ui"; | ||
import { type ActivityComponentType, useStepFlow, useStack } from "@stackflow/react/future"; | ||
import { BoxButton } from "@/seed-design/ui/box-button"; | ||
|
||
import { AlertDialog as UIAlertDialog } from "@/seed-design/ui/alert-dialog"; | ||
|
||
declare module "@stackflow/config" { | ||
interface Register { | ||
Main: { | ||
alert: boolean; | ||
}; | ||
} | ||
} | ||
|
||
const AlertDialogActivity: ActivityComponentType<"Main"> = ({ params }) => { | ||
const { alert } = params; | ||
const stack = useStack(); | ||
const { pushStep, popStep } = useStepFlow("Main"); | ||
|
||
const appBarLeft = () => <div>Left</div>; | ||
const appBarRight = () => <div>Right</div>; | ||
|
||
const onInteractOutside = () => { | ||
popStep(); | ||
}; | ||
|
||
const onButtonClick = () => { | ||
pushStep({ | ||
alert: true, | ||
}); | ||
}; | ||
|
||
const mainActivitySteps = stack.activities[0].steps; | ||
|
||
return ( | ||
<AppScreen | ||
appBar={{ | ||
renderLeft: appBarLeft, | ||
renderRight: appBarRight, | ||
}} | ||
> | ||
<div | ||
style={{ | ||
position: "relative", | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
height: "100%", | ||
width: "100%", | ||
}} | ||
> | ||
<BoxButton onClick={onButtonClick}>Open</BoxButton> | ||
{alert && ( | ||
<UIAlertDialog | ||
onInteractOutside={onInteractOutside} | ||
title="Title" | ||
description="Description" | ||
/> | ||
)} | ||
</div> | ||
|
||
<div | ||
style={{ | ||
position: "fixed", | ||
bottom: "0", | ||
right: "0", | ||
padding: "8px", | ||
}} | ||
> | ||
<span style={{ fontSize: "12px", color: "var(--seed-semantic-color-divider-3)" }}> | ||
Steps | ||
</span> | ||
{mainActivitySteps.map((step) => ( | ||
<div | ||
style={{ | ||
fontSize: "12px", | ||
width: "1rem", | ||
height: "1rem", | ||
borderRadius: "50%", | ||
border: "1px solid var(--seed-semantic-color-divider-3)", | ||
margin: "8px", | ||
}} | ||
key={step.id} | ||
/> | ||
))} | ||
</div> | ||
|
||
<div | ||
style={{ | ||
position: "fixed", | ||
bottom: "0", | ||
left: "0", | ||
padding: "8px", | ||
zIndex: 1000, | ||
}} | ||
> | ||
<BoxButton onClick={popStep}>Back</BoxButton> | ||
</div> | ||
</AppScreen> | ||
); | ||
}; | ||
|
||
export default AlertDialogActivity; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import * as React from "react"; | ||
import type { ComponentRegistry } from "@/schemas/registry"; | ||
import { Code, Pre, Tabs, Steps } from "nextra/components"; | ||
|
||
interface InstallationProps { | ||
registry: ComponentRegistry; | ||
} | ||
|
||
const Heading3 = ({ children }: { children: React.ReactNode }) => ( | ||
<h3 className="nx-font-semibold nx-tracking-tight nx-text-slate-900 dark:nx-text-slate-100 nx-mt-8 nx-text-2xl"> | ||
{children} | ||
</h3> | ||
); | ||
|
||
/** | ||
* @see https://github.com/shuding/nextra/blob/main/packages/nextra/src/components/pre.tsx | ||
* @type {React.FC<InstallationProps>} | ||
*/ | ||
export function Installation({ registry }: InstallationProps) { | ||
return ( | ||
<Tabs items={["CLI", "Manual"]}> | ||
<Tabs.Tab> | ||
<Pre hasCopyCode data-language="sh" data-theme="default"> | ||
<Code lang="sh" data-language="sh" data-theme="default"> | ||
<span className="line"> | ||
<span style={{ color: "var(--shiki-token-function)" }}>npx </span> | ||
<span style={{ color: "var(--shiki-token-string)" }}>@seed-design/cli@latest </span> | ||
<span style={{ color: "var(--shiki-token-string)" }}>add </span> | ||
<span style={{ color: "var(--shiki-token-string)" }}>{registry.name}</span> | ||
</span> | ||
</Code> | ||
</Pre> | ||
</Tabs.Tab> | ||
<Tabs.Tab> | ||
<Steps> | ||
<Heading3>의존성 설치</Heading3> | ||
<Pre hasCopyCode lang="sh" data-language="sh" data-theme="default"> | ||
<Code lang="sh" data-language="sh" data-theme="default"> | ||
<span className="line"> | ||
<span style={{ color: "var(--shiki-token-function)" }}>npm </span> | ||
<span style={{ color: "var(--shiki-token-string)" }}>install </span> | ||
<span style={{ color: "var(--shiki-token-string)" }}> | ||
{registry.dependencies.join(" ")} | ||
</span> | ||
</span> | ||
</Code> | ||
</Pre> | ||
|
||
<Heading3>아래 코드를 복사 후 붙여넣고 사용하세요</Heading3> | ||
{registry.registries.map((registry) => ( | ||
<Pre hasCopyCode filename={registry.name} key={registry.name}> | ||
<Code>{registry.content}</Code> | ||
</Pre> | ||
))} | ||
</Steps> | ||
</Tabs.Tab> | ||
</Tabs> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import * as React from "react"; | ||
import { Tabs } from "nextra/components"; | ||
|
||
interface PreviewProps { | ||
component: React.ReactNode; | ||
} | ||
|
||
/** | ||
* @description children에는 "코드"를 넣고, component에는 미리보기할 컴포넌트를 넣습니다. | ||
*/ | ||
export const Preview = ({ children, component }: React.PropsWithChildren<PreviewProps>) => { | ||
return ( | ||
<Tabs items={["미리보기", "코드"]}> | ||
<Tabs.Tab> | ||
<div | ||
style={{ | ||
minHeight: "350px", | ||
width: "100%", | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
padding: "10px", | ||
}} | ||
> | ||
{component} | ||
</div> | ||
</Tabs.Tab> | ||
<Tabs.Tab>{children}</Tabs.Tab> | ||
</Tabs> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { makeStack } from "@/stackflow"; | ||
import { type ActivityComponentType } from "@stackflow/react/future"; | ||
import { useSimpleReveal } from "simple-reveal"; | ||
|
||
interface StackflowProps { | ||
Activity: ActivityComponentType<"Main">; | ||
} | ||
|
||
export const Stackflow: React.FC<StackflowProps> = ({ Activity }) => { | ||
const { Stack } = makeStack({ Activity }); | ||
const { cn, ref, style } = useSimpleReveal({ | ||
delay: 200, | ||
rootMargin: "-400px", | ||
initialTransform: "scale(0.95)", | ||
}); | ||
|
||
return ( | ||
<div | ||
ref={ref} | ||
className={cn()} | ||
style={{ | ||
position: "relative", | ||
width: "100%", | ||
display: "flex", | ||
justifyContent: "center", | ||
margin: "3rem 0", | ||
...style, | ||
}} | ||
> | ||
<div | ||
style={{ | ||
width: "100%", | ||
maxWidth: "360px", | ||
height: "640px", | ||
position: "relative", | ||
borderRadius: ".5rem", | ||
overflow: "hidden", | ||
transform: "translate3d(0, 0, 0)", | ||
maskImage: "-webkit-radial-gradient(white, black)", | ||
boxShadow: "0 .25rem 1rem 0 rgba(0, 0, 0, .1)", | ||
border: "1px solid var(--seed-semantic-color-divider-1)", | ||
}} | ||
> | ||
<Stack /> | ||
</div> | ||
</div> | ||
); | ||
}; |
2 changes: 1 addition & 1 deletion
2
component-docs/metadatas/component.mts → component-docs/metadatas/component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,24 +2,36 @@ | |
"name": "component-docs", | ||
"packageManager": "[email protected]", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"dev": "next dev", | ||
"start": "next start", | ||
"build": "yarn generate:registry && next build", | ||
"build:content": "contentlayer2 build", | ||
"generate:registry": "node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generate-registry.mts" | ||
"generate:registry": "node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generate-registry.ts" | ||
}, | ||
"dependencies": { | ||
"@radix-ui/react-slot": "^1.1.0", | ||
"@seed-design/design-token": "1.0.3", | ||
"@seed-design/recipe": "0.0.0", | ||
"@seed-design/stylesheet": "1.0.4", | ||
"@stackflow/config": "^1.1.0", | ||
"@stackflow/core": "^1.0.13", | ||
"@stackflow/plugin-basic-ui": "^1.8.4", | ||
"@stackflow/plugin-history-sync": "^1.6.0", | ||
"@stackflow/plugin-renderer-basic": "^1.1.11", | ||
"@stackflow/react": "^1.2.1", | ||
"next": "^14.2.5", | ||
"nextra": "^2.13.4", | ||
"nextra-theme-docs": "^2.13.4", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
"simple-reveal": "^0.8.0", | ||
"ts-morph": "^23.0.0" | ||
}, | ||
"devDependencies": { | ||
"@seed-design/cli": "workspace:^", | ||
"@types/node": "^20.14.12", | ||
"autoprefixer": "^10.4.19", | ||
"autoprefixer": "^10.4.20", | ||
"chalk": "^5.3.0", | ||
"ts-node": "^10.9.2", | ||
"tslib": "^2.6.3", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import "@seed-design/stylesheet/token.css"; | ||
import "@seed-design/stylesheet/global.css"; | ||
import "@stackflow/plugin-basic-ui/index.css"; | ||
import "simple-reveal/index.css"; | ||
|
||
export default function App({ Component, pageProps }) { | ||
return <Component {...pageProps} />; | ||
} |
Oops, something went wrong.