| 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 | |
| 8 | import '@vscode/codicons/dist/codicon.css'; |
| 9 | import './Icon.css'; |
| 10 | |
| 11 | export function Icon({ |
| 12 | icon, |
| 13 | size, |
| 14 | slot, |
| 15 | color, |
| 16 | className, |
| 17 | ...other |
| 18 | }: { |
| 19 | slot?: 'start'; |
| 20 | icon: string; |
| 21 | size?: 'XS' | 'S' | 'M' | 'L'; |
| 22 | color?: 'blue' | 'red' | 'green' | 'yellow'; |
| 23 | } & React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>) { |
| 24 | return ( |
| 25 | <div |
| 26 | slot={slot} |
| 27 | className={`codicon codicon-${icon} icon-size-${size ?? 'S'} ${ |
| 28 | color == null ? '' : `icon-${color}` |
| 29 | } ${className ?? ''}`} |
| 30 | {...other} |
| 31 | /> |
| 32 | ); |
| 33 | } |
| 34 | |