Skip to content

Commit 508d0f1

Browse files
committed
[PR feedback] Use var/const instead of string
1 parent bf312e6 commit 508d0f1

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

packages/eui/src/components/datagrid/controls/display_selector.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ const DensityControl = ({
136136
* Row heights
137137
*/
138138

139+
const rowHeightSelectionOptions = ['auto', 'static'] as const;
139140
const convertRowHeightsOptionsToSelection = (
140141
rowHeightsOptions: EuiDataGridRowHeightsOptions
141142
) => {
@@ -150,9 +151,9 @@ const convertRowHeightsOptionsToSelection = (
150151
}
151152

152153
if (defaultHeight === 'auto') {
153-
return 'auto';
154+
return rowHeightSelectionOptions[0];
154155
}
155-
return 'static';
156+
return rowHeightSelectionOptions[1];
156157
};
157158
const RowHeightControl = ({
158159
rowHeightsOptions,
@@ -202,9 +203,9 @@ const RowHeightControl = ({
202203
rowHeights: {}, // Unset all row-specific heights
203204
};
204205

205-
if (option === 'auto') {
206+
if (option === rowHeightSelectionOptions[0]) {
206207
rowHeightsOptions.defaultHeight = 'auto';
207-
} else if (option === 'static') {
208+
} else if (option === rowHeightSelectionOptions[1]) {
208209
const lineCount = Number(lineCountInput);
209210

210211
if (lineCount > 1) {
@@ -238,8 +239,8 @@ const RowHeightControl = ({
238239
buttonSize="compressed"
239240
isFullWidth
240241
options={[
241-
{ id: 'auto', label: labelAuto },
242-
{ id: 'static', label: labelStatic },
242+
{ id: rowHeightSelectionOptions[0], label: labelAuto },
243+
{ id: rowHeightSelectionOptions[1], label: labelStatic },
243244
]}
244245
onChange={setRowHeight}
245246
idSelected={rowHeightSelection}
@@ -250,7 +251,7 @@ const RowHeightControl = ({
250251
compressed
251252
min={1}
252253
max={20}
253-
disabled={rowHeightSelection !== 'static'}
254+
disabled={rowHeightSelection !== rowHeightSelectionOptions[1]}
254255
value={lineCountInput}
255256
onChange={setLineCountHeight}
256257
data-test-subj="lineCountNumber"

0 commit comments

Comments
 (0)