-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support add file sync with the folder has different name
- Loading branch information
Showing
82 changed files
with
3,707 additions
and
2,666 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
printWidth: 120, | ||
}; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,127 @@ | ||
import { | ||
ArticleCore, | ||
ArticleHeadNode, | ||
ArticleLineNode, | ||
ArticleLinkNode, | ||
ArticleListNode, | ||
ArticleNodeType, | ||
ArticleSectionNode, | ||
ArticleTextNode, | ||
} from "@/domains/article"; | ||
import { For } from "solid-js"; | ||
import { Dynamic } from "solid-js/web"; | ||
|
||
export function Article(props: { nodes: ArticleCore["children"] }) { | ||
return ( | ||
<For each={props.nodes}> | ||
{(node) => { | ||
if (node.type === ArticleNodeType.Line) { | ||
return <ArticleLine node={node as ArticleLineNode} />; | ||
} | ||
if (node.type === ArticleNodeType.Section) { | ||
return <ArticleSection node={node as ArticleSectionNode} />; | ||
} | ||
return "unknown"; | ||
}} | ||
</For> | ||
); | ||
} | ||
|
||
export function ArticleLine(props: { node: ArticleLineNode }) { | ||
return ( | ||
<p> | ||
<For each={props.node.children}> | ||
{(node) => { | ||
if (node.type === ArticleNodeType.Head) { | ||
return <ArticleHead node={node as ArticleHeadNode} />; | ||
} | ||
if (node.type === ArticleNodeType.Text) { | ||
return <ArticleText node={node as ArticleTextNode} />; | ||
} | ||
if (node.type === ArticleNodeType.Link) { | ||
return <ArticleLink node={node as ArticleLinkNode} />; | ||
} | ||
if (node.type === ArticleNodeType.List) { | ||
return <ArticleList node={node as ArticleListNode} />; | ||
} | ||
return null; | ||
}} | ||
</For> | ||
</p> | ||
); | ||
} | ||
|
||
export function ArticleSection(props: { node: ArticleSectionNode }) { | ||
return ( | ||
<div class="mt-4"> | ||
<For each={props.node.children}> | ||
{(node) => { | ||
return <ArticleLine node={node} />; | ||
}} | ||
</For> | ||
</div> | ||
); | ||
} | ||
|
||
export function ArticleHead(props: { node: ArticleHeadNode }) { | ||
const { | ||
node: { text, level, color }, | ||
} = props; | ||
|
||
const elements = { | ||
1: ( | ||
<h1 class="text-3xl border border-b" style={{ color }}> | ||
{text} | ||
</h1> | ||
), | ||
2: ( | ||
<h2 class="text-2xl border border-b" style={{ color }}> | ||
{text} | ||
</h2> | ||
), | ||
3: ( | ||
<h3 class="text-xl border border-b" style={{ color }}> | ||
{text} | ||
</h3> | ||
), | ||
}; | ||
|
||
return ( | ||
<> | ||
<Dynamic component={elements[level]} /> | ||
</> | ||
); | ||
} | ||
|
||
export function ArticleText(props: { node: ArticleTextNode }) { | ||
const { | ||
node: { color, text }, | ||
} = props; | ||
return <span style={{ color }}>{text}</span>; | ||
} | ||
|
||
export function ArticleLink(props: { node: ArticleLinkNode }) { | ||
const { | ||
node: { text, href }, | ||
} = props; | ||
return <a href={href}>{text}</a>; | ||
} | ||
|
||
export function ArticleList(props: { node: ArticleListNode }) { | ||
const { | ||
node: { children }, | ||
} = props; | ||
return ( | ||
<ol> | ||
<For each={children}> | ||
{(node) => { | ||
return ( | ||
<li> | ||
<ArticleLine node={node} /> | ||
</li> | ||
); | ||
}} | ||
</For> | ||
</ol> | ||
); | ||
} |
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
Oops, something went wrong.