1import { mergeClasses } from '@expo/styleguide'; 2 3import { TagProps } from './Tag'; 4import { labelStyle, tagStyle, tagToCStyle } from './styles'; 5 6import { PlatformIcon } from '~/components/plugins/PlatformIcon'; 7import { PlatformName } from '~/types/common'; 8import { formatName, getPlatformName, TAG_CLASSES } from '~/ui/components/Tag/helpers'; 9 10type PlatformTagProps = Omit<TagProps, 'name'> & { 11 platform: PlatformName; 12}; 13 14export const PlatformTag = ({ platform, type, className }: PlatformTagProps) => { 15 const platformName = getPlatformName(platform); 16 17 return ( 18 <div 19 css={[tagStyle, type === 'toc' && tagToCStyle]} 20 className={mergeClasses( 21 (platformName === 'android' || 22 platformName === 'ios' || 23 platformName === 'web' || 24 platformName === 'expo') && 25 TAG_CLASSES[platformName], 26 className 27 )}> 28 {type !== 'toc' && <PlatformIcon platform={platformName} />} 29 <span css={labelStyle}>{formatName(platform)}</span> 30 </div> 31 ); 32}; 33