Files
grafana/public/app/features/alerting/components/EmptyState.tsx
Peter Holmberg 9ffd88b103 AlertingNG: Refactor the query preview component (#31281)
* refactor to purecomponent

* use subscription in component

* correct onRunQueries

* move more things from render function

* fix issue with no queries

* pr feedback

* revert to FC

* redo some code layout, simplify if

* minor fixes after review
2021-03-15 10:17:21 +01:00

38 lines
851 B
TypeScript

import React, { FC, ReactNode } from 'react';
import { css } from 'emotion';
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};
`,
};
};