Skip to content

Commit 4f5336f

Browse files
committed
show dropdown if axes have names that don't fit into radio button
1 parent d329e84 commit 4f5336f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/fields/AxesSelector.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class AxesSelector extends Component {
2323
localize: _,
2424
} = this.context;
2525
const {axesOptions} = this.props;
26+
const maxCharsThatFitInRadio = 27;
2627
const maxOptions = axesOptions.length > 4; // eslint-disable-line
2728

2829
const multipleSublots =
@@ -42,7 +43,12 @@ class AxesSelector extends Component {
4243
)
4344
: axesOptions;
4445

45-
return maxOptions ? (
46+
const totalCharsInOptions =
47+
(options &&
48+
options.map(o => o.label).reduce((acc, o) => acc + o.length, 0)) ||
49+
0;
50+
51+
return maxOptions || totalCharsInOptions >= maxCharsThatFitInRadio ? (
4652
<Field {...this.props} label={_('Axis to Style')}>
4753
<Dropdown
4854
options={options}

0 commit comments

Comments
 (0)