Skip to content

Commit 6eec5ca

Browse files
authored
feat(ui): select styles namings refactor
1 parent 1011189 commit 6eec5ca

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

src/framework/ui/select/select.component.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export type SelectElement = React.ReactElement<SelectProps>;
8181

8282
interface State {
8383
visible: boolean;
84-
menuWidth: number;
84+
optionsListWidth: number;
8585
}
8686

8787
/**
@@ -437,7 +437,7 @@ class SelectComponent extends React.Component<SelectProps, State> {
437437

438438
public state: State = {
439439
visible: false,
440-
menuWidth: 0,
440+
optionsListWidth: 0,
441441
};
442442

443443
private strategy: SelectionStrategy;
@@ -520,7 +520,7 @@ class SelectComponent extends React.Component<SelectProps, State> {
520520
private onControlMeasure = (result: MeasureResult): void => {
521521
const width: number = result[MEASURED_CONTROL_TAG].size.width;
522522

523-
this.setState({ menuWidth: width });
523+
this.setState({ optionsListWidth: width });
524524
};
525525

526526
private getComponentStyle = (source: StyleType): StyleType => {
@@ -537,7 +537,7 @@ class SelectComponent extends React.Component<SelectProps, State> {
537537
const iconStyles: StyleType = allWithPrefix(source, 'icon');
538538
const textStyles: StyleType = allWithPrefix(source, 'text');
539539
const placeholderStyles: StyleType = allWithPrefix(source, 'placeholder');
540-
const menuStyles: StyleType = allWithPrefix(source, 'menu');
540+
const optionsListStyles: StyleType = allWithPrefix(source, 'optionsList');
541541
const labelStyle: StyleType = allWithPrefix(source, 'label');
542542
const outlineStyles: StyleType = allWithPrefix(source, 'outline');
543543

@@ -577,11 +577,11 @@ class SelectComponent extends React.Component<SelectProps, State> {
577577
padding: outlineStyles.outlinePadding,
578578
borderRadius: outlineStyles.outlineBorderRadius,
579579
},
580-
menu: {
581-
maxHeight: menuStyles.menuMaxHeight,
582-
borderRadius: menuStyles.menuBorderRadius,
583-
borderColor: menuStyles.menuBorderColor,
584-
borderWidth: menuStyles.menuBorderWidth,
580+
optionsList: {
581+
maxHeight: optionsListStyles.optionsListMaxHeight,
582+
borderRadius: optionsListStyles.optionsListBorderRadius,
583+
borderColor: optionsListStyles.optionsListBorderColor,
584+
borderWidth: optionsListStyles.optionsListBorderWidth,
585585
},
586586
label: {
587587
color: labelStyle.labelColor,
@@ -641,16 +641,16 @@ class SelectComponent extends React.Component<SelectProps, State> {
641641
);
642642
};
643643

644-
private renderMenuElement = (style: StyleType): SelectOptionsListElement => {
644+
private renderOptionsListElement = (style: StyleType): SelectOptionsListElement => {
645645
const { appearance, selectedOption, ...restProps } = this.props;
646-
const additionalMenuStyle: StyleType = { width: this.state.menuWidth };
646+
const additionalOptionsListStyle: StyleType = { width: this.state.optionsListWidth };
647647

648648
return (
649649
<SelectOptionsList
650650
{...restProps}
651651
strategy={this.strategy}
652652
key={0}
653-
style={[styles.menu, style, additionalMenuStyle]}
653+
style={[styles.optionsList, style, additionalOptionsListStyle]}
654654
bounces={false}
655655
onSelect={this.onItemSelect}
656656
/>
@@ -695,27 +695,27 @@ class SelectComponent extends React.Component<SelectProps, State> {
695695
const { label } = this.props;
696696

697697
return [
698-
this.renderMenuElement(style.menu),
698+
this.renderOptionsListElement(style.optionsList),
699699
isValidString(label) && this.renderLabelElement(style.label),
700700
this.renderControlElement(),
701701
];
702702
};
703703

704704
public render(): SelectElement {
705705
const { themedStyle, style } = this.props;
706-
const { visible, menuWidth } = this.state;
706+
const { visible, optionsListWidth } = this.state;
707707
const componentStyle: StyleType = this.getComponentStyle(themedStyle);
708-
const [menuElement, labelElement, controlElement] = this.renderComponentChildren(componentStyle);
709-
const additionalMenuStyle: StyleType = { maxWidth: menuWidth };
708+
const [optionsListElement, labelElement, controlElement] = this.renderComponentChildren(componentStyle);
709+
const additionalOptionsListStyle: StyleType = { maxWidth: optionsListWidth };
710710

711711
return (
712712
<View style={style}>
713713
{labelElement}
714714
<View style={[styles.outline, componentStyle.outline]}>
715715
<Popover
716716
visible={visible}
717-
content={menuElement}
718-
style={additionalMenuStyle}
717+
content={optionsListElement}
718+
style={additionalOptionsListStyle}
719719
indicatorStyle={styles.indicator}
720720
onBackdropPress={this.setVisibility}>
721721
{controlElement}
@@ -741,7 +741,7 @@ const styles = StyleSheet.create({
741741
width: 0,
742742
height: 6,
743743
},
744-
menu: {
744+
optionsList: {
745745
flexGrow: 0,
746746
},
747747
outlineContainer: {

src/framework/ui/support/tests/mapping.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,16 +2274,16 @@
22742274
"iconMarginHorizontal": {
22752275
"type": "number"
22762276
},
2277-
"menuMaxHeight": {
2277+
"optionsListMaxHeight": {
22782278
"type": "number"
22792279
},
2280-
"menuBorderRadius": {
2280+
"optionsListBorderRadius": {
22812281
"type": "number"
22822282
},
2283-
"menuBorderColor": {
2283+
"optionsListBorderColor": {
22842284
"type": "string"
22852285
},
2286-
"menuBorderWidth": {
2286+
"optionsListBorderWidth": {
22872287
"type": "number"
22882288
},
22892289
"labelColor": {
@@ -2351,10 +2351,10 @@
23512351
"appearances": {
23522352
"default": {
23532353
"mapping": {
2354-
"menuMaxHeight": 220,
2355-
"menuBorderRadius": 4,
2356-
"menuBorderColor": "border-basic-color-4",
2357-
"menuBorderWidth": 1,
2354+
"optionsListMaxHeight": 220,
2355+
"optionsListBorderRadius": 4,
2356+
"optionsListBorderColor": "border-basic-color-4",
2357+
"optionsListBorderWidth": 1,
23582358
"borderRadius": 4,
23592359
"borderWidth": 1,
23602360
"paddingHorizontal": 8,

0 commit comments

Comments
 (0)