refactor LiveLogs styles to use object syntax

pull/80080/head
Giordano Ricci 1 year ago
parent ffdec3f6a9
commit 293aa2589f
No known key found for this signature in database
  1. 7
      .betterer.results
  2. 85
      public/app/features/explore/Logs/LiveLogs.tsx

@ -3184,13 +3184,6 @@ exports[`better eslint`] = {
"public/app/features/explore/ContentOutline/ContentOutline.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
],
"public/app/features/explore/Logs/LiveLogs.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"],
[0, 0, 0, "Styles should be written using objects.", "1"],
[0, 0, 0, "Styles should be written using objects.", "2"],
[0, 0, 0, "Styles should be written using objects.", "3"],
[0, 0, 0, "Styles should be written using objects.", "4"]
],
"public/app/features/explore/Logs/Logs.tsx:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Do not use any type assertions.", "1"],

@ -1,4 +1,4 @@
import { css, cx } from '@emotion/css';
import { css, cx, keyframes } from '@emotion/css';
import React, { PureComponent } from 'react';
import tinycolor from 'tinycolor2';
@ -11,46 +11,49 @@ import { sortLogRows } from '../../logs/utils';
import { ElapsedTime } from '../ElapsedTime';
import { filterLogRowsByIndex } from '../state/utils';
const getStyles = (theme: GrafanaTheme2) => ({
logsRowsLive: css`
label: logs-rows-live;
font-family: ${theme.typography.fontFamilyMonospace};
font-size: ${theme.typography.bodySmall.fontSize};
display: flex;
flex-flow: column nowrap;
height: 60vh;
overflow-y: scroll;
:first-child {
margin-top: auto !important;
}
`,
logsRowFade: css`
label: logs-row-fresh;
color: ${theme.colors.text};
background-color: ${tinycolor(theme.colors.info.transparent).setAlpha(0.25).toString()};
animation: fade 1s ease-out 1s 1 normal forwards;
@keyframes fade {
from {
background-color: ${tinycolor(theme.colors.info.transparent).setAlpha(0.25).toString()};
}
to {
background-color: transparent;
}
}
`,
logsRowsIndicator: css`
font-size: ${theme.typography.h6.fontSize};
padding-top: ${theme.spacing(1)};
display: flex;
align-items: center;
`,
button: css`
margin-right: ${theme.spacing(1)};
`,
fullWidth: css`
width: 100%;
`,
});
const getStyles = (theme: GrafanaTheme2) => {
const fade = keyframes({
from: {
backgroundColor: tinycolor(theme.colors.info.transparent).setAlpha(0.25).toString(),
},
to: {
backgroundColor: 'transparent',
},
});
return {
logsRowsLive: css({
label: 'logs-rows-live',
fontFamily: theme.typography.fontFamilyMonospace,
fontSize: theme.typography.bodySmall.fontSize,
display: 'flex',
flexFlow: 'column nowrap',
height: '60vh',
overflowY: 'scroll',
[':first-child']: {
marginTop: `auto !important`,
},
}),
logsRowFade: css({
label: 'logs-row-fresh',
color: theme.colors.text.secondary,
backgroundColor: tinycolor(theme.colors.info.transparent).setAlpha(0.25).toString(),
animation: fade,
}),
logsRowsIndicator: css({
fontSize: theme.typography.h6.fontSize,
paddingTop: theme.spacing(1),
display: 'flex',
alignItems: 'center',
}),
button: css({
marginRight: theme.spacing(1),
}),
fullWidth: css({
width: '100%',
}),
};
};
export interface Props extends Themeable2 {
logRows?: LogRowModel[];

Loading…
Cancel
Save