-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OK-683 käytetään nuqsia myös sivutusparametrien handlauksee, OphButto…
…n-komponentti sivutuslinkkiin, poistettu custom hook
- Loading branch information
Showing
5 changed files
with
33 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 0 additions & 56 deletions
56
viestinvalitys-raportointi/src/app/hooks/useQueryParams.ts
This file was deleted.
Oops, something went wrong.
37 changes: 16 additions & 21 deletions
37
viestinvalitys-raportointi/src/app/lahetys/[tunniste]/VastaanottajatSivutus.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,35 @@ | ||
'use client'; | ||
import { usePathname } from 'next/navigation'; | ||
import Link from 'next/link'; | ||
import ChevronRightIcon from '@mui/icons-material/ChevronRight'; | ||
import { Button } from '@mui/material'; | ||
import useQueryParams from '@/app/hooks/useQueryParams'; | ||
import { useTranslations } from 'next-intl'; | ||
import { useQueryState } from 'nuqs'; | ||
import { NUQS_DEFAULT_OPTIONS } from '@/app/lib/constants'; | ||
import { OphButton } from '@opetushallitus/oph-design-system'; | ||
|
||
const VastaanottajatSivutus = ({ | ||
seuraavatAlkaen, | ||
sivutusAlkaenParam, | ||
}: { | ||
seuraavatAlkaen?: string; | ||
sivutusAlkaenParam?: string; | ||
}) => { | ||
const pathname = usePathname(); | ||
const { createQueryStrings } = useQueryParams(); | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const [alkaen, setAlkaen] = useQueryState( | ||
'alkaen', | ||
NUQS_DEFAULT_OPTIONS, | ||
); | ||
const t = useTranslations(); | ||
|
||
return seuraavatAlkaen ? ( | ||
<Button | ||
component={Link} | ||
href={ | ||
pathname + | ||
'/?' + | ||
createQueryStrings([ | ||
{ name: 'alkaen', value: seuraavatAlkaen }, | ||
]) | ||
} | ||
return sivutusAlkaenParam ? ( | ||
<OphButton | ||
variant="text" | ||
onClick={() => setAlkaen(sivutusAlkaenParam ?? null)} | ||
aria-label={t('yleinen.sivutus.seuraavat')} | ||
size="large" | ||
endIcon={<ChevronRightIcon />} | ||
prefetch={false} | ||
> | ||
{t('yleinen.sivutus.seuraavat')} | ||
</Button> | ||
</OphButton> | ||
) : ( | ||
<></> | ||
); | ||
|
||
}; | ||
|
||
export default VastaanottajatSivutus; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters