2023-06-01 09:40:23 +00:00
|
|
|
import { SpanBox, HStack } from './LayoutPrimitives'
|
2024-06-10 09:34:38 +00:00
|
|
|
import { Circle, X } from '@phosphor-icons/react'
|
2022-07-12 21:52:51 +00:00
|
|
|
|
2022-03-25 21:37:37 +00:00
|
|
|
type LabelChipProps = {
|
|
|
|
|
text: string
|
|
|
|
|
color: string // expected to be a RGB hex color string
|
2023-06-16 04:51:21 +00:00
|
|
|
isSelected?: boolean
|
2022-03-25 21:37:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function LabelChip(props: LabelChipProps): JSX.Element {
|
|
|
|
|
return (
|
2023-06-23 09:11:29 +00:00
|
|
|
<SpanBox
|
|
|
|
|
css={{
|
|
|
|
|
display: 'inline-table',
|
|
|
|
|
margin: '2px',
|
|
|
|
|
fontSize: '11px',
|
|
|
|
|
fontWeight: '500',
|
|
|
|
|
fontFamily: '$inter',
|
2023-07-12 06:06:43 +00:00
|
|
|
padding: '4px 7px',
|
2023-06-23 09:11:29 +00:00
|
|
|
whiteSpace: 'nowrap',
|
|
|
|
|
cursor: 'pointer',
|
|
|
|
|
backgroundClip: 'padding-box',
|
|
|
|
|
borderRadius: '5px',
|
|
|
|
|
borderWidth: '1px',
|
|
|
|
|
borderStyle: 'solid',
|
2024-02-20 02:15:57 +00:00
|
|
|
color: '$thLabelChipForeground',
|
|
|
|
|
borderColor: props.isSelected
|
|
|
|
|
? '$thLabelChipSelectedBorder'
|
2024-06-13 12:57:08 +00:00
|
|
|
: '$thLabelChipBackground',
|
2024-02-20 02:15:57 +00:00
|
|
|
backgroundColor: '$thLabelChipBackground',
|
2022-07-11 21:20:57 +00:00
|
|
|
}}
|
|
|
|
|
>
|
2023-06-26 08:30:02 +00:00
|
|
|
<HStack alignment="center" css={{ gap: '5px' }}>
|
2023-06-23 09:11:29 +00:00
|
|
|
<Circle size={14} color={props.color} weight="fill" />
|
|
|
|
|
<SpanBox css={{ pt: '1px' }}>{props.text}</SpanBox>
|
|
|
|
|
</HStack>
|
|
|
|
|
</SpanBox>
|
2022-03-25 21:37:37 +00:00
|
|
|
)
|
2023-06-23 09:11:29 +00:00
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// return (
|
|
|
|
|
// <Button
|
|
|
|
|
// style="plainIcon"
|
|
|
|
|
// onClick={(e) => {
|
|
|
|
|
// router.push(`/home?q=label:"${props.text}"`)
|
|
|
|
|
// e.stopPropagation()
|
|
|
|
|
// }}
|
|
|
|
|
// >
|
|
|
|
|
// <SpanBox
|
|
|
|
|
// css={{
|
|
|
|
|
// display: 'inline-table',
|
|
|
|
|
// margin: '2px',
|
|
|
|
|
// borderRadius: '4px',
|
|
|
|
|
// color: textColor,
|
|
|
|
|
// fontSize: '13px',
|
|
|
|
|
// fontWeight: '500',
|
|
|
|
|
// padding: '3px 6px',
|
|
|
|
|
// whiteSpace: 'nowrap',
|
|
|
|
|
// cursor: 'pointer',
|
|
|
|
|
// backgroundClip: 'padding-box',
|
|
|
|
|
// backgroundColor: props.color,
|
|
|
|
|
// }}
|
|
|
|
|
// >
|
|
|
|
|
// {props.text}
|
|
|
|
|
// </SpanBox>
|
|
|
|
|
// </Button>
|
|
|
|
|
// )
|
2022-03-25 21:37:37 +00:00
|
|
|
}
|