-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated: Notification component updated.
- Loading branch information
1 parent
82f8bb8
commit 16d6e5e
Showing
24 changed files
with
445 additions
and
589 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,41 @@ | ||
import { DefaultNotification, DefaultNotificationCode } from './variant/DefaultNotification' | ||
import { NotificationWithIcon, NotificationWithIconCode } from './variant/NotificationWithIcon' | ||
import { NotificationWithAvatar, NotificationWithAvatarCode } from './variant/NotificationWithAvatar' | ||
import { NotificationPosition, NotificationPositionCode } from './variant/NotificationPosition' | ||
import { NotificationWithCard, NotificationWithCardCode } from './variant/NotificationWithCard' | ||
|
||
import { notificationApi } from './notificationApi' | ||
|
||
import CodePreview from '../../../components/CodePreview' | ||
|
||
import ComponentApi from '../../../components/ComponentApi' | ||
|
||
## Table of Contents | ||
|
||
Notification component in the Keep React allows you to display informative messages or alerts to users. With various styles and options for positioning, you can effectively communicate important updates or messages in a visually appealing manner. | ||
The Notification component in Keep React allows you to deliver informative messages or alerts to users. With versatile styling and positioning options, you can effectively communicate important updates or messages in a visually appealing manner. | ||
|
||
## Default Notification | ||
|
||
Default Notification component in the Keep React allows you to display informative messages or alerts to users. | ||
Display informative messages or alerts to users with the Default Notification component in Keep React. | ||
|
||
<CodePreview github="Notification" code={DefaultNotificationCode}> | ||
<DefaultNotification /> | ||
</CodePreview> | ||
|
||
## Notification With Icon | ||
|
||
The Notification component in the Keep React can be enhanced with icons, providing users with visual cues alongside the message. This combination of text and icon ensures that notifications are both informative and easily comprehensible. | ||
|
||
<CodePreview github="Notification" code={NotificationWithIconCode}> | ||
<NotificationWithIcon /> | ||
</CodePreview> | ||
|
||
## Notification With Avatar | ||
## Notification With Card | ||
|
||
The Notification component in the Keep React can include avatars, allowing you to associate user images with notifications. This integration enhances user recognition and engagement by providing personalized and context-rich notifications. | ||
Enhance the Notification component with a card layout for a more visually appealing display. | ||
|
||
<CodePreview github="Notification" code={NotificationWithAvatarCode}> | ||
<NotificationWithAvatar /> | ||
<CodePreview github="Notification" code={NotificationWithCardCode}> | ||
<NotificationWithCard /> | ||
</CodePreview> | ||
|
||
## Notification With Card | ||
## Notification Position | ||
|
||
The Notification component in the Keep React can be enhanced with a card layout, allowing you to present notifications in a visually structured manner. This design accommodates more content and context, providing users with detailed and informative notifications. | ||
Position notifications according to your preference with available options: `"top-left"`, `"top-right"`, `"bottom-left"`, `"bottom-right"`. Default position is `"bottom-right"`. | ||
|
||
<CodePreview github="Notification" code={NotificationWithCardCode}> | ||
<NotificationWithCard /> | ||
<CodePreview github="Notification" code={NotificationPositionCode}> | ||
<NotificationPosition /> | ||
</CodePreview> | ||
|
||
## API Reference | ||
|
||
Explore the available props for the notification component | ||
Explore the available props for the Notification component. | ||
|
||
<ComponentApi data={notificationApi} /> |
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
101 changes: 101 additions & 0 deletions
101
app/docs/components/notification/variant/NotificationPosition.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,101 @@ | ||
'use client' | ||
import { useState } from 'react' | ||
import { Avatar, Button, Notification } from '../../../../src' | ||
|
||
const NotificationPosition = () => { | ||
const [isOpen, setIsOpen] = useState<boolean>(false) | ||
const [position, setPosition] = useState<'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'>('bottom-right') | ||
const openController = () => setIsOpen(!isOpen) | ||
|
||
return ( | ||
<div className="px-5 py-3"> | ||
<Button.Group> | ||
<Button | ||
onClick={() => { | ||
openController() | ||
setPosition('top-left') | ||
}} | ||
position="start"> | ||
Top Left | ||
</Button> | ||
<Button | ||
onClick={() => { | ||
openController() | ||
setPosition('top-right') | ||
}} | ||
position="center"> | ||
Top Right | ||
</Button> | ||
<Button | ||
onClick={() => { | ||
openController() | ||
setPosition('bottom-left') | ||
}} | ||
position="center"> | ||
Bottom Left | ||
</Button> | ||
<Button | ||
onClick={() => { | ||
openController() | ||
setPosition('bottom-right') | ||
}} | ||
position="end"> | ||
Bottom Right | ||
</Button> | ||
</Button.Group> | ||
<Notification isOpen={isOpen} onClose={openController} position={position}> | ||
<Notification.Body className="max-w-sm p-6"> | ||
<Notification.Content> | ||
<div className="flex items-start gap-2"> | ||
<div> | ||
<Avatar img="/images/avatar/avatar-1.png" className="border-2 border-error-100" /> | ||
</div> | ||
<div className="max-w-[220px]"> | ||
<p className="text-body-4 font-medium text-metal-700"> | ||
Khairul Islam Ridoy comment on your recent posts | ||
</p> | ||
<p className="text-body-5 font-normal text-metal-400">5 min ago</p> | ||
</div> | ||
</div> | ||
</Notification.Content> | ||
</Notification.Body> | ||
</Notification> | ||
</div> | ||
) | ||
} | ||
|
||
const NotificationPositionCode = ` | ||
'use client' | ||
import { useState } from 'react' | ||
import { Avatar, Button, Notification } from 'keep-react' | ||
export const NotificationComponent = () => { | ||
const [isOpen, setIsOpen] = useState(false) | ||
const control = () => setIsOpen(!isOpen) | ||
return ( | ||
<div className="px-5 py-3"> | ||
<Button onClick={control}>Show Notification</Button> | ||
<Notification isOpen={isOpen} onClose={control}> | ||
<Notification.Body className="max-w-sm p-4"> | ||
<Notification.Content> | ||
<div className="flex items-start gap-2"> | ||
<div> | ||
<Avatar img="/images/avatar/avatar-1.png" className="border-2 border-error-100" /> | ||
</div> | ||
<div className="max-w-[220px]"> | ||
<p className="text-body-4 font-medium text-metal-700"> | ||
Khairul Islam Ridoy comment on your recent posts | ||
</p> | ||
<p className="text-body-5 font-normal text-metal-400">5 min ago</p> | ||
</div> | ||
</div> | ||
</Notification.Content> | ||
</Notification.Body> | ||
</Notification> | ||
</div> | ||
) | ||
} | ||
` | ||
|
||
export { NotificationPosition, NotificationPositionCode } |
79 changes: 0 additions & 79 deletions
79
app/docs/components/notification/variant/NotificationWithAvatar.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.