-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathindex.tsx
More file actions
37 lines (30 loc) · 1002 Bytes
/
index.tsx
File metadata and controls
37 lines (30 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import ArrowUpRightIcon from '@heroicons/react/24/solid/ArrowUpRightIcon';
import type { ComponentProps, FC, PropsWithChildren } from 'react';
import Badge from '#ui/Common/Badge';
import type { LinkLike } from '#ui/types';
import styles from './index.module.css';
type BadgeGroupProps = {
kind?: ComponentProps<typeof Badge>['kind'];
size?: ComponentProps<typeof Badge>['size'];
badgeText?: string;
as: LinkLike;
} & ComponentProps<LinkLike>;
const BadgeGroup: FC<PropsWithChildren<BadgeGroupProps>> = ({
kind = 'default',
size = 'medium',
badgeText,
children,
as: Component = 'a',
...args
}) => (
<Component className={`${styles.wrapper} ${styles[kind]}`} {...args}>
{badgeText && (
<Badge kind={kind} size={size} className={styles.badge}>
{badgeText}
</Badge>
)}
<span className={styles.message}>{children}</span>
{args.target === '_blank' && <ArrowUpRightIcon className={styles.icon} />}
</Component>
);
export default BadgeGroup;