core-components: rearrage AlertDisplay docs

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-12-05 23:49:20 +01:00
parent 64e29da664
commit abb8ee5951
@@ -22,6 +22,19 @@ import { Alert } from '@material-ui/lab';
import pluralize from 'pluralize';
import React, { useEffect, useState } from 'react';
/**
* Properties for {@link AlertDisplay}
*
* @public
*/
export type AlertDisplayProps = {
anchorOrigin?: {
vertical: 'top' | 'bottom';
horizontal: 'left' | 'center' | 'right';
};
transientTimeoutMs?: number;
};
/**
* Displays alerts from {@link @backstage/core-plugin-api#AlertApi}
*
@@ -47,18 +60,6 @@ import React, { useEffect, useState } from 'react';
* <AlertDisplay transientTimeoutMs={10000} />
* ```
*/
// TODO: improve on this and promote to a shared component for use by all apps.
export type AlertDisplayProps = {
anchorOrigin?: {
vertical: 'top' | 'bottom';
horizontal: 'left' | 'center' | 'right';
};
transientTimeoutMs?: number;
};
/** @public */
export function AlertDisplay(props: AlertDisplayProps) {
const [messages, setMessages] = useState<Array<AlertMessage>>([]);
const alertApi = useApi(alertApiRef);