grafana/public/app/features/alerting/components/EmptyState.tsx
Torkel Ödegaard 10badea19e
Emotion: Upgrades emotion from 10 to 11 and updates all import paths (#32541)
* Babel: Updates babel dependencies to latest version

* Emotion: Upgrade form 10 to 11

* Fixing tests

* Updated to use emotion/css instead in test
2021-04-01 14:15:23 +02:00

38 lines
856 B
TypeScript

import React, { FC, ReactNode } from 'react';
import { css } from '@emotion/css';
import { useStyles } from '@grafana/ui';
import { GrafanaTheme } from '@grafana/data';
interface Props {
title: string;
children: ReactNode | ReactNode[];
}
export const EmptyState: FC<Props> = ({ children, title }) => {
const styles = useStyles(getStyles);
return (
<div className={styles.emptyState}>
<h4 className={styles.emptyStateHeader}>{title}</h4>
{children}
</div>
);
};
const getStyles = (theme: GrafanaTheme) => {
return {
emptyState: css`
color: ${theme.colors.textSemiWeak};
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
`,
emptyStateHeader: css`
color: ${theme.colors.textSemiWeak};
`,
};
};