diff --git a/public/app/core/components/Theme/ThemePreview.tsx b/public/app/core/components/Theme/ThemePreview.tsx new file mode 100644 index 00000000000..4d60222dcc6 --- /dev/null +++ b/public/app/core/components/Theme/ThemePreview.tsx @@ -0,0 +1,145 @@ +import { css, cx } from '@emotion/css'; + +import { GrafanaTheme2, ThemeContext } from '@grafana/data'; +import { Box, Divider, Icon, Stack, useStyles2 } from '@grafana/ui'; + +import { Trans } from '../../internationalization'; +import { Branding } from '../Branding/Branding'; + +interface ThemePreviewProps { + theme: GrafanaTheme2; +} + +export function ThemePreview({ theme }: ThemePreviewProps) { + return ( + + + + ); +} + +function ThemePreviewWithContext() { + const styles = useStyles2(getStyles); + + return ( + + + + + +
+ Home + + Dashboards +
+
+ +
+ + + + + +
+
+ Panel +
+ +
+ Form label +
+
+ + +
+
+
+ +
+ + + + ); +} + +const getStyles = (theme: GrafanaTheme2) => { + return { + breadcrumbs: css({ + alignItems: 'center', + color: theme.colors.text.primary, + display: 'flex', + fontSize: Math.round(theme.typography.fontSize / 3), + gap: theme.spacing(0.25), + lineHeight: Math.round(theme.typography.body.lineHeight / 3), + paddingLeft: theme.spacing(0.5), + }), + breadcrumbSeparator: css({ + height: theme.spacing(0.75), + width: theme.spacing(0.75), + }), + img: css({ + height: theme.spacing(1), + width: theme.spacing(1), + }), + panel: css({ + background: theme.components.panel.background, + border: `1px solid ${theme.components.panel.borderColor}`, + borderRadius: theme.shape.radius.default, + display: 'flex', + flexDirection: 'column', + flexGrow: 1, + }), + panelHeader: css({ + alignItems: 'center', + color: theme.colors.text.primary, + display: 'flex', + fontSize: Math.round(theme.typography.fontSize / 3), + height: theme.spacing(2), + lineHeight: Math.round(theme.typography.body.lineHeight / 3), + padding: theme.spacing(0.5), + }), + formLabel: css({ + color: theme.colors.text.primary, + fontSize: Math.round(theme.typography.fontSize / 3), + lineHeight: Math.round(theme.typography.body.lineHeight / 3), + }), + formInput: css({ + background: theme.components.input.background, + border: `1px solid ${theme.colors.border.medium}`, + borderRadius: theme.shape.radius.default, + height: theme.spacing(1), + width: theme.spacing(6), + }), + action: css({ + borderRadius: theme.shape.radius.default, + height: theme.spacing(1), + width: theme.spacing(2.5), + }), + actionSecondary: css({ + background: theme.colors.secondary.main, + }), + actionDanger: css({ + background: theme.colors.error.main, + }), + actionPrimary: css({ + background: theme.colors.primary.main, + }), + }; +}; diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index 6e545aedd6b..a96d829d80d 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -3655,6 +3655,16 @@ "title": "You haven't created any teams yet" } }, + "theme-preview": { + "breadcrumbs": { + "dashboards": "Dashboards", + "home": "Home" + }, + "panel": { + "form-label": "Form label", + "title": "Panel" + } + }, "time-picker": { "absolute": { "recent-title": "Recently used absolute ranges", diff --git a/public/locales/pseudo-LOCALE/grafana.json b/public/locales/pseudo-LOCALE/grafana.json index e8fb5da2873..27833122c61 100644 --- a/public/locales/pseudo-LOCALE/grafana.json +++ b/public/locales/pseudo-LOCALE/grafana.json @@ -3655,6 +3655,16 @@ "title": "Ÿőū ĥävęʼn'ŧ čřęäŧęđ äʼny ŧęämş yęŧ" } }, + "theme-preview": { + "breadcrumbs": { + "dashboards": "Đäşĥþőäřđş", + "home": "Ħőmę" + }, + "panel": { + "form-label": "Főřm ľäþęľ", + "title": "Päʼnęľ" + } + }, "time-picker": { "absolute": { "recent-title": "Ŗęčęʼnŧľy ūşęđ äþşőľūŧę řäʼnģęş",