Skip to content

Commit

Permalink
* Disabled wrap-around navigering på bestillingsdetaljer og setter kn…
Browse files Browse the repository at this point in the history
…app til disabled dersom man er på første eller siste og prøver å navigere tilbake eller frem

#deploy-test-frontend
  • Loading branch information
stigus committed Jun 20, 2024
1 parent ccb649e commit b9aeb89
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export const BestillingSammendragModal = ({ bestillinger }) => {

const handleChangeBestilling = (index: number) => {
if (index < 0) {
setAktivIndex(bestillinger.length - 1)
} else if (index >= bestillinger.length) {
setAktivIndex(0)
} else if (index >= bestillinger.length) {
setAktivIndex(bestillinger.length - 1)
} else {
setAktivIndex(index)
}
Expand All @@ -60,6 +60,7 @@ export const BestillingSammendragModal = ({ bestillinger }) => {
variant={'tertiary'}
title="Forrige bestilling"
icon={<ArrowLeftIcon aria-hidden />}
disabled={aktivIndex === 0}
onClick={() => handleChangeBestilling(aktivIndex - 1)}
/>
<h1 style={{ marginTop: '10px', borderBottom: 'unset' }}>
Expand All @@ -69,6 +70,7 @@ export const BestillingSammendragModal = ({ bestillinger }) => {
variant={'tertiary'}
title="Neste bestilling"
icon={<ArrowRightIcon aria-hidden />}
disabled={aktivIndex === bestillinger.length - 1}
onClick={() => handleChangeBestilling(aktivIndex + 1)}
/>
</div>
Expand Down

0 comments on commit b9aeb89

Please sign in to comment.