Files
Alexander Zobnin d66e72fa67 Migration: Share dashboard/panel modal (#22436)
* ShareModal: refactor dashboard export modal

* Modal: show react modals with appEvents

* ShareModal: embed panel tab

* ShareModal: bind to shortcut (p s)

* grafana-ui: ClipboardButton component

* ShareModal: use ClipboardButton component

* ClipboardButton: add to storybook

* ShareModal: use event-based approach for dashboard share

* ShareModal: remove unused

* ModalReact: pass theme to the component

* ShareModal: styles clean up

* DashboardExporter: fix tests

* fixed whitespace betwen icon and link

* ShareModal: use theme from config

* Modal: tab header refactor

* ShareModal: tests

* ShareModal: fix share url rendering

* ShareModal: remove unused angular files

* Chore: fix strictNullChecks errors

* Modal: provide theme for event-based modal usage

* ShareModal: use ModalsController for opening modal

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-03-03 15:04:28 +03:00

26 lines
636 B
TypeScript

import React, { useContext } from 'react';
import { getModalStyles } from './getModalStyles';
import { IconType } from '../Icon/types';
import { ThemeContext } from '../../themes';
import { Icon } from '../Icon/Icon';
interface Props {
title: string;
icon?: IconType;
}
export const ModalHeader: React.FC<Props> = ({ icon, title, children }) => {
const theme = useContext(ThemeContext);
const styles = getModalStyles(theme);
return (
<>
<h2 className={styles.modalHeaderTitle}>
{icon && <Icon name={icon} className={styles.modalHeaderIcon} />}
{title}
</h2>
{children}
</>
);
};