Skip to content

Commit

Permalink
style multi select
Browse files Browse the repository at this point in the history
  • Loading branch information
olegstan committed Sep 26, 2023
1 parent cb8ffd7 commit 17124fa
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/components/Form/MultipleSelect/MultipleSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class MultipleSelect extends BaseInput
{
if (this.wrapperRef && !this.wrapperRef.contains(e.target))
{
console.log(111)
this.handleShowSelect(false);

if(typeof this.props.onOutsideClick === 'function' && this.state.focused === true)
Expand Down Expand Up @@ -78,7 +79,7 @@ class MultipleSelect extends BaseInput
{

}
return require('../../assets/arrow.svg').default.default;
return require('../../assets/arrow.svg').default;
}

handleShowSelect(select)
Expand Down Expand Up @@ -114,17 +115,20 @@ class MultipleSelect extends BaseInput
const { items, handle, selected } = this.props;

let error = this.getError();
let focus = (this.state.hasError ? {'border': '1px solid #FF0000'} : {})

return <Container style={focus} className={this.props.className}>
return <Container
style={this.getContainerStyle()}
className={this.props.className + ' ' + (this.state.select ? 'select' : '')}
>
<InputWrapper ref={this.setWrapperRef} className={'wrapper ' + (this.state.select ? 'select' : '')}>
<Selected id={this.props.id} className='selected' onClick={() => {
<Selected id={this.props.id} className={this.props.className + ' selected'} onClick={() => {
this.handleShowSelect(true);
}}><span>{this.renderSelected()}</span></Selected>
<StyledSelect id={this.props.id + '-multi-select'} className={this.props.className + ' select'} select={this.state.select}>
{this.renderSelectAll()}
{items.map((item, key) => (
<Checkbox
key={key}
id={'item-' + item.id}
text={item.name}
checked={this.props.selected.indexOf(item.id) !== -1}
Expand Down
14 changes: 14 additions & 0 deletions src/components/Form/MultipleSelect/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,27 @@ import {sharedItemStyle, sharedSelectedStyle, sharedSelectStyle, sharedSelectWra

export const InputWrapper = styled.div`
${sharedSelectWrapperStyle}
& > div > span{
border: none;
}
`
export const Selected = styled.div`
${sharedSelectedStyle}
`

export const Select = styled.div`
${sharedSelectStyle}
top: 0;
background-color: #353644;
color: #fff;
div{
color: #fff;
}
`

export const Item = styled.div`
Expand Down
1 change: 0 additions & 1 deletion src/components/Form/Select/Select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ class Select extends BaseInput
return <Container
size={this.props.size}
className={this.props.className + ' ' + (this.state.select ? 'select' : '')}
// style={this.props.style}
style={this.getContainerStyle()}
>
<InputWrapper ref={this.setWrapperRef} className={'wrapper ' + (this.state.select ? 'select' : '')} style={focus} id={this.props.id + '-wrapper'}>
Expand Down
6 changes: 6 additions & 0 deletions src/components/Form/newstyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,12 @@ export const sharedSelectedStyle = css`
color: #4C89FE;
}
&.style6
{
background-color: #333443;
color: #4C89FE;
}
span {
display: block;
text-align: left;
Expand Down

0 comments on commit 17124fa

Please sign in to comment.