-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NotificationMarker
docs page (#1999)
- Loading branch information
1 parent
bf95d9e
commit c3ae852
Showing
11 changed files
with
191 additions
and
27 deletions.
There are no files selected for viewing
Binary file modified
BIN
-1.1 KB
(81%)
...rkshop/cypress-visual-screenshots/baseline/NotificationMarker.test.ts-Basic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,63 @@ | ||
--- | ||
title: NotificationMarker | ||
description: Shows a notification marker dot at the top right of the component. | ||
thumbnail: #TODO | ||
--- | ||
|
||
<p>{frontmatter.description}</p> | ||
|
||
<LiveExample src='NotificationMarker.main.jsx'> | ||
<AllExamples.NotificationMarkerMainExample client:load /> | ||
</LiveExample> | ||
|
||
## Usage | ||
|
||
The `NotificationMarker` component should be wrapped around the content which needs a marker/dot. This content is usually an icon, and is often used within an [`IconButton`](button#iconbutton). | ||
|
||
```jsx {2, 4} | ||
<IconButton label='Notifications' styleType='borderless'> | ||
<NotificationMarker> | ||
<SvgNotification /> | ||
</NotificationMarker> | ||
</IconButton> | ||
``` | ||
|
||
### Conditional rendering | ||
|
||
There are many situations when the notification marker needs to appear/disappear depending on the application lifetime. Instead of conditionally rendering the `NotificationMarker` in such situations, the `enabled` prop can be used. | ||
|
||
```jsx | ||
<NotificationMarker enabled={notifications.length > 0}>…</NotificationMarker> | ||
``` | ||
|
||
When `enabled` is set to `false`, the DOM element will still be present, but the notification marker will not be displayed visually. | ||
|
||
### Status | ||
|
||
`NotificationMarker`s can have the follow statuses: | ||
|
||
- `primary` (default) | ||
- `positive` | ||
- `warning` | ||
- `negative` | ||
- `white` | ||
|
||
<LiveExample src='NotificationMarker.statuses.jsx'> | ||
<AllExamples.NotificationMarkerStatusesExample client:load /> | ||
</LiveExample> | ||
|
||
The `white` status is used on colored backgrounds, such as when using it in the [high visibility](button#high-visibility) or the [call-to-action](button#call-to-action) buttons. | ||
|
||
### Pulsing | ||
|
||
To give a higher importance to the notification, you can use the `pulsing` prop to show a pulse effect around the marker. | ||
|
||
**Note**: This prop should be used sparingly as it can be distracting to the user. | ||
|
||
<LiveExample src='NotificationMarker.pulsing.jsx'> | ||
<AllExamples.NotificationMarkerPulsingExample client:load /> | ||
</LiveExample> | ||
|
||
## Props | ||
|
||
<PropsTable path={'@itwin/itwinui-react/esm/core/NotificationMarker/NotificationMarker.d.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
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,15 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
* See LICENSE.md in the project root for license terms and full copyright notice. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import * as React from 'react'; | ||
import { NotificationMarker } from '@itwin/itwinui-react'; | ||
import { SvgNotification } from '@itwin/itwinui-icons-react'; | ||
|
||
export default () => { | ||
return ( | ||
<NotificationMarker status='primary'> | ||
<SvgNotification /> | ||
</NotificationMarker> | ||
); | ||
}; |
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,17 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
* See LICENSE.md in the project root for license terms and full copyright notice. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import * as React from 'react'; | ||
import { NotificationMarker, IconButton, Text } from '@itwin/itwinui-react'; | ||
import { SvgNotification } from '@itwin/itwinui-icons-react'; | ||
|
||
export default () => { | ||
return ( | ||
<IconButton label='Notifications' styleType='borderless'> | ||
<NotificationMarker status='negative' pulsing> | ||
<SvgNotification /> | ||
</NotificationMarker> | ||
</IconButton> | ||
); | ||
}; |
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,4 @@ | ||
.demo-container { | ||
display: flex; | ||
column-gap: 10px; | ||
} |
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,49 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
* See LICENSE.md in the project root for license terms and full copyright notice. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import * as React from 'react'; | ||
import { NotificationMarker, IconButton, Text } from '@itwin/itwinui-react'; | ||
import { SvgNotification } from '@itwin/itwinui-icons-react'; | ||
|
||
export default () => { | ||
return ( | ||
<div className='demo-container'> | ||
<IconButton label='Primary' styleType='borderless'> | ||
<NotificationMarker status='primary'> | ||
<SvgNotification /> | ||
</NotificationMarker> | ||
</IconButton> | ||
|
||
<IconButton label='Positive' styleType='borderless'> | ||
<NotificationMarker status='positive'> | ||
<SvgNotification /> | ||
</NotificationMarker> | ||
</IconButton> | ||
|
||
<IconButton label='Warning' styleType='borderless'> | ||
<NotificationMarker status='warning'> | ||
<SvgNotification /> | ||
</NotificationMarker> | ||
</IconButton> | ||
|
||
<IconButton label='Negative' styleType='borderless'> | ||
<NotificationMarker status='negative'> | ||
<SvgNotification /> | ||
</NotificationMarker> | ||
</IconButton> | ||
|
||
<IconButton label='White' styleType='high-visibility'> | ||
<NotificationMarker status='white'> | ||
<SvgNotification /> | ||
</NotificationMarker> | ||
</IconButton> | ||
|
||
<IconButton label='White' styleType='cta'> | ||
<NotificationMarker status='white'> | ||
<SvgNotification /> | ||
</NotificationMarker> | ||
</IconButton> | ||
</div> | ||
); | ||
}; |
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