Skip to content

Commit

Permalink
Merge pull request #452 from Marukome0743/pr452
Browse files Browse the repository at this point in the history
♻️refactor: define react types
  • Loading branch information
Marukome0743 authored Jul 22, 2024
2 parents acf16a8 + 45b32ef commit 81ad88e
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 33 deletions.
4 changes: 2 additions & 2 deletions app/about/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Heading } from "@/app/components/layout/heading"
import { ABOUT } from "@/app/lib/constant"
import type React from "react"
import type { JSX } from "react"

export default function About(): React.JSX.Element {
export default function About(): JSX.Element {

Check warning on line 5 in app/about/page.tsx

View workflow job for this annotation

GitHub Actions / quality

lint/style/noDefaultExport

Avoid default exports.
return <Heading menu={ABOUT} />
}
4 changes: 2 additions & 2 deletions app/components/button/scrollToTop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import { ChevronDoubleUpIcon } from "@heroicons/react/24/solid"
import { type RefObject, useEffect, useRef, useState } from "react"
import type React from "react"
import type { JSX } from "react"

export function ScrollToTop(): React.JSX.Element {
export function ScrollToTop(): JSX.Element {
const ref: RefObject<HTMLButtonElement> = useRef<HTMLButtonElement>(null)
const scrollBtn: HTMLButtonElement = ref.current as HTMLButtonElement
const [scrollY, setScrollY] = useState<number>(0)
Expand Down
4 changes: 2 additions & 2 deletions app/components/layout/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Image from "next/image"
import Link from "next/link"
import type React from "react"
import type { JSX } from "react"

export function Footer(): React.JSX.Element {
export function Footer(): JSX.Element {
return (
<footer className="footer flex flex-row items-center bg-base-300 justify-center p-4 text-base-content">
<aside>
Expand Down
11 changes: 5 additions & 6 deletions app/components/layout/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import {
SwatchIcon,
} from "@heroicons/react/24/outline"
import Link from "next/link"
import type React from "react"
import { type RefObject, useRef, useState } from "react"
import { type JSX, type RefObject, useRef, useState } from "react"

const themes: Theme[] = [
{ name: "デフォルト", value: "light" },
Expand Down Expand Up @@ -46,7 +45,7 @@ const themes: Theme[] = [
{ name: "サンセット", value: "sunset" },
] as const

export function Header(): React.JSX.Element {
export function Header(): JSX.Element {
const [scrollY, setScrollY] = useState<{
scrollY: number
isScrollDown: boolean
Expand Down Expand Up @@ -89,7 +88,7 @@ export function Header(): React.JSX.Element {
)
}

function DropdownMenu(): React.JSX.Element {
function DropdownMenu(): JSX.Element {
const ref: RefObject<HTMLDetailsElement> = useRef<HTMLDetailsElement>(null)

if (typeof window !== "undefined") {
Expand Down Expand Up @@ -121,7 +120,7 @@ function DropdownMenu(): React.JSX.Element {
)
}

function Navigation(): React.JSX.Element {
function Navigation(): JSX.Element {
return (
<ul className="menu menu-horizontal px-1">
{NAVIGATION.map((menu) => (
Expand All @@ -136,7 +135,7 @@ function Navigation(): React.JSX.Element {
)
}

function ThemeController(): React.JSX.Element {
function ThemeController(): JSX.Element {
return (
<div className="dropdown dropdown-end">
<div tabIndex={0} role="button" className="btn gap-1">
Expand Down
6 changes: 3 additions & 3 deletions app/components/layout/heading.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Menu } from "@/app/interfaces/menu"
import { HomeIcon } from "@heroicons/react/24/solid"
import Link from "next/link"
import type React from "react"
import type { JSX } from "react"

export function Heading({ menu }: Readonly<{ menu: Menu }>): React.JSX.Element {
export function Heading({ menu }: Readonly<{ menu: Menu }>): JSX.Element {
return (
<section className="gap-4 grid">
<Breadcrumb menu={menu} />
Expand All @@ -15,7 +15,7 @@ export function Heading({ menu }: Readonly<{ menu: Menu }>): React.JSX.Element {
)
}

function Breadcrumb({ menu }: Readonly<{ menu: Menu }>): React.JSX.Element {
function Breadcrumb({ menu }: Readonly<{ menu: Menu }>): JSX.Element {
return (
<div className="breadcrumbs pl-6 text-sm">
<ul>
Expand Down
4 changes: 2 additions & 2 deletions app/contact/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Heading } from "@/app/components/layout/heading"
import { CONTACT } from "@/app/lib/constant"
import type React from "react"
import type { JSX } from "react"

export default function Contact(): React.JSX.Element {
export default function Contact(): JSX.Element {

Check warning on line 5 in app/contact/page.tsx

View workflow job for this annotation

GitHub Actions / quality

lint/style/noDefaultExport

Avoid default exports.
return <Heading menu={CONTACT} />
}
4 changes: 2 additions & 2 deletions app/info/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Heading } from "@/app/components/layout/heading"
import { INFO } from "@/app/lib/constant"
import type React from "react"
import type { JSX } from "react"

export default function Info(): React.JSX.Element {
export default function Info(): JSX.Element {

Check warning on line 5 in app/info/page.tsx

View workflow job for this annotation

GitHub Actions / quality

lint/style/noDefaultExport

Avoid default exports.
return <Heading menu={INFO} />
}
4 changes: 2 additions & 2 deletions app/interfaces/menu.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type React from "react"
import type { ElementType } from "react"

export type Menu = {
name: string
href: string
color: string
icon: React.ElementType
icon: ElementType
}
14 changes: 6 additions & 8 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ScrollToTop } from "@/app/components/button/scrollToTop"
import { Footer } from "@/app/components/layout/footer"
import { Header } from "@/app/components/layout/header"
import { SITE_TITLE } from "@/app/lib/constant"
import type { Metadata } from "next"
import type React from "react"
import { Footer } from "./components/layout/footer"
import { Header } from "./components/layout/header"
import type { JSX, ReactNode } from "react"
import "./globals.css"
import { ScrollToTop } from "./components/button/scrollToTop"
import { SITE_TITLE } from "./lib/constant"

export const metadata: Metadata = {
title: SITE_TITLE,
Expand All @@ -14,9 +14,7 @@ export const metadata: Metadata = {

export default function RootLayout({

Check warning on line 15 in app/layout.tsx

View workflow job for this annotation

GitHub Actions / quality

lint/style/noDefaultExport

Avoid default exports.
children,
}: Readonly<{
children: React.ReactNode
}>) {
}: Readonly<{ children: ReactNode }>): JSX.Element {
return (
<html lang="ja">
<body>
Expand Down
4 changes: 2 additions & 2 deletions app/member/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Heading } from "@/app/components/layout/heading"
import { MEMBER } from "@/app/lib/constant"
import type React from "react"
import type { JSX } from "react"

export default function Member(): React.JSX.Element {
export default function Member(): JSX.Element {

Check warning on line 5 in app/member/page.tsx

View workflow job for this annotation

GitHub Actions / quality

lint/style/noDefaultExport

Avoid default exports.
return <Heading menu={MEMBER} />
}
4 changes: 2 additions & 2 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ABOUT, SITE_TITLE } from "@/app/lib/constant"
import Link from "next/link"
import type React from "react"
import type { JSX } from "react"

export default function Home(): React.JSX.Element {
export default function Home(): JSX.Element {

Check warning on line 5 in app/page.tsx

View workflow job for this annotation

GitHub Actions / quality

lint/style/noDefaultExport

Avoid default exports.
return (
<article className="hero min-h-screen bg-[url('/iwate_mountain.avif')]">
<div className="hero-overlay bg-opacity-70" />
Expand Down

0 comments on commit 81ad88e

Please sign in to comment.