remove group name from select component. let the parent set group name instead

This commit is contained in:
Erik Sundell
2019-01-02 12:10:19 +01:00
parent 03856b4e55
commit 786df7920e
4 changed files with 46 additions and 20 deletions

View File

@@ -11,7 +11,6 @@ export interface Props {
value: string;
placeholder?: string;
className?: string;
groupName?: string;
variables?: Variable[];
}
@@ -23,7 +22,6 @@ export class MetricSelect extends React.Component<Props, State> {
static defaultProps = {
variables: [],
options: [],
groupName: 'Options',
};
constructor(props) {
@@ -46,15 +44,16 @@ export class MetricSelect extends React.Component<Props, State> {
return nextProps.value !== this.props.value || !_.isEqual(nextOptions, this.state.options);
}
buildOptions({ variables = [], groupName = '', options }) {
buildOptions({ variables = [], options }) {
return variables.length > 0
? [
this.getVariablesGroup(),
{
label: groupName,
expanded: true,
options,
},
// {
// label: groupName,
// expanded: true,
// options,
// },
...options,
]
: options;
}