@chakra-ui/react#TextProps TypeScript Examples

The following examples show how to use @chakra-ui/react#TextProps. 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: MessagesBlock.tsx    From ke with MIT License 5 votes vote down vote up
MessagesBlock = ({
  messages,
  messageType,
  messageProps,
  messageTextProps,
}: {
  messages: (string | JSX.Element)[] | undefined
  messageType: string
  messageProps?: BoxProps
  messageTextProps?: TextProps
}): JSX.Element => {
  if (typeof messages === 'undefined') return <></>

  const messageColor = messageTypeMapping[messageType]
  const messageIcon = messageIconMapping[messageType]

  return (
    <>
      {messages
        .filter((message: string | JSX.Element | null) => message !== null)
        .map((message: string | JSX.Element, index) => {
          const key = index
          return (
            <Box
              bg={messageColor}
              key={key}
              display="flex"
              borderRadius="4px"
              justifyContent="center"
              p={3}
              mt={4}
              sx={{
                '& + &': {
                  mt: 2,
                },
              }}
              {...messageProps}
            >
              <Box as={messageIcon} size="21px" mt="1px" flexShrink={0} />
              <Text ml={2} {...messageTextProps}>
                {message}
              </Text>
            </Box>
          )
        })}
    </>
  )
}
Example #2
Source File: Body.tsx    From website with MIT License 5 votes vote down vote up
P: React.FC<JSX.IntrinsicElements['p'] & TextProps> = ({ children, ...rest }) => {
  return (
    <Text as="p" {...rest}>
      {children}
    </Text>
  )
}