/
redly
/
reactposts
Обзор
Документация
Войти
/
redly
/
reactposts
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/components/Select.tsx
33 строки
816 B
Redlyweb
feat: add search, pagination, sort, auth with useContext
26 июн 2024, 11:45
26 июн 2024, 11:45
840acc1
Код
Авторство
О чём код?
import styled from "styled-components"; interface SortSelectProps { selectedSortType: string; setSelectedSortType: React.Dispatch<React.SetStateAction<string>>; } const StyledSelectWrapper = styled.div` margin-top: 10px; `; const StyledSelect = styled.select` border: none; `; export default function Select({ selectedSortType, setSelectedSortType, }: SortSelectProps) { return ( <StyledSelectWrapper> <StyledSelect value={selectedSortType} onChange={(e) => setSelectedSortType(e.target.value)} style={{ marginTop: "10px" }} > <option value="">По умолчанию</option> <option value="title">По названию</option> <option value="body">По тексту</option> </StyledSelect> </StyledSelectWrapper> ); }