Split up changeset

Signed-off-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com>
This commit is contained in:
Andre Wanlin
2022-11-11 14:35:33 -06:00
parent 3b55150fa8
commit 9a1864976a
2 changed files with 21 additions and 17 deletions
+20
View File
@@ -0,0 +1,20 @@
---
'@backstage/core-plugin-api': patch
---
Added a new `display` property to the `AlertMessage` which can accept the values `permanent` or `transient`.
Here's a rough example of how to trigger an alert using the new `display` property:
```ts
import { alertApiRef, useApi } from '@backstage/core-plugin-api';
const ExampleTransient = () => {
const alertApi = useApi(alertApiRef);
alertApi.post({
message: 'Example of Transient Alert',
severity: 'success',
display: 'transient',
});
};
```
+1 -17
View File
@@ -1,9 +1,8 @@
---
'@backstage/core-components': patch
'@backstage/core-plugin-api': patch
---
Added an option to allow the `AlertMessage` to be self-closing. This is done with a new `display` property that is set to `transient` on the `AlertMessage`. The length of time that these transient message stay open for can be set using the `transientTimeoutMs` prop on the `AlertDisplay` in the `App.tsx`. Here is an example:
Added an option to allow the `AlertMessage` to be self-closing. This is done with a new `display` property that is set to `transient` on the `AlertMessage` when triggering a message to the `AlertApi`. The length of time that these transient messages stay open for can be set using the `transientTimeoutMs` prop on the `AlertDisplay` in the `App.tsx`. Here is an example:
```diff
const App = () => (
@@ -18,18 +17,3 @@ Added an option to allow the `AlertMessage` to be self-closing. This is done wit
```
The above example will set the transient timeout to 2500ms from the default of 5000ms
Here's a rough example of how to trigger an alert using the new `transient` boolean:
```ts
import { alertApiRef, useApi } from '@backstage/core-plugin-api';
const exampleTransient = () => {
const alertApi = useApi(alertApiRef);
alertApi.post({
message: 'Example of Transient Alert',
severity: 'success',
display: 'transient',
});
};
```