import * as React from 'react'
import styled from 'styled-components'
import { ErrorOutlineIcon } from '@sanity/icons'
import { Box, Inline, Text, Tooltip } from '@sanity/ui'
type Props = {
description?: string
error?: string
label: string
name: string
}
const StyledErrorOutlineIcon = styled(ErrorOutlineIcon)(({ theme }) => {
return {
color: theme.sanity.color.spot.red,
}
})
export const FormLabel = (props: Props) => {
const { description, error, label, name } = props
return (
{/* Label */}
{label}
{/* Error icon + tooltip */}
{error && (
{error}
}
fallbackPlacements={['top', 'left']}
placement="right"
portal={true}
>
)}
{/* Description */}
{description && (
{description}
)}
)
}