Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
uche789 committed Nov 8, 2024
1 parent 00543b5 commit 8146ce1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/features/grammar/components/GrammarType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import categories from "@/lib/categories";
import { ReactNode } from "react";
import { useSearchParams } from "react-router-dom";

interface GrammarTypesProps {
interface GrammarTypesProps {
disabled?: boolean
}

export default function GrammarType() {
export default function GrammarType({ disabled = false }: GrammarTypesProps) {
const [searchParams, setSearchParams] = useSearchParams();

const getClassName = (key: string) => {
Expand Down Expand Up @@ -33,6 +34,7 @@ export default function GrammarType() {
className={getClassName(key)}
key={key}
onClick={() => onClick(key)}
disabled={disabled}
>{key}</button>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/GrammarPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function Practice() {
if (isLoading) return <Loading />
if (error) return <ErrorText text="grammar list" />

if (!data?.length) return <div className="mt-8 text-center">Your grammar list is empty.</div>
if (!searchParams.has('grammarType') && !data?.length) return <div className="mt-8 text-center">Your grammar list is empty.</div>

return <article>
<div className="mb-8">
Expand Down

0 comments on commit 8146ce1

Please sign in to comment.