diff --git a/hyperglass/ui/components/countdown/countdown.tsx b/hyperglass/ui/components/countdown/countdown.tsx index e1eb56c..95fa439 100644 --- a/hyperglass/ui/components/countdown/countdown.tsx +++ b/hyperglass/ui/components/countdown/countdown.tsx @@ -1,6 +1,6 @@ import { chakra, Text } from '@chakra-ui/react'; import ReactCountdown, { zeroPad } from 'react-countdown'; -import { If } from '~/components'; +import { If, Then, Else } from 'react-if'; import { useColorValue } from '~/context'; import type { TCountdown, TRenderer } from './types'; @@ -12,19 +12,19 @@ const Renderer = (props: TRenderer): JSX.Element => { hours !== 0 && time.unshift(zeroPad(hours)); const bg = useColorValue('black', 'white'); return ( - <> - + + - - + + {text} {time.join(':')} - - + + ); }; diff --git a/hyperglass/ui/components/footer/colorMode.tsx b/hyperglass/ui/components/footer/colorMode.tsx index 09dab80..a1f1991 100644 --- a/hyperglass/ui/components/footer/colorMode.tsx +++ b/hyperglass/ui/components/footer/colorMode.tsx @@ -1,6 +1,7 @@ import { forwardRef } from 'react'; import { Button, Tooltip } from '@chakra-ui/react'; -import { DynamicIcon, If } from '~/components'; +import { Switch, Case } from 'react-if'; +import { DynamicIcon } from '~/components'; import { useColorMode, useColorValue, useBreakpointValue } from '~/context'; import { useOpposingColor } from '~/hooks'; @@ -29,12 +30,14 @@ export const ColorModeToggle = forwardRef( onClick={toggleColorMode} {...rest} > - - - - - - + + + + + + + + ); diff --git a/hyperglass/ui/components/footer/footer.tsx b/hyperglass/ui/components/footer/footer.tsx index f970390..0041521 100644 --- a/hyperglass/ui/components/footer/footer.tsx +++ b/hyperglass/ui/components/footer/footer.tsx @@ -1,6 +1,7 @@ import { useMemo } from 'react'; import { Flex, HStack, useToken } from '@chakra-ui/react'; -import { DynamicIcon, If } from '~/components'; +import { If, Then } from 'react-if'; +import { DynamicIcon } from '~/components'; import { useConfig, useMobile, useColorValue, useBreakpointValue } from '~/context'; import { useStrf } from '~/hooks'; import { FooterButton } from './button'; @@ -82,13 +83,15 @@ export const Footer = (): JSX.Element => { ); } })} - - } - /> + + + } + /> + diff --git a/hyperglass/ui/components/form/field.tsx b/hyperglass/ui/components/form/field.tsx index f68b18a..20e2cf1 100644 --- a/hyperglass/ui/components/form/field.tsx +++ b/hyperglass/ui/components/form/field.tsx @@ -1,7 +1,7 @@ import { useMemo } from 'react'; import { Flex, FormControl, FormLabel, FormErrorMessage } from '@chakra-ui/react'; import { useFormContext } from 'react-hook-form'; -import { If } from '~/components'; +import { If, Then } from 'react-if'; import { useColorValue } from '~/context'; import { useBooleanValue } from '~/hooks'; @@ -33,8 +33,8 @@ export const FormField = (props: TField): JSX.Element => { w="100%" maxW="100%" flexDir="column" - isInvalid={error !== null} my={{ base: 2, lg: 4 }} + isInvalid={error !== null} {...rest} > { htmlFor={name} display="flex" opacity={opacity} + fontWeight="bold" alignItems="center" justifyContent="space-between" - fontWeight="bold" color={error !== null ? errorColor : labelColor} > {label} - {labelAddOn} + + {labelAddOn} + {children} - - - {fieldAddOn} - + + + + {fieldAddOn} + + {error?.message} diff --git a/hyperglass/ui/components/form/queryTarget.tsx b/hyperglass/ui/components/form/queryTarget.tsx index a93c50e..78d2bce 100644 --- a/hyperglass/ui/components/form/queryTarget.tsx +++ b/hyperglass/ui/components/form/queryTarget.tsx @@ -1,7 +1,8 @@ import { useMemo } from 'react'; import { Input, InputGroup, InputRightElement, Text } from '@chakra-ui/react'; import { components } from 'react-select'; -import { If, Select } from '~/components'; +import { If, Then, Else } from 'react-if'; +import { Select } from '~/components'; import { isSingleValue } from '~/components/select'; import { useColorValue } from '~/context'; import { useDirective, useFormState } from '~/hooks'; @@ -68,37 +69,39 @@ export const QueryTarget = (props: TQueryTarget): JSX.Element => { return ( <> - - - name={name} - options={options} - components={{ Option }} - onChange={handleSelectChange} - /> - - - - + + + name={name} + options={options} + components={{ Option }} + onChange={handleSelectChange} /> - - { - setTarget({ display: target }); - onChange({ field: name, value: target }); - }} + + + + - - + + { + setTarget({ display: target }); + onChange({ field: name, value: target }); + }} + /> + + + ); diff --git a/hyperglass/ui/components/greeting/greeting.tsx b/hyperglass/ui/components/greeting/greeting.tsx index 39288db..a10c238 100644 --- a/hyperglass/ui/components/greeting/greeting.tsx +++ b/hyperglass/ui/components/greeting/greeting.tsx @@ -9,7 +9,8 @@ import { ModalContent, ModalCloseButton, } from '@chakra-ui/react'; -import { If, Markdown } from '~/components'; +import { If, Then } from 'react-if'; +import { Markdown } from '~/components'; import { useConfig, useColorValue } from '~/context'; import { useGreeting, useOpposingColor } from '~/hooks'; @@ -47,8 +48,10 @@ export const Greeting = (props: TGreeting): JSX.Element => { {...props} > {web.greeting.title} - - + + + + diff --git a/hyperglass/ui/components/header/title.tsx b/hyperglass/ui/components/header/title.tsx index bcd9dd8..aec01c2 100644 --- a/hyperglass/ui/components/header/title.tsx +++ b/hyperglass/ui/components/header/title.tsx @@ -1,7 +1,7 @@ import { Flex, Button, VStack } from '@chakra-ui/react'; import { motion } from 'framer-motion'; import { isSafari } from 'react-device-detect'; -import { If } from '~/components'; +import { Switch, Case } from 'react-if'; import { useConfig, useMobile } from '~/context'; import { useBooleanValue, useFormState } from '~/hooks'; import { SubtitleOnly } from './subtitleOnly'; @@ -141,18 +141,20 @@ export const Title = (props: TTitle): JSX.Element => { _focus={{ boxShadow: 'none' }} _hover={{ textDecoration: 'none' }} > - - - - - - - - - - - - + + + + + + + + + + + + + + ); diff --git a/hyperglass/ui/components/layout/frame.tsx b/hyperglass/ui/components/layout/frame.tsx index e6e8502..e0e7eef 100644 --- a/hyperglass/ui/components/layout/frame.tsx +++ b/hyperglass/ui/components/layout/frame.tsx @@ -1,7 +1,8 @@ import { useCallback, useRef } from 'react'; import { Flex } from '@chakra-ui/react'; import { isSafari } from 'react-device-detect'; -import { If, Debugger, Greeting, Footer, Header } from '~/components'; +import { If, Then } from 'react-if'; +import { Debugger, Greeting, Footer, Header } from '~/components'; import { useConfig } from '~/context'; import { useFormState } from '~/hooks'; import { ResetButton } from './resetButton'; @@ -51,8 +52,10 @@ export const Frame = (props: TFrame): JSX.Element => { {...props} />