Taobin-Recipe-Manager/client-electron/src/pages/recipes/select-country.tsx

25 lines
779 B
TypeScript

import { Button } from '@/components/ui/button'
import useLocalStorage from '@/hooks/localStorage'
import { Link } from 'react-router-dom'
import { useShallow } from 'zustand/react/shallow'
const SelectCountryPage: React.FC = () => {
const { recipeQuery, setRecipeQuery } = useLocalStorage(
useShallow(state => ({
recipeQuery: state.recipeQuery,
setRecipeQuery: state.setRecipeQuery
}))
)
return (
<div>
<h1>SelectContryPage</h1>
<Button variant={'link'} onClick={() => setRecipeQuery({ countryID: 'tha', filename: 'coffeethai02_635.json' })}>
Thai
</Button>
{recipeQuery && <Link to={`/recipes/${recipeQuery?.countryID}/${recipeQuery?.filename}`}>Recipes</Link>}
</div>
)
}
export default SelectCountryPage