-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement dataset removal functionality
- Loading branch information
Showing
8 changed files
with
176 additions
and
72 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
ui/src/common/components/ConfirmPopover/ConfirmPopover.module.scss
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,28 @@ | ||
/* | ||
* Copyright 2024 Open Reaction Database Project Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
.dropdown { | ||
border: none; | ||
box-shadow: 0 4px 24px 0 #00000014; | ||
} | ||
|
||
.alertIcon { | ||
color: #e4626f; | ||
} | ||
|
||
.popoverButton { | ||
padding: 6px 12px; | ||
font-weight: 400; | ||
} |
91 changes: 91 additions & 0 deletions
91
ui/src/common/components/ConfirmPopover/ConfirmPopover.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,91 @@ | ||
/* | ||
* Copyright 2024 Open Reaction Database Project Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { Button, Flex, Popover, type PopoverProps, Text } from '@mantine/core'; | ||
import { AlertCircleIcon } from 'common/icons'; | ||
import classes from './ConfirmPopover.module.scss'; | ||
|
||
interface ConfirmPopoverProps extends PopoverProps { | ||
target: JSX.Element; | ||
title: string; | ||
text: string; | ||
onConfirm: () => void; | ||
onCancel: () => void; | ||
} | ||
|
||
export default function ConfirmPopover({ | ||
target, | ||
title, | ||
text, | ||
onConfirm, | ||
onCancel, | ||
...rest | ||
}: Readonly<ConfirmPopoverProps>) { | ||
return ( | ||
<Popover | ||
classNames={{ | ||
dropdown: classes.dropdown, | ||
}} | ||
offset={16} | ||
withArrow | ||
{...rest} | ||
> | ||
<Popover.Target>{target}</Popover.Target> | ||
|
||
<Popover.Dropdown> | ||
<Flex | ||
direction="column" | ||
gap="16px" | ||
> | ||
<Flex | ||
direction="column" | ||
gap="4px" | ||
> | ||
<Flex | ||
align="center" | ||
gap="4px" | ||
> | ||
<AlertCircleIcon className={classes.alertIcon} /> | ||
<Text fw={700}>{title}</Text> | ||
</Flex> | ||
<Text>{text}</Text> | ||
</Flex> | ||
|
||
<Flex | ||
justify="flex-end" | ||
align="center" | ||
gap="8px" | ||
> | ||
<Button | ||
className={classes.popoverButton} | ||
variant="default" | ||
size="xs" | ||
onClick={onCancel} | ||
> | ||
Cancel | ||
</Button> | ||
<Button | ||
className={classes.popoverButton} | ||
size="xs" | ||
onClick={onConfirm} | ||
> | ||
OK | ||
</Button> | ||
</Flex> | ||
</Flex> | ||
</Popover.Dropdown> | ||
</Popover> | ||
); | ||
} |
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
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