mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Replace icons in dashboard and settings * Replace icons in alerting * Update batch of icons * Implement icons accross various files * Style updates * Search: Fix recent and starred icons * Update styling and details * Replace new icon created by unicons * Fix e2e test, styling * Minor styling updates Co-authored-by: Clarity-89 <homes89@ukr.net>
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import React from 'react';
|
|
import { Icon } from '../Icon/Icon';
|
|
import { css } from 'emotion';
|
|
|
|
// @ts-ignore
|
|
import RCCascader from 'rc-cascader';
|
|
import { CascaderOption } from '../Cascader/Cascader';
|
|
import { onChangeCascader, onLoadDataCascader } from '../Cascader/optionMappings';
|
|
import { stylesFactory } from '../../themes';
|
|
|
|
export interface ButtonCascaderProps {
|
|
options: CascaderOption[];
|
|
children: string;
|
|
disabled?: boolean;
|
|
value?: string[];
|
|
fieldNames?: { label: string; value: string; children: string };
|
|
|
|
loadData?: (selectedOptions: CascaderOption[]) => void;
|
|
onChange?: (value: string[], selectedOptions: CascaderOption[]) => void;
|
|
onPopupVisibleChange?: (visible: boolean) => void;
|
|
}
|
|
|
|
const getStyles = stylesFactory(() => {
|
|
return {
|
|
popup: css`
|
|
label: popup;
|
|
z-index: 100;
|
|
`,
|
|
};
|
|
});
|
|
|
|
export const ButtonCascader: React.FC<ButtonCascaderProps> = props => {
|
|
const { onChange, loadData, ...rest } = props;
|
|
return (
|
|
<RCCascader
|
|
onChange={onChangeCascader(onChange)}
|
|
loadData={onLoadDataCascader(loadData)}
|
|
popupClassName={getStyles().popup}
|
|
{...rest}
|
|
expandIcon={null}
|
|
>
|
|
<button className="gf-form-label gf-form-label--btn" disabled={props.disabled}>
|
|
{props.children} <Icon name="angle-down" style={{ marginBottom: 0, marginLeft: '4px' }} />
|
|
</button>
|
|
</RCCascader>
|
|
);
|
|
};
|