LicenseChrome.tsx 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import { css } from '@emotion/css';
  2. import React from 'react';
  3. import { GrafanaTheme } from '@grafana/data';
  4. import { stylesFactory, useTheme } from '@grafana/ui';
  5. const title = { fontWeight: 500, fontSize: '26px', lineHeight: '123%' };
  6. const getStyles = stylesFactory((theme: GrafanaTheme) => {
  7. const backgroundUrl = theme.isDark ? 'public/img/licensing/header_dark.svg' : 'public/img/licensing/header_light.svg';
  8. const footerBg = theme.isDark ? theme.palette.dark9 : theme.palette.gray6;
  9. return {
  10. container: css`
  11. padding: 36px 79px;
  12. background: ${theme.colors.panelBg};
  13. `,
  14. footer: css`
  15. text-align: center;
  16. padding: 16px;
  17. background: ${footerBg};
  18. `,
  19. header: css`
  20. height: 137px;
  21. padding: 40px 0 0 79px;
  22. position: relative;
  23. background: url('${backgroundUrl}') right;
  24. `,
  25. };
  26. });
  27. interface Props {
  28. header: string;
  29. subheader?: string;
  30. editionNotice?: string;
  31. children?: React.ReactNode;
  32. }
  33. export function LicenseChrome({ header, editionNotice, subheader, children }: Props) {
  34. const theme = useTheme();
  35. const styles = getStyles(theme);
  36. return (
  37. <>
  38. <div className={styles.header}>
  39. <h2 style={title}>{header}</h2>
  40. {subheader && <h3>{subheader}</h3>}
  41. <Circle
  42. size="128px"
  43. style={{
  44. boxShadow: '0px 0px 24px rgba(24, 58, 110, 0.45)',
  45. background: '#0A1C36',
  46. position: 'absolute',
  47. top: '19px',
  48. left: '71%',
  49. }}
  50. >
  51. <img
  52. src="public/img/grafana_icon.svg"
  53. alt="Grafana"
  54. width="80px"
  55. style={{ position: 'absolute', left: '23px', top: '20px' }}
  56. />
  57. </Circle>
  58. </div>
  59. <div className={styles.container}>{children}</div>
  60. {editionNotice && <div className={styles.footer}>{editionNotice}</div>}
  61. </>
  62. );
  63. }
  64. interface CircleProps {
  65. size: string;
  66. style?: React.CSSProperties;
  67. }
  68. export const Circle: React.FC<CircleProps> = ({ size, style, children }) => {
  69. return (
  70. <div
  71. style={{
  72. width: size,
  73. height: size,
  74. position: 'absolute',
  75. bottom: 0,
  76. right: 0,
  77. borderRadius: '50%',
  78. ...style,
  79. }}
  80. >
  81. {children}
  82. </div>
  83. );
  84. };