/
githubmirror
/
Open-Assistant
Обзор
Документация
Войти
/
githubmirror
/
Open-Assistant
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
website/src/components/Chat/ChatConfigMobile.tsx
41 строка
1 KB
notmd
Allow to save custom preset (#3079)
08 май 2023, 21:02
Не верифицирован
08 май 2023, 21:02
df1fd96
Код
Авторство
О чём код?
import { Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerHeader, DrawerOverlay } from "@chakra-ui/react"; import { Settings } from "lucide-react"; import { useTranslation } from "next-i18next"; import { memo, ReactNode } from "react"; import { useChatActions, useChatState } from "./ChatContext"; import { ChatInputIconButton } from "./ChatInputIconButton"; export const ChatConfigMobile = memo(function ChatConfigDrawer({ children }: { children: ReactNode }) { const { t } = useTranslation("chat"); const { closeConfigDrawer } = useChatActions(); const { isConfigDrawerOpen } = useChatState(); return ( <> <Drawer placement="right" onClose={closeConfigDrawer} isOpen={isConfigDrawerOpen}> <DrawerOverlay /> <DrawerContent> <DrawerCloseButton /> <DrawerHeader borderBottomWidth="1px">{t("config_title")}</DrawerHeader> <DrawerBody pr="0">{children}</DrawerBody> </DrawerContent> </Drawer> </> ); }); export const ChatConfigMobileTrigger = () => { const { t } = useTranslation("chat"); const { openConfigDrawer } = useChatActions(); return ( <ChatInputIconButton aria-label={t("config_title")} icon={Settings} onClick={openConfigDrawer} borderRadius="xl" display={{ base: "flex", xl: "none" }} /> ); };