2
0

💄 Fix toast UI in dark mode

Closes #478
This commit is contained in:
Baptiste Arnaud
2023-05-02 09:13:57 -04:00
parent c1f3534374
commit ddb528774b
2 changed files with 17 additions and 3 deletions

View File

@@ -1,4 +1,11 @@
import { Flex, HStack, IconButton, Stack, Text } from '@chakra-ui/react' import {
Flex,
HStack,
IconButton,
Stack,
Text,
useColorModeValue,
} from '@chakra-ui/react'
import { AlertIcon, CloseIcon, InfoIcon, SmileIcon } from './icons' import { AlertIcon, CloseIcon, InfoIcon, SmileIcon } from './icons'
import { CodeEditor } from './inputs/CodeEditor' import { CodeEditor } from './inputs/CodeEditor'
import { LanguageName } from '@uiw/codemirror-extensions-langs' import { LanguageName } from '@uiw/codemirror-extensions-langs'
@@ -27,11 +34,13 @@ export const Toast = ({
secondaryButton, secondaryButton,
onClose, onClose,
}: ToastProps) => { }: ToastProps) => {
const bgColor = useColorModeValue('white', 'gray.800')
return ( return (
<Flex <Flex
p={3} p={3}
rounded="md" rounded="md"
bgColor="white" bgColor={bgColor}
borderWidth="1px" borderWidth="1px"
shadow="sm" shadow="sm"
fontSize="sm" fontSize="sm"
@@ -51,6 +60,7 @@ export const Toast = ({
isReadOnly isReadOnly
value={details.content} value={details.content}
lang={details.lang} lang={details.lang}
minWidth="300px"
maxHeight="200px" maxHeight="200px"
maxWidth="calc(450px - 100px)" maxWidth="calc(450px - 100px)"
/> />
@@ -85,11 +95,12 @@ const Icon = ({
customIcon?: React.ReactNode customIcon?: React.ReactNode
status: ToastProps['status'] status: ToastProps['status']
}) => { }) => {
const accentColor = useColorModeValue('50', '0')
const color = parseColor(status) const color = parseColor(status)
const icon = parseIcon(status, customIcon) const icon = parseIcon(status, customIcon)
return ( return (
<Flex <Flex
bgColor={`${color}.50`} bgColor={`${color}.${accentColor}`}
boxSize="40px" boxSize="40px"
justifyContent="center" justifyContent="center"
alignItems="center" alignItems="center"

View File

@@ -26,6 +26,7 @@ type Props = {
withVariableButton?: boolean withVariableButton?: boolean
height?: string height?: string
maxHeight?: string maxHeight?: string
minWidth?: string
onChange?: (value: string) => void onChange?: (value: string) => void
} }
export const CodeEditor = ({ export const CodeEditor = ({
@@ -34,6 +35,7 @@ export const CodeEditor = ({
onChange, onChange,
height = '250px', height = '250px',
maxHeight = '70vh', maxHeight = '70vh',
minWidth,
withVariableButton = true, withVariableButton = true,
isReadOnly = false, isReadOnly = false,
debounceTimeout = 1000, debounceTimeout = 1000,
@@ -93,6 +95,7 @@ export const CodeEditor = ({
width="full" width="full"
h="full" h="full"
pos="relative" pos="relative"
minW={minWidth}
onMouseEnter={onOpen} onMouseEnter={onOpen}
onMouseLeave={onClose} onMouseLeave={onClose}
maxWidth={props.maxWidth} maxWidth={props.maxWidth}