1.1 KB43 lines
Blame
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8import type {ReactNode} from 'react';
9import type {ReactProps} from './utils';
10
11import * as stylex from '@stylexjs/stylex';
12
13const styles = stylex.create({
14 badge: {
15 display: 'inline-flex',
16 alignItems: 'center',
17 boxSizing: 'border-box',
18 backgroundColor: 'var(--badge-background)',
19 border: '1px solid var(--button-border)',
20 borderRadius: '11px',
21 color: 'var(--badge-foreground)',
22 padding: '3px 6px',
23 fontFamily: 'var(--font-family)',
24 fontSize: '11px',
25 minHeight: '18px',
26 minWidth: '18px',
27 lineHeight: '16px',
28 height: '16px',
29
30 textOverflow: 'ellipsis',
31 maxWidth: '150px',
32 whiteSpace: 'nowrap',
33 overflow: 'hidden',
34 },
35});
36
37export function Badge({
38 xstyle,
39 ...rest
40}: {children: ReactNode; xstyle?: stylex.StyleXStyles} & ReactProps<HTMLSpanElement>) {
41 return <span {...stylex.props(styles.badge, xstyle)} {...rest} />;
42}
43