Skip to content

Commit

Permalink
Readonly props
Browse files Browse the repository at this point in the history
  • Loading branch information
djobbo committed Apr 11, 2024
1 parent 5e83330 commit 4e13fae
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 24 deletions.
8 changes: 4 additions & 4 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export const metadata: Metadata = {
description: "Zenji is a platform for learning Japanese",
}

export default function RootLayout({
children,
}: Readonly<{
type RootLayoutProps = Readonly<{
children: React.ReactNode
}>) {
}>

export default function RootLayout({ children }: RootLayoutProps) {
return (
<html lang="en">
<body className={poppins.className}>{children}</body>
Expand Down
9 changes: 3 additions & 6 deletions app/level/[level]/round/[round]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ const paramsSchema = z.object({
round: z.number({ coerce: true }).int().catch(1),
})

type LevelRoundPageProps = {
params: {
level: string
round: string
}
}
type LevelRoundPageProps = Readonly<{
params: unknown
}>

export default function LevelRoundPage({ params }: LevelRoundPageProps) {
const parsedParams = paramsSchema.safeParse(params)
Expand Down
4 changes: 2 additions & 2 deletions components/CharacterDisplay.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AnimatePresence, motion } from "framer-motion"

type CharacterDisplayProps = {
type CharacterDisplayProps = Readonly<{
character: string
pronounciation?: string
}
}>

export const CharacterDisplay = ({
character,
Expand Down
6 changes: 3 additions & 3 deletions components/Steps/CharacterQuizChoice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { Button } from "@/components/Button"
import { CharacterDisplay } from "@/components/CharacterDisplay"
import { useLevelStore } from "@/store/LevelStore"

type CharacterQuizChoiceStepContentProps = {
type CharacterQuizChoiceStepContentProps = Readonly<{
step: CharacterQuizChoiceStep
}
}>

const Answer = {
None: "None",
Correct: "Correct",
Incorrect: "Incorrect",
}
} as const

type Choice = (typeof Answer)[keyof typeof Answer]

Expand Down
4 changes: 2 additions & 2 deletions components/Steps/Info.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { type InfoStep } from "@/data/levels"
import { Button } from "@/components/Button"

type InfoStepContentProps = {
type InfoStepContentProps = Readonly<{
step: InfoStep
}
}>

export const Info = ({ step }: InfoStepContentProps) => {
return (
Expand Down
4 changes: 2 additions & 2 deletions components/Steps/KeywordChallenge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { useMemo, useState } from "react"
import { Button } from "@/components/Button"
import { checkPronounciation } from "@/util/checkPronounciation"

type KeywordChallengeStepContentProps = {
type KeywordChallengeStepContentProps = Readonly<{
step: KeywordChallengeStep
}
}>

export const KeywordChallenge = ({
step,
Expand Down
4 changes: 2 additions & 2 deletions components/Steps/LearnCharacter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { type LearnCharacterStep } from "@/data/levels"
import { Button } from "@/components/Button"
import { CharacterDisplay } from "@/components/CharacterDisplay"

type LearnCharacterStepContentProps = {
type LearnCharacterStepContentProps = Readonly<{
step: LearnCharacterStep
}
}>

export const LearnCharacter = ({ step }: LearnCharacterStepContentProps) => {
return (
Expand Down
8 changes: 5 additions & 3 deletions store/LevelStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ export const useLevelStore = () => {
return store
}

type LevelStoreProviderProps = {
children: ReactNode
} & SnapshotOut<typeof LevelStore>
type LevelStoreProviderProps = Readonly<
{
children: ReactNode
} & SnapshotOut<typeof LevelStore>
>

export const LevelStoreProvider = ({
children,
Expand Down

0 comments on commit 4e13fae

Please sign in to comment.