import React from 'react';
import type { ViewStyle } from 'react-native';
import { resolveButtonColors, resolveControlSize } from '../../../../internal/resolvers';
import type { BadgeProps } from '../../../../types/badge';
import { View } from '../../../layout/public';
import { useTheme } from '../../../theme/runtime';
import { Text } from '../../../typography/public';
/*** Renders compact semantic status or metadata content. */
export function Badge({
content,
variant = 'soft',
color = 'primary',
size = 's',
testID,
}: BadgeProps) {
const { theme } = useTheme();
const controlSize = resolveControlSize(theme, size);
const colors = resolveButtonColors(theme, {
variant,
color,
state: { disabled: false, focused: false, hovered: false, pressed: false },
});
return (
{content}
);
}
/*** Resolves the visual container style for one badge variant. */
function resolveBadgeStyle(
backgroundColor: string,
borderColor: string,
variant: NonNullable,
): ViewStyle {
return {
alignSelf: 'flex-start',
backgroundColor,
borderColor,
borderWidth: variant === 'solid' ? 0 : 1,
};
}