replace react-select with native html select

This commit is contained in:
b1ek 2023-05-12 19:16:06 +10:00
parent 11f9aebcef
commit 0c088c732a
Signed by: blek
GPG Key ID: 14546221E3595D0C
2 changed files with 18 additions and 7 deletions

View File

@ -12,7 +12,6 @@
"react-awesome-slider": "^4.1.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.11.0",
"react-select": "^5.7.3",
"react-spinners": "^0.13.8",
"styled-components": "^6.0.0-rc.1"
},

View File

@ -1,6 +1,5 @@
import React, { useState } from "react";
import ISVGIcon from '../../components/UI/Icon/SVGIcon';
import Select from 'react-select';
import ApartmentsList from "../../components/ApartmentsList";
import { Filters } from "../../API/Filters";
@ -18,6 +17,13 @@ import constants from "../../constants";
const API_ROOT = constants.API_ROOT;
const Select = styled.select`
padding: 6px 10px;
border: 1px solid #c2c4c2;
border-radius: 6px;
box-shadow: 0 2px 2px #00000010
`;
const SVGIcon = styled(ISVGIcon)`
margin-left:0;
`;
@ -278,10 +284,16 @@ const FiltersForm = (props) => {
<SearchBarSpacer />
<Select
options={apart_sizes}
styles={{control: (base) => ({...base, border: 0, outline: 0, background: 0})}}
onChange={e => setState({rooms: e})}
value={state.rooms} />
onChange={e => setState({rooms: apart_sizes[e.target.value]})}
value={state.rooms.value}
>
{
apart_sizes.map((size, i) => {
return <option value={size.value} label={size.label} key={i} />;
})
}
</Select>
<SearchBarSpacer />
@ -321,7 +333,7 @@ const FiltersForm = (props) => {
{
props.loading ?
<>
<HashLoader color='#a1adb3' cssOverride={{marginRight: 6, transform: 'translate(-3px, 2px) scale(1.5)'}} size={14} />
<HashLoader color='#a1adb3' cssOverride={{marginRight: 6, transform: 'translate(-3px, 2px) scale(1.3)'}} size={14} />
Загрузка данных...
</> :
<>