From 9a1864976a025d941f2a9de9bd384e5920c2e759 Mon Sep 17 00:00:00 2001 From: Andre Wanlin <67169551+awanlin@users.noreply.github.com> Date: Fri, 11 Nov 2022 14:35:33 -0600 Subject: [PATCH] Split up changeset Signed-off-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com> --- .changeset/chilled-ladybugs-cough.md | 20 ++++++++++++++++++++ .changeset/strong-rice-warn.md | 18 +----------------- 2 files changed, 21 insertions(+), 17 deletions(-) create mode 100644 .changeset/chilled-ladybugs-cough.md diff --git a/.changeset/chilled-ladybugs-cough.md b/.changeset/chilled-ladybugs-cough.md new file mode 100644 index 0000000000..fd5e3f02b0 --- /dev/null +++ b/.changeset/chilled-ladybugs-cough.md @@ -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', + }); +}; +``` diff --git a/.changeset/strong-rice-warn.md b/.changeset/strong-rice-warn.md index 30207e9d63..da157ddaaf 100644 --- a/.changeset/strong-rice-warn.md +++ b/.changeset/strong-rice-warn.md @@ -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', - }); -}; -```