-
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.
- Loading branch information
1 parent
1e86c1d
commit e4a401d
Showing
9 changed files
with
523 additions
and
3 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
39 changes: 37 additions & 2 deletions
39
apps/azkaban-admin-ui/src/features/shared/components/layout/dashboard/header.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
26 changes: 26 additions & 0 deletions
26
apps/azkaban-admin-ui/src/features/shared/components/layout/dashboard/notifications.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,26 @@ | ||
import { Notification } from '../../../types'; | ||
import { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover'; | ||
import { NotificationTriggerPartial } from './notifications/notification-trigger'; | ||
|
||
interface Props { | ||
dropdownOpen: boolean; | ||
setDropdownOpen: (value: boolean) => void; | ||
notifications: Array<Notification>; | ||
removeNotification: (id: string) => void; | ||
} | ||
|
||
export function Notifications(props: Props) { | ||
const { dropdownOpen, setDropdownOpen, notifications, removeNotification } = | ||
props; | ||
|
||
return ( | ||
<Popover open={dropdownOpen} onOpenChange={setDropdownOpen}> | ||
<PopoverTrigger> | ||
<NotificationTriggerPartial dropdownOpen={dropdownOpen} /> | ||
</PopoverTrigger> | ||
<PopoverContent className="w-80"> | ||
{JSON.stringify(notifications, null, 4)} | ||
</PopoverContent> | ||
</Popover> | ||
); | ||
} |
31 changes: 31 additions & 0 deletions
31
...ui/src/features/shared/components/layout/dashboard/notifications/notification-trigger.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,31 @@ | ||
interface Props { | ||
dropdownOpen: boolean; | ||
} | ||
|
||
export function NotificationTriggerPartial(props: Props) { | ||
const { dropdownOpen } = props; | ||
|
||
return ( | ||
<div | ||
className={`w-8 h-8 flex items-center justify-center bg-slate-100 hover:bg-slate-200 dark:bg-slate-700 dark:hover:bg-slate-600/80 rounded-full ${ | ||
dropdownOpen && 'bg-slate-200' | ||
}`} | ||
> | ||
<span className="sr-only">Notifications</span> | ||
<svg | ||
className="w-4 h-4" | ||
viewBox="0 0 16 16" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
className="fill-current text-slate-500 dark:text-slate-400" | ||
d="M6.5 0C2.91 0 0 2.462 0 5.5c0 1.075.37 2.074 1 2.922V12l2.699-1.542A7.454 7.454 0 006.5 11c3.59 0 6.5-2.462 6.5-5.5S10.09 0 6.5 0z" | ||
/> | ||
<path | ||
className="fill-current text-slate-400 dark:text-slate-500" | ||
d="M16 9.5c0-.987-.429-1.897-1.147-2.639C14.124 10.348 10.66 13 6.5 13c-.103 0-.202-.018-.305-.021C7.231 13.617 8.556 14 10 14c.449 0 .886-.04 1.307-.11L15 16v-4h-.012C15.627 11.285 16 10.425 16 9.5z" | ||
/> | ||
</svg> | ||
</div> | ||
); | ||
} |
31 changes: 31 additions & 0 deletions
31
apps/azkaban-admin-ui/src/features/shared/components/ui/popover.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,31 @@ | ||
import * as React from 'react'; | ||
import * as PopoverPrimitive from '@radix-ui/react-popover'; | ||
|
||
import { cn } from './utils'; | ||
|
||
const Popover = PopoverPrimitive.Root; | ||
|
||
const PopoverTrigger = PopoverPrimitive.Trigger; | ||
|
||
const PopoverAnchor = PopoverPrimitive.Anchor; | ||
|
||
const PopoverContent = React.forwardRef< | ||
React.ElementRef<typeof PopoverPrimitive.Content>, | ||
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> | ||
>(({ className, align = 'center', sideOffset = 4, ...props }, ref) => ( | ||
<PopoverPrimitive.Portal> | ||
<PopoverPrimitive.Content | ||
ref={ref} | ||
align={align} | ||
sideOffset={sideOffset} | ||
className={cn( | ||
'z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', | ||
className, | ||
)} | ||
{...props} | ||
/> | ||
</PopoverPrimitive.Portal> | ||
)); | ||
PopoverContent.displayName = PopoverPrimitive.Content.displayName; | ||
|
||
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }; |
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,2 +1,3 @@ | ||
export * from './toast.type'; | ||
export * from './error.type'; | ||
export * from './notification.type'; |
7 changes: 7 additions & 0 deletions
7
apps/azkaban-admin-ui/src/features/shared/types/notification.type.ts
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,7 @@ | ||
export type Notification = { | ||
id: string; | ||
icon: string; | ||
title: string; | ||
description: string; | ||
date: string; | ||
}; |
Oops, something went wrong.