mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* Add amroutes * Update table * Recompute items when prop changes * Update styling * Updates * Improvements * Remove unnecessary line * Updates * Updates * Improve code * Add empty area component * Move panel from root route to specific routing * Update from master * Update theme * Implement save * Fixes for PR review * receiver -> contact point * Fixes for PR review * Fixes * Add basic test Co-authored-by: Domas <domasx2@gmail.com>
59 lines
1.4 KiB
TypeScript
59 lines
1.4 KiB
TypeScript
import React, { ButtonHTMLAttributes, FC } from 'react';
|
|
import { css } from '@emotion/css';
|
|
import { GrafanaTheme } from '@grafana/data';
|
|
import { Button, ButtonVariant, IconName, useStyles } from '@grafana/ui';
|
|
|
|
export interface EmptyAreaProps {
|
|
buttonLabel: string;
|
|
onButtonClick: ButtonHTMLAttributes<HTMLButtonElement>['onClick'];
|
|
text: string;
|
|
|
|
buttonIcon?: IconName;
|
|
buttonSize?: 'xs' | 'sm' | 'md' | 'lg';
|
|
buttonVariant?: ButtonVariant;
|
|
}
|
|
|
|
export const EmptyArea: FC<EmptyAreaProps> = ({
|
|
buttonIcon,
|
|
buttonLabel,
|
|
buttonSize = 'lg',
|
|
buttonVariant = 'primary',
|
|
onButtonClick,
|
|
text,
|
|
}) => {
|
|
const styles = useStyles(getStyles);
|
|
|
|
return (
|
|
<div className={styles.container}>
|
|
<p className={styles.text}>{text}</p>
|
|
<Button
|
|
className={styles.button}
|
|
icon={buttonIcon}
|
|
onClick={onButtonClick}
|
|
size={buttonSize}
|
|
type="button"
|
|
variant={buttonVariant}
|
|
>
|
|
{buttonLabel}
|
|
</Button>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
const getStyles = (theme: GrafanaTheme) => {
|
|
return {
|
|
container: css`
|
|
background-color: ${theme.colors.bg2};
|
|
color: ${theme.colors.textSemiWeak};
|
|
padding: ${theme.spacing.xl};
|
|
text-align: center;
|
|
`,
|
|
text: css`
|
|
margin-bottom: ${theme.spacing.md};
|
|
`,
|
|
button: css`
|
|
margin: ${theme.spacing.md} 0 ${theme.spacing.sm};
|
|
`,
|
|
};
|
|
};
|