-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(deletetile): modal for deleting a tile (#1108)
* feat(tiledelete): new file for tile modal * feat(deletetile): deleting tile modal with functions * chore(deletingtile): added style for deleting tile modal * chore(deletetile): rename of component and added styling * chore(deletetile): edit modal size and button * chore(deltetile): edit style in modal
- Loading branch information
1 parent
500e83a
commit 08933d6
Showing
6 changed files
with
270 additions
and
24 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
50 changes: 50 additions & 0 deletions
50
next-tavla/src/Admin/scenarios/TilesSettings/components/DeleteButton/index.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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { useState } from 'react' | ||
import { ButtonGroup, SecondaryButton } from '@entur/button' | ||
import { Modal } from '@entur/modal' | ||
import { Paragraph } from '@entur/typography' | ||
import { PrimaryButton, TertiaryButton } from '@entur/button' | ||
import { DeleteIcon } from '@entur/icons' | ||
import { useSettingsDispatch } from 'Admin/utils/contexts' | ||
|
||
function DeleteButton({ uuid }: { uuid: string }) { | ||
const dispatch = useSettingsDispatch() | ||
const [isOpen, setOpen] = useState(false) | ||
|
||
return ( | ||
<> | ||
<Modal | ||
open={isOpen} | ||
onDismiss={() => setOpen(false)} | ||
size="small" | ||
align="center" | ||
> | ||
<Paragraph> | ||
Er du sikker på at du vil slette denne holdeplassen? | ||
</Paragraph> | ||
<ButtonGroup> | ||
<SecondaryButton onClick={() => setOpen(false)}> | ||
Avbryt | ||
</SecondaryButton> | ||
<PrimaryButton | ||
onClick={() => { | ||
setOpen(false) | ||
dispatch({ | ||
type: 'removeTile', | ||
tileId: uuid, | ||
}) | ||
}} | ||
> | ||
Ja, slett | ||
</PrimaryButton> | ||
</ButtonGroup> | ||
</Modal> | ||
|
||
<TertiaryButton onClick={() => setOpen(true)}> | ||
<DeleteIcon /> | ||
{'Slett'} | ||
</TertiaryButton> | ||
</> | ||
) | ||
} | ||
|
||
export { DeleteButton } |
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
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
Oops, something went wrong.