Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/ColorEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import { ColorPicker, Input, Icon, stylesFactory } from '@grafana/ui';
import { ColorPicker, Input, Icon, useStyles2 } from '@grafana/ui';
import { css } from '@emotion/css';
import { config } from '@grafana/runtime';
import { GrafanaTheme } from '@grafana/data';
import { t } from '@grafana/i18n';
import { GrafanaTheme2 } from '@grafana/data';

export function ColorEditor(props: any) {
const styles = getStyles(config.theme);
const styles = useStyles2(getStyles);
let prefix: React.ReactNode = null;
let suffix: React.ReactNode = null;
const value = props.value || t('ColorEditor.input.value.placeholder', 'Pick Color');
Expand All @@ -18,7 +18,7 @@ export function ColorEditor(props: any) {
<div className={styles.inputPrefix}>
<div className={styles.colorPicker}>
<ColorPicker
color={props.value || config.theme.colors.panelBg}
color={props.value || config.theme2.colors.background.primary}
onChange={props.onChange}
enableNamedColors={true}
/>
Expand All @@ -33,21 +33,21 @@ export function ColorEditor(props: any) {
);
}

const getStyles = stylesFactory((theme: GrafanaTheme) => {
const getStyles = (theme: GrafanaTheme2) => {
return {
colorPicker: css`
padding: 0 ${theme.spacing.sm};
padding: 0 ${theme.spacing(1)};
`,
inputPrefix: css`
display: flex;
align-items: center;
`,
trashIcon: css`
color: ${theme.colors.textWeak};
color: ${theme.colors.text.secondary};
cursor: pointer;
&:hover {
color: ${theme.colors.text};
}
`,
};
});
};
Loading