changed alignment props to anchorOrigin and fixed api-report.md
Signed-off-by: Mehmet Mallı <mehmet.malli@trendyol.com>
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
'@backstage/core-components': patch
|
||||
---
|
||||
|
||||
Added optional vertical and horizontal alignment props to AlertDisplay
|
||||
Added optional anchorOrigin alignment prop to AlertDisplay
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user