-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds UI to edit an alert <img width="1436" alt="Screenshot 2024-02-29 at 12 49 47 AM" src="https://github.com/PeerDB-io/peerdb/assets/65964360/26d16d3c-44f2-4c52-9410-b095b6ca3a60"> ![Screenshot 2024-03-04 at 8 57 12 PM](https://github.com/PeerDB-io/peerdb/assets/65964360/a45254d9-7033-42cc-b116-e0c282a78350)
- Loading branch information
1 parent
5853e4e
commit b794f19
Showing
8 changed files
with
256 additions
and
35 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { Button } from '@/lib/Button/Button'; | ||
import { Icon } from '@/lib/Icon'; | ||
import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; | ||
import { useState } from 'react'; | ||
import { DropDialog } from './DropDialog'; | ||
const AlertDropdown = ({ | ||
disable, | ||
alertId, | ||
onEdit, | ||
}: { | ||
disable: boolean; | ||
alertId: bigint; | ||
onEdit: () => void; | ||
}) => { | ||
const [open, setOpen] = useState(false); | ||
const handleToggle = () => { | ||
setOpen((prevOpen) => !prevOpen); | ||
}; | ||
|
||
const handleClose = () => { | ||
setOpen(false); | ||
}; | ||
|
||
return ( | ||
<DropdownMenu.Root> | ||
<DropdownMenu.Trigger> | ||
<Button | ||
aria-controls={open ? 'menu-list-grow' : undefined} | ||
aria-haspopup='true' | ||
onClick={handleToggle} | ||
> | ||
<Icon name='menu' /> | ||
</Button> | ||
</DropdownMenu.Trigger> | ||
|
||
<DropdownMenu.Portal> | ||
<DropdownMenu.Content | ||
style={{ | ||
border: '1px solid rgba(0,0,0,0.1)', | ||
borderRadius: '0.5rem', | ||
}} | ||
> | ||
<DropdownMenu.Item> | ||
<Button | ||
variant='normalBorderless' | ||
style={{ width: '100%', fontWeight: 'lighter' }} | ||
onClick={onEdit} | ||
disabled={disable} | ||
> | ||
Edit | ||
</Button> | ||
</DropdownMenu.Item> | ||
<DropdownMenu.Item> | ||
<DropDialog mode='ALERT' dropArgs={{ id: alertId }} /> | ||
</DropdownMenu.Item> | ||
</DropdownMenu.Content> | ||
</DropdownMenu.Portal> | ||
</DropdownMenu.Root> | ||
); | ||
}; | ||
|
||
export default AlertDropdown; |
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.