Skip to content

Commit

Permalink
Merge pull request #278 from k35o/refactor
Browse files Browse the repository at this point in the history
簡単なリファクタ
  • Loading branch information
k35o committed Sep 21, 2024
2 parents ac60985 + fb6bdd3 commit d0df22c
Show file tree
Hide file tree
Showing 21 changed files with 85 additions and 127 deletions.
7 changes: 2 additions & 5 deletions src/app/blog/color-contrast/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Metadata } from 'next';
import { BlogLayout } from '../_components/blog-layout/blog-layout';
import { PropsWithChildren } from 'react';

export const metadata: Metadata = {
title: '色のコントラスト比は重要だけどどうやって求めるんだっけ?',
Expand Down Expand Up @@ -28,11 +29,7 @@ export const metadata: Metadata = {
// TODO:pprが利用可能になったら切り替える
export const dynamic = 'force-dynamic';

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<BlogLayout updatedAt="2024/02/12" slug="color-contrast">
{children}
Expand Down
7 changes: 2 additions & 5 deletions src/app/blog/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Link from 'next/link';
import { Heading } from '../../components/heading';
import { ExternalBlog } from './_components/external-blog';
import { PropsWithChildren } from 'react';

export const metadata = {
title: 'Blog',
Expand All @@ -20,11 +21,7 @@ export const metadata = {
},
};

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<>
{/* Get the latest one from: https://katex.org/docs/browser */}
Expand Down
7 changes: 2 additions & 5 deletions src/app/blog/tanstack-router-introduction/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Metadata } from 'next';
import { BlogLayout } from '../_components/blog-layout/blog-layout';
import { PropsWithChildren } from 'react';

export const metadata: Metadata = {
title: 'Reactの新しいルーティングライブラリ、TanStackRouterを学ぶ',
Expand Down Expand Up @@ -30,11 +31,7 @@ export const metadata: Metadata = {
// TODO:pprが利用可能になったら切り替える
export const dynamic = 'force-dynamic';

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<BlogLayout
updatedAt="2023/07/13"
Expand Down
2 changes: 1 addition & 1 deletion src/app/blog/tanstack-router-introduction/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ npm i -D @tanstack/router-devtools@beta
```tsx
const TanStackRouterDevtools = import.meta.env.DEV
? // 遅延読み込みする
React.lazy(() =>
lazy(() =>
import('@tanstack/router-devtools').then((res) => ({
default: res.TanStackRouterDevtools,
})),
Expand Down
4 changes: 3 additions & 1 deletion src/app/characters/check-syntax/_state/text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

import {
createContext,
Dispatch,
FC,
PropsWithChildren,
SetStateAction,
useCallback,
useContext,
useState,
} from 'react';

type Setter<T> = React.Dispatch<React.SetStateAction<T>>;
type Setter<T> = Dispatch<SetStateAction<T>>;
export type ResultMessage = Record<number, string[]>;

const TextContext = createContext<string | undefined>(undefined);
Expand Down
7 changes: 2 additions & 5 deletions src/app/characters/check-syntax/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Heading } from '@/components/heading';
import { CheckSyntaxProvider } from './_state/text';
import { PropsWithChildren } from 'react';

export const metadata = {
title: '日本語校正くん',
Expand All @@ -19,11 +20,7 @@ export const metadata = {
},
};

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<div className="flex h-full flex-col gap-4">
<Heading type="h3">日本語校正くん</Heading>
Expand Down
7 changes: 2 additions & 5 deletions src/app/characters/counter/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Heading } from '@/components/heading';
import { PropsWithChildren } from 'react';

export const metadata = {
title: '文字数カウンター',
Expand All @@ -18,11 +19,7 @@ export const metadata = {
},
};

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<div className="flex h-full flex-col gap-4">
<Heading type="h3">文字数カウンター</Heading>
Expand Down
7 changes: 2 additions & 5 deletions src/app/characters/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Link from 'next/link';
import { Heading } from '../../components/heading';
import { PropsWithChildren } from 'react';

export const metadata = {
title: 'Characters',
Expand All @@ -21,11 +22,7 @@ export const metadata = {
},
};

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<div className="flex h-full flex-col gap-6">
<Link href="/characters">
Expand Down
7 changes: 2 additions & 5 deletions src/app/colors/contrasts/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Heading } from '@/components/heading';
import { PropsWithChildren } from 'react';

export const metadata = {
title: 'コントラスト比チェッカー',
Expand All @@ -18,11 +19,7 @@ export const metadata = {
},
};

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<div className="flex h-full flex-col gap-4">
<Heading type="h3">コントラスト比チェッカー</Heading>
Expand Down
7 changes: 2 additions & 5 deletions src/app/colors/converter/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Heading } from '@/components/heading';
import { PropsWithChildren } from 'react';

export const metadata = {
title: '色変換ツール',
Expand All @@ -18,11 +19,7 @@ export const metadata = {
},
};

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<div className="flex h-full flex-col gap-4">
<Heading type="h3">色変換ツール</Heading>
Expand Down
7 changes: 2 additions & 5 deletions src/app/colors/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Link from 'next/link';
import { Heading } from '../../components/heading';
import { PropsWithChildren } from 'react';

export const metadata = {
title: 'Colors',
Expand All @@ -19,11 +20,7 @@ export const metadata = {
},
};

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<div className="flex h-full flex-col gap-6">
<Link href="/colors">
Expand Down
7 changes: 2 additions & 5 deletions src/app/designs/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Link from 'next/link';
import { Heading } from '@/components/heading';
import { PropsWithChildren } from 'react';

export const metadata = {
title: 'Designs',
Expand All @@ -19,11 +20,7 @@ export const metadata = {
},
};

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<div className="flex h-full flex-col gap-6">
<Link href="/number">
Expand Down
7 changes: 2 additions & 5 deletions src/app/designs/rounded/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Heading } from '@/components/heading';
import { PropsWithChildren } from 'react';

export const metadata = {
title: 'かどまるラボ',
Expand All @@ -18,11 +19,7 @@ export const metadata = {
},
};

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<div className="flex h-full flex-col gap-4">
<Heading type="h3">かどまるラボ</Heading>
Expand Down
7 changes: 2 additions & 5 deletions src/app/engineerings/creating/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Heading } from '@/components/heading';
import { PropsWithChildren } from 'react';

export const metadata = {
title: 'テーブル作成',
Expand All @@ -15,11 +16,7 @@ export const metadata = {
},
};

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<div className="flex flex-col gap-4">
<Heading type="h3">テーブル作成</Heading>
Expand Down
7 changes: 2 additions & 5 deletions src/app/engineerings/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Link from 'next/link';
import { Heading } from '../../components/heading';
import { PropsWithChildren } from 'react';

export const metadata = {
title: 'Engineerings',
Expand All @@ -22,11 +23,7 @@ export const metadata = {
},
};

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<div className="flex flex-col gap-6">
<Link href="/engineerings">
Expand Down
7 changes: 2 additions & 5 deletions src/app/number/converter/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Heading } from '@/components/heading';
import { PropsWithChildren } from 'react';

export const metadata = {
title: '基数変換ツール',
Expand All @@ -18,11 +19,7 @@ export const metadata = {
},
};

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<div className="flex h-full flex-col gap-4">
<Heading type="h3">基数変換ツール</Heading>
Expand Down
7 changes: 2 additions & 5 deletions src/app/number/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Link from 'next/link';
import { Heading } from '../../components/heading';
import { PropsWithChildren } from 'react';

export const metadata = {
title: 'Number',
Expand All @@ -19,11 +20,7 @@ export const metadata = {
},
};

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<div className="flex h-full flex-col gap-6">
<Link href="/number">
Expand Down
7 changes: 2 additions & 5 deletions src/app/quizzes/fish-kanji/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Heading } from '@/components/heading';
import { PropsWithChildren } from 'react';

export const metadata = {
title: 'うおへんクイズ',
Expand All @@ -18,11 +19,7 @@ export const metadata = {
},
};

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<div className="flex h-full flex-col gap-4">
<div className="font-notoSansJp" />
Expand Down
7 changes: 2 additions & 5 deletions src/app/quizzes/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Link from 'next/link';
import { Heading } from '../../components/heading';
import { PropsWithChildren } from 'react';

export const metadata = {
title: 'Quizzes',
Expand All @@ -19,11 +20,7 @@ export const metadata = {
},
};

export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
export default function Layout({ children }: PropsWithChildren) {
return (
<div className="flex h-full flex-col gap-6">
<Link href="/quizzes">
Expand Down
13 changes: 3 additions & 10 deletions src/components/dropdown-menu/dropdown-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
useListNavigation,
} from '@floating-ui/react';
import { ChevronDown } from 'lucide-react';
import { cn } from '@/utils/cn';
import {
MenuContextProvider,
useMenuContent,
Expand All @@ -27,6 +26,7 @@ import clsx from 'clsx';
import { Popover } from '../popover';
import { useFloatingUIContext } from '../popover/hooks';
import { Button } from '../button';
import { IconButton } from '../icon-button';

const Root: FC<PropsWithChildren<{ placement?: Placement }>> = ({
children,
Expand Down Expand Up @@ -142,17 +142,10 @@ const IconTrigger: FC<{
return (
<Popover.Trigger
renderItem={(props) => (
<button
type="button"
className={cn(
'inline-flex rounded-full bg-bgTransparent hover:bg-bgHover focus-visible:ring-2 focus-visible:ring-borderFocus active:bg-bgActive',
'p-2',
)}
{...getTriggerProps(props)}
>
<IconButton {...getTriggerProps(props)}>
<span className="sr-only">{label}</span>
{icon}
</button>
</IconButton>
)}
/>
);
Expand Down
Loading

0 comments on commit d0df22c

Please sign in to comment.