Browse Source

#95

feature/095
みてるぞ 1 day ago
parent
commit
ea93556952
2 changed files with 29 additions and 24 deletions
  1. +7
    -5
      frontend/src/components/common/SectionTitle.tsx
  2. +22
    -19
      frontend/src/pages/MorePage.tsx

+ 7
- 5
frontend/src/components/common/SectionTitle.tsx View File

@@ -1,9 +1,11 @@
import React from 'react'
import { cn } from '@/lib/utils'

type Props = { children: React.ReactNode }
import type { ComponentPropsWithoutRef, FC } from 'react'

type Props = ComponentPropsWithoutRef<'h2'>

export default ({ children }: Props) => (
<h2 className="text-xl my-4">

export default (({ children, className, ...rest }: Props) => (
<h2 {...rest} className={cn ('text-xl my-4', className)}>
{children}
</h2>)
</h2>)) satisfies FC<Props>

+ 22
- 19
frontend/src/pages/MorePage.tsx View File

@@ -16,28 +16,31 @@ export default (() => {
{ tag: null, wikiId: null, user: { } as User, pathName: location.pathname })

return (
<MainArea>
<MainArea className="md:flex">
<Helmet>
<title>{`メニュー | ${ SITE_TITLE }`}</title>
</Helmet>

{menu.map ((item, i) => (
<section key={i}>
<SectionTitle>{item.name}</SectionTitle>
<ul>
{item.subMenu
.filter (subItem => (subItem.visible ?? true))
.map ((subItem, j) => ('name' in subItem && (
<li key={j}>
<PrefetchLink
to={subItem.to}
target={subItem.to.slice (0, 2) === '//'
? '_blank'
: undefined}>
{subItem.name}
</PrefetchLink>
</li>)))}
</ul>
</section>))}
{[...Array (Math.ceil (menu.length / 4)).keys ()].map (i => (
<div key={i} className="flex-1 mx-16">
{menu.slice (4 * i, 4 * (i + 1)).map ((item, j) => (
<section key={j}>
<SectionTitle className="font-bold">{item.name}</SectionTitle>
<ul>
{item.subMenu
.filter (subItem => (subItem.visible ?? true))
.map ((subItem, k) => ('name' in subItem && (
<li key={k}>
<PrefetchLink
to={subItem.to}
target={subItem.to.slice (0, 2) === '//'
? '_blank'
: undefined}>
{subItem.name}
</PrefetchLink>
</li>)))}
</ul>
</section>))}
</div>))}
</MainArea>)
}) satisfies FC

Loading…
Cancel
Save