Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-92430 || Update the view based on permissions : Suites, Test, Step #4010

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 40 additions & 35 deletions app/src/components/inputs/inputDropdown/inputDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class InputDropdown extends Component {
independentGroupSelection: PropTypes.bool,
customClasses: PropTypes.object,
title: PropTypes.string,
readOnly: PropTypes.bool,
};

static defaultProps = {
Expand All @@ -70,6 +71,7 @@ export class InputDropdown extends Component {
opened: '',
},
title: '',
readOnly: false,
};
state = {
opened: false,
Expand Down Expand Up @@ -233,48 +235,51 @@ export class InputDropdown extends Component {
error,
touched,
'mobile-disabled': mobileDisabled,
readonly: this.props.readOnly,
})}
onClick={this.onClickSelectBlock}
onClick={this.props.readOnly ? () => {} : this.onClickSelectBlock}
>
<span className={cx('value', customClasses.value)}>{this.displayedValue()}</span>
<span className={cx('arrow', customClasses.arrow)} />
{!this.props.readOnly && <span className={cx('arrow', customClasses.arrow)} />}
</div>
</div>
)}
</Reference>
<Popper
placement="bottom-start"
eventsEnabled={false}
modifiers={{
preventOverflow: { enabled: true },
flip: {
enabled: true,
},
}}
>
{({ placement, ref, style, scheduleUpdate }) => {
this.updatePosition = scheduleUpdate;
return (
<div
ref={ref}
style={style}
data-placement={placement}
className={cx('select-list', customClasses.selectList, {
opened: this.state.opened,
})}
>
{multiple && selectAll && (
<div className={cx('select-all-block')} onClick={this.handleAllClick}>
<span className={cx('select-all')}>All</span>
</div>
)}
<ScrollWrapper autoHeight autoHeightMax={300}>
{this.renderOptions()}
</ScrollWrapper>
</div>
);
}}
</Popper>
{!this.props.readOnly && (
<Popper
placement="bottom-start"
eventsEnabled={false}
modifiers={{
preventOverflow: { enabled: true },
flip: {
enabled: true,
},
}}
>
{({ placement, ref, style, scheduleUpdate }) => {
this.updatePosition = scheduleUpdate;
return (
<div
ref={ref}
style={style}
data-placement={placement}
className={cx('select-list', customClasses.selectList, {
opened: this.state.opened,
})}
>
{multiple && selectAll && (
<div className={cx('select-all-block')} onClick={this.handleAllClick}>
<span className={cx('select-all')}>All</span>
</div>
)}
<ScrollWrapper autoHeight autoHeightMax={300}>
{this.renderOptions()}
</ScrollWrapper>
</div>
);
}}
</Popper>
)}
</div>
</Manager>
);
Expand Down
25 changes: 25 additions & 0 deletions app/src/components/inputs/inputDropdown/inputDropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,25 @@
display: inline-block;
width: 100%;
}

.dropdown {
position: relative;
display: inline-block;
width: 100%;
height: 30px;
}

.opened {
.arrow {
transform: rotate(180deg);
}

.select-block {
border-color: $COLOR--topaz;
box-shadow: 0 0 2px 0 rgba($COLOR--topaz, 0.7);
}
}

.select-block {
display: inline-block;
width: 100%;
Expand All @@ -42,6 +46,7 @@
border: 1px solid $COLOR--gray-80;
background-color: $COLOR--white-two;
cursor: pointer;

&.dark-view {
border: none;
border-radius: 4px;
Expand All @@ -58,20 +63,30 @@
box-shadow: 0 0 2px 0 rgba($COLOR--orange-red, 0.7);
}

&.readonly {
cursor: default;
border: none;
padding-left: 0;
}

&.disabled {
background-color: $COLOR--gray-91;
cursor: default;

& .value.dark-view {
color: $COLOR--dirty-gray;
}

&.dark-view {
background-color: $COLOR--black-1;
}

&:hover {
border-color: $COLOR--gray-80;
}
}
}

.value {
display: inline-block;
height: 100%;
Expand All @@ -83,10 +98,12 @@
text-overflow: ellipsis;
white-space: nowrap;
color: $COLOR--charcoal-grey;

&.dark-view {
color: $COLOR--white-two;
}
}

.arrow {
position: absolute;
right: 12px;
Expand All @@ -101,10 +118,12 @@
box-sizing: border-box;
color: $COLOR--charcoal-grey;
transition: transform 200ms linear;

&.dark-view {
color: $COLOR--white-two;
}
}

.select-list {
position: absolute;
top: 100%;
Expand All @@ -119,16 +138,19 @@
box-shadow: 0 6px 12px $COLOR--gray-80;
z-index: $Z-INDEX-POPUP;
cursor: pointer;

&.dark-view {
background-color: $COLOR--darkmode-gray-400;
color: $COLOR--darkmode-gray-100;
box-shadow: none;
border: 0;
}

&.opened {
display: block;
}
}

.select-all-block {
width: 100%;
height: 37px;
Expand All @@ -144,6 +166,7 @@
box-sizing: border-box;
}
}

.select-all {
display: inline-block;
width: 100%;
Expand All @@ -159,6 +182,7 @@
background-color: $COLOR--tealish-hover;
}
}

.select-item {
width: 100%;
height: 30px;
Expand All @@ -168,6 +192,7 @@
background-color: $COLOR--tealish-hover;
}
}

.mobile-disabled {
@media (max-width: $SCREEN_XS_MAX) {
background-color: $COLOR--gray-91;
Expand Down
Loading
Loading