changed alignment props to anchorOrigin and fixed api-report.md

Signed-off-by: Mehmet Mallı <mehmet.malli@trendyol.com>
This commit is contained in:
Mehmet Mallı
2022-04-28 23:56:03 +03:00
parent c33e5d9de3
commit 545ce687a3
4 changed files with 17 additions and 9 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
'@backstage/core-components': patch
---
Added optional vertical and horizontal alignment props to AlertDisplay
Added optional anchorOrigin alignment prop to AlertDisplay
+8 -3
View File
@@ -51,12 +51,17 @@ import { Theme } from '@material-ui/core/styles';
import { TooltipProps } from '@material-ui/core/Tooltip';
import { WithStyles } from '@material-ui/core/styles';
// Warning: (ae-forgotten-export) The symbol "AlertDisplayProps" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "AlertDisplay" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export function AlertDisplay(props: AlertDisplayProps): JSX.Element | null;
// @public
export type AlertDisplayProps = {
anchorOrigin?: {
vertical: 'top' | 'bottom';
horizontal: 'left' | 'center' | 'right';
};
};
// @public
enum Alignment {
DOWN_LEFT = 'DL',
@@ -34,15 +34,18 @@ import pluralize from 'pluralize';
// TODO: improve on this and promote to a shared component for use by all apps.
export type AlertDisplayProps = {
vertical?: 'top' | 'bottom';
horizontal?: 'left' | 'center' | 'right';
anchorOrigin?: {
vertical: 'top' | 'bottom';
horizontal: 'left' | 'center' | 'right';
};
};
/** @public */
export function AlertDisplay(props: AlertDisplayProps) {
const [messages, setMessages] = useState<Array<AlertMessage>>([]);
const alertApi = useApi(alertApiRef);
const { vertical = 'top', horizontal = 'center' } = props;
const { anchorOrigin = { vertical: 'top', horizontal: 'center' } } = props;
useEffect(() => {
const subscription = alertApi
@@ -65,7 +68,7 @@ export function AlertDisplay(props: AlertDisplayProps) {
};
return (
<Snackbar open anchorOrigin={{ vertical, horizontal }}>
<Snackbar open anchorOrigin={anchorOrigin}>
<Alert
action={
<IconButton
@@ -14,4 +14,4 @@
* limitations under the License.
*/
export { AlertDisplay } from './AlertDisplay';
export * from './AlertDisplay';