Welcome.tsx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import { css } from '@emotion/css';
  2. import React, { FC } from 'react';
  3. import { GrafanaTheme } from '@grafana/data';
  4. import { stylesFactory, useTheme } from '@grafana/ui';
  5. const helpOptions = [
  6. { value: 0, label: 'Documentation', href: 'https://grafana.com/docs/grafana/latest' },
  7. { value: 1, label: 'Tutorials', href: 'https://grafana.com/tutorials' },
  8. { value: 2, label: 'Community', href: 'https://community.grafana.com' },
  9. { value: 3, label: 'Public Slack', href: 'http://slack.grafana.com' },
  10. ];
  11. export const WelcomeBanner: FC = () => {
  12. const styles = getStyles(useTheme());
  13. return (
  14. <div className={styles.container}>
  15. <h1 className={styles.title}>Welcome to Grafana</h1>
  16. <div className={styles.help}>
  17. <h3 className={styles.helpText}>Need help?</h3>
  18. <div className={styles.helpLinks}>
  19. {helpOptions.map((option, index) => {
  20. return (
  21. <a
  22. key={`${option.label}-${index}`}
  23. className={styles.helpLink}
  24. href={`${option.href}?utm_source=grafana_gettingstarted`}
  25. >
  26. {option.label}
  27. </a>
  28. );
  29. })}
  30. </div>
  31. </div>
  32. </div>
  33. );
  34. };
  35. const getStyles = stylesFactory((theme: GrafanaTheme) => {
  36. return {
  37. container: css`
  38. display: flex;
  39. /// background: url(public/img/g8_home_v2.svg) no-repeat;
  40. background-size: cover;
  41. height: 100%;
  42. align-items: center;
  43. padding: 0 16px;
  44. justify-content: space-between;
  45. padding: 0 ${theme.spacing.lg};
  46. @media only screen and (max-width: ${theme.breakpoints.lg}) {
  47. background-position: 0px;
  48. flex-direction: column;
  49. align-items: flex-start;
  50. justify-content: center;
  51. }
  52. @media only screen and (max-width: ${theme.breakpoints.sm}) {
  53. padding: 0 ${theme.spacing.sm};
  54. }
  55. `,
  56. title: css`
  57. margin-bottom: 0;
  58. @media only screen and (max-width: ${theme.breakpoints.lg}) {
  59. margin-bottom: ${theme.spacing.sm};
  60. }
  61. @media only screen and (max-width: ${theme.breakpoints.md}) {
  62. font-size: ${theme.typography.heading.h2};
  63. }
  64. @media only screen and (max-width: ${theme.breakpoints.sm}) {
  65. font-size: ${theme.typography.heading.h3};
  66. }
  67. `,
  68. help: css`
  69. display: flex;
  70. align-items: baseline;
  71. `,
  72. helpText: css`
  73. margin-right: ${theme.spacing.md};
  74. margin-bottom: 0;
  75. @media only screen and (max-width: ${theme.breakpoints.md}) {
  76. font-size: ${theme.typography.heading.h4};
  77. }
  78. @media only screen and (max-width: ${theme.breakpoints.sm}) {
  79. display: none;
  80. }
  81. `,
  82. helpLinks: css`
  83. display: flex;
  84. flex-wrap: wrap;
  85. `,
  86. helpLink: css`
  87. margin-right: ${theme.spacing.md};
  88. text-decoration: underline;
  89. text-wrap: no-wrap;
  90. @media only screen and (max-width: ${theme.breakpoints.sm}) {
  91. margin-right: 8px;
  92. }
  93. `,
  94. };
  95. });