@chakra-ui/react#useToken JavaScript Examples

The following examples show how to use @chakra-ui/react#useToken. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: hooks.js    From idena-web with MIT License 6 votes vote down vote up
export function useAdStatusColor(status, fallbackColor = 'muted') {
  const statusColor = {
    [AdRotationStatus.Showing]: 'green',
    [AdRotationStatus.NotShowing]: 'red',
    [AdRotationStatus.PartiallyShowing]: 'orange',
  }

  const color = useToken('colors', `${statusColor[status]}.500`, fallbackColor)

  return color
}
Example #2
Source File: components.js    From idena-web with MIT License 6 votes vote down vote up
export function Select(props) {
  const iconSize = useToken('space', '5')
  return (
    <ChakraSelect
      icon={<ChevronDownIcon />}
      iconColor="muted"
      iconSize={iconSize}
      borderColor="gray.100"
      fontSize="md"
      lineHeight="short"
      h={8}
      _placeholder={{
        color: 'muted',
      }}
      _disabled={{
        bg: 'gray.100',
        color: 'muted',
      }}
      {...props}
    />
  )
}