Skip to content

Commit 69c4050

Browse files
committed
ディレクトリを一番最初に出すようにする
1 parent dda0e55 commit 69c4050

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/client/components/SidebarArticles.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ export const SidebarArticles = ({ items, sortType, articleState }: Props) => {
112112
</span>
113113
</summary>
114114
<ul>
115+
{Object.values(node.children)
116+
.sort((a, b) => a.name.localeCompare(b.name))
117+
.map((child) => renderNode(child, `${path}/${child.name}`))}
118+
115119
{node.items.sort(cmp).map((item) => (
116120
<li key={item.items_show_path}>
117121
<Link css={articlesListItemStyle} to={item.items_show_path}>
@@ -127,10 +131,6 @@ export const SidebarArticles = ({ items, sortType, articleState }: Props) => {
127131
</Link>
128132
</li>
129133
))}
130-
131-
{Object.values(node.children)
132-
.sort((a, b) => a.name.localeCompare(b.name))
133-
.map((child) => renderNode(child, `${path}/${child.name}`))}
134134
</ul>
135135
</details>
136136
</li>
@@ -144,6 +144,10 @@ export const SidebarArticles = ({ items, sortType, articleState }: Props) => {
144144
<span css={articleSectionTitleCountStyle}>{items.length}</span>
145145
</summary>
146146
<ul>
147+
{Object.values(roots)
148+
.sort((a, b) => a.name.localeCompare(b.name))
149+
.map((r) => renderNode(r, r.name))}
150+
147151
{topLevelItems.length > 0 &&
148152
topLevelItems.sort(compare[sortType]).map((item) => (
149153
<li key={item.items_show_path}>
@@ -160,10 +164,6 @@ export const SidebarArticles = ({ items, sortType, articleState }: Props) => {
160164
</Link>
161165
</li>
162166
))}
163-
164-
{Object.values(roots)
165-
.sort((a, b) => a.name.localeCompare(b.name))
166-
.map((r) => renderNode(r, r.name))}
167167
</ul>
168168
</details>
169169
);

0 commit comments

Comments
 (0)