/
githubmirror
/
Open-Assistant
Обзор
Документация
Войти
/
githubmirror
/
Open-Assistant
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
website/src/components/RoleSelect.tsx
31 строка
733 B
notmd
allow moderators to ban user (#1458)
11 фев 2023, 11:10
Не верифицирован
11 фев 2023, 11:10
71326d4
Код
Авторство
О чём код?
import { Select, SelectProps } from "@chakra-ui/react"; import { forwardRef } from "react"; import { ValueOf } from "ts-essentials"; export const ROLES = { GERNERAL: "general", BANNED: "banned", ADMIN: "admin", MODERATOR: "moderator", } as const; export type Role = ValueOf<typeof ROLES>; type RoleSelectProps = Omit<SelectProps, "defaultValue"> & { defaultValue?: Role; value?: Role; }; export const RoleSelect = forwardRef<HTMLSelectElement, RoleSelectProps>((props, ref) => { return ( <Select {...props} ref={ref}> {Object.values(ROLES).map((role) => ( <option value={role} key={role}> {role} </option> ))} </Select> ); }); RoleSelect.displayName = "RoleSelect";