Skip to content

Commit

Permalink
Fix: missing usused codes #24
Browse files Browse the repository at this point in the history
  • Loading branch information
luckylooky2 committed Apr 7, 2024
1 parent 8d5f831 commit e1436ca
Showing 1 changed file with 59 additions and 58 deletions.
117 changes: 59 additions & 58 deletions public/app/features/variables/pickers/PickerRenderer.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { css } from '@emotion/css';
import React, { PropsWithChildren, ReactElement, useMemo } from 'react';
// import { css } from '@emotion/css';
// import React, { PropsWithChildren, ReactElement, useMemo } from 'react';
import React, { useMemo } from 'react';

import { TypedVariableModel, VariableHide, GrafanaTheme2 } from '@grafana/data';
import { selectors } from '@grafana/e2e-selectors';
import { Tooltip, useStyles2 } from '@grafana/ui';
import { TypedVariableModel, VariableHide } from '@grafana/data';
// import { selectors } from '@grafana/e2e-selectors';
// import { Tooltip, useStyles2 } from '@grafana/ui';

import { variableAdapters } from '../adapters';
import { VARIABLE_PREFIX } from '../constants';
// import { VARIABLE_PREFIX } from '../constants';

interface Props {
variable: TypedVariableModel;
Expand All @@ -31,59 +32,59 @@ export const PickerRenderer = (props: Props) => {
);
};

function PickerLabel({ variable }: PropsWithChildren<Props>): ReactElement | null {
const labelOrName = useMemo(() => variable.label || variable.name, [variable]);
const styles = useStyles2(getStyles);
// function PickerLabel({ variable }: PropsWithChildren<Props>): ReactElement | null {
// const labelOrName = useMemo(() => variable.label || variable.name, [variable]);
// const styles = useStyles2(getStyles);

if (variable.hide !== VariableHide.dontHide) {
return null;
}
// if (variable.hide !== VariableHide.dontHide) {
// return null;
// }

const elementId = VARIABLE_PREFIX + variable.id;
if (variable.description) {
return (
<Tooltip content={variable.description} placement={'bottom'}>
<label
className="gf-form-label gf-form-label--variable"
data-testid={selectors.pages.Dashboard.SubMenu.submenuItemLabels(labelOrName)}
htmlFor={elementId}
>
{labelOrName}
</label>
</Tooltip>
);
}
// const elementId = VARIABLE_PREFIX + variable.id;
// if (variable.description) {
// return (
// <Tooltip content={variable.description} placement={'bottom'}>
// <label
// className="gf-form-label gf-form-label--variable"
// data-testid={selectors.pages.Dashboard.SubMenu.submenuItemLabels(labelOrName)}
// htmlFor={elementId}
// >
// {labelOrName}
// </label>
// </Tooltip>
// );
// }

return (
<label
className={styles.label}
data-testid={selectors.pages.Dashboard.SubMenu.submenuItemLabels(labelOrName)}
htmlFor={elementId}
>
{labelOrName}
</label>
);
}
// return (
// <label
// className={styles.label}
// data-testid={selectors.pages.Dashboard.SubMenu.submenuItemLabels(labelOrName)}
// htmlFor={elementId}
// >
// {labelOrName}
// </label>
// );
// }

const getStyles = (theme: GrafanaTheme2) => {
return {
label: css({
fontFamily: 'inherit',
fontWeight: '500',
fontSize: '14px',
cursor: 'pointer',
appearance: 'none',
userSelect: 'none',
textAlign: 'center',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
height: '32px',
textDecoration: 'none',
padding: '0px 12px',
gap: '8px',
transition: 'color 80ms cubic-bezier(0.65, 0, 0.35, 1) 0s, fill, background-color, border-color',
color: 'grey',
}),
};
};
// const getStyles = (theme: GrafanaTheme2) => {
// return {
// label: css({
// fontFamily: 'inherit',
// fontWeight: '500',
// fontSize: '14px',
// cursor: 'pointer',
// appearance: 'none',
// userSelect: 'none',
// textAlign: 'center',
// display: 'flex',
// alignItems: 'center',
// justifyContent: 'space-between',
// height: '32px',
// textDecoration: 'none',
// padding: '0px 12px',
// gap: '8px',
// transition: 'color 80ms cubic-bezier(0.65, 0, 0.35, 1) 0s, fill, background-color, border-color',
// color: 'grey',
// }),
// };
// };

0 comments on commit e1436ca

Please sign in to comment.