react-select 라이브러리 수정
This commit is contained in:
parent
2093c5ada3
commit
662bdd413b
@ -33,9 +33,32 @@ export default function ReactSelect(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const CustomOption = (props) => {
|
||||||
|
const { data, innerRef, innerProps, isSelected, isFocused, isDisabled } = props;
|
||||||
|
const customClass = data.value === '6' ? 'special-option' : '';
|
||||||
|
|
||||||
|
// 기본 선택/호버 상태 적용
|
||||||
|
const optionClass = `${customClass} ${isSelected ? 'custom__option--is-selected' : ''}
|
||||||
|
${isFocused ? 'custom__option--is-focused' : ''}
|
||||||
|
${isDisabled ? 'custom__option--is-disabled' : ''}`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
ref={innerRef}
|
||||||
|
{...innerProps}
|
||||||
|
className={`custom__option ${optionClass}`}
|
||||||
|
>
|
||||||
|
{data.label}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<Select
|
<Select
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
instanceId="react-select-unique-id"
|
||||||
className='react-select-custom'
|
className='react-select-custom'
|
||||||
classNamePrefix='custom'
|
classNamePrefix='custom'
|
||||||
options={selectOption}
|
options={selectOption}
|
||||||
@ -44,6 +67,7 @@ export default function ReactSelect(){
|
|||||||
placeholder="敬称選択"
|
placeholder="敬称選択"
|
||||||
isClearable={true}
|
isClearable={true}
|
||||||
menuPlacement={'auto'}
|
menuPlacement={'auto'}
|
||||||
|
components={{Option: CustomOption}}
|
||||||
// isDisabled={true}
|
// isDisabled={true}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -912,10 +912,23 @@ input[type=text]{
|
|||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
padding: 7px 10px;
|
padding: 7px 10px;
|
||||||
color: #45576F;
|
color: #45576F;
|
||||||
|
|
||||||
}
|
}
|
||||||
.custom__option--is-selected{
|
.custom__option--is-selected{
|
||||||
|
background-color: #2684FF;
|
||||||
|
color: #fff !important;
|
||||||
|
&.custom__option--is-focused{
|
||||||
|
background-color: #2684FF;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
.custom__option--is-focused{
|
||||||
|
background-color: #DEEBFF;
|
||||||
|
color: #45576F;
|
||||||
|
}
|
||||||
|
.special-option{
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
// disable
|
// disable
|
||||||
&.custom--is-disabled{
|
&.custom--is-disabled{
|
||||||
.custom__control{
|
.custom__control{
|
||||||
@ -925,6 +938,7 @@ input[type=text]{
|
|||||||
color: #999999;
|
color: #999999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// toggle
|
// toggle
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user