Chore: Rewrite grafana-sql css using object styles (#87052)

This commit is contained in:
kay delaney
2024-04-29 22:34:10 +01:00
committed by GitHub
parent e3719471d5
commit 8bb9b06e48
4 changed files with 45 additions and 59 deletions
@@ -20,31 +20,31 @@ export function QueryToolbox({ showTools, onFormatCode, onExpand, isExpanded, ..
const styles = useMemo(() => {
return {
container: css`
border: 1px solid ${theme.colors.border.medium};
border-top: none;
padding: ${theme.spacing(0.5, 0.5, 0.5, 0.5)};
display: flex;
flex-grow: 1;
justify-content: space-between;
font-size: ${theme.typography.bodySmall.fontSize};
`,
error: css`
color: ${theme.colors.error.text};
font-size: ${theme.typography.bodySmall.fontSize};
font-family: ${theme.typography.fontFamilyMonospace};
`,
valid: css`
color: ${theme.colors.success.text};
`,
info: css`
color: ${theme.colors.text.secondary};
`,
hint: css`
color: ${theme.colors.text.disabled};
white-space: nowrap;
cursor: help;
`,
container: css({
border: `1px solid ${theme.colors.border.medium}`,
borderTop: 'none',
padding: theme.spacing(0.5, 0.5, 0.5, 0.5),
display: 'flex',
flexGrow: 1,
justifyContent: 'space-between',
fontSize: theme.typography.bodySmall.fontSize,
}),
error: css({
color: theme.colors.error.text,
fontSize: theme.typography.bodySmall.fontSize,
fontFamily: theme.typography.fontFamilyMonospace,
}),
valid: css({
color: theme.colors.success.text,
}),
info: css({
color: theme.colors.text.secondary,
}),
hint: css({
color: theme.colors.text.disabled,
whiteSpace: 'nowrap',
cursor: 'help',
}),
};
}, [theme]);
@@ -22,17 +22,17 @@ export function QueryValidator({ db, query, onValidate, range }: QueryValidatorP
const styles = useMemo(() => {
return {
error: css`
color: ${theme.colors.error.text};
font-size: ${theme.typography.bodySmall.fontSize};
font-family: ${theme.typography.fontFamilyMonospace};
`,
valid: css`
color: ${theme.colors.success.text};
`,
info: css`
color: ${theme.colors.text.secondary};
`,
error: css({
color: theme.colors.error.text,
fontSize: theme.typography.bodySmall.fontSize,
fontFamily: theme.typography.fontFamilyMonospace,
}),
valid: css({
color: theme.colors.success.text,
}),
info: css({
color: theme.colors.text.secondary,
}),
};
}, [theme]);
@@ -114,13 +114,13 @@ export function RawEditor({ db, query, onChange, onRunQuery, onValidate, queryTo
function getStyles(theme: GrafanaTheme2) {
return {
modal: css`
width: 95vw;
height: 95vh;
`,
modalContent: css`
height: 100%;
padding-top: 0;
`,
modal: css({
width: '95vw',
height: '95vh',
}),
modalContent: css({
height: '100%',
paddingTop: 0,
}),
};
}