|
| 1 | +import { |
| 2 | + ArrowPathIcon, |
| 3 | + ArrowUpIcon, |
| 4 | + ArrowDownIcon, |
| 5 | + ArrowDownTrayIcon, |
| 6 | + ArrowLeftIcon, |
| 7 | + ArrowRightIcon, |
| 8 | + ArrowsPointingOutIcon, |
| 9 | + ArrowUpRightIcon, |
| 10 | + Bars3Icon, |
| 11 | + ChevronDownIcon, |
| 12 | + ChevronLeftIcon, |
| 13 | + ChevronRightIcon, |
| 14 | + ChevronUpIcon, |
| 15 | + CursorArrowRaysIcon, |
| 16 | + DocumentDuplicateIcon, |
| 17 | + EnvelopeIcon, |
| 18 | + LinkIcon, |
| 19 | + MapPinIcon, |
| 20 | + MinusIcon, |
| 21 | + PlayCircleIcon, |
| 22 | + PlusIcon, |
| 23 | + XMarkIcon, |
| 24 | +} from '@heroicons/react/24/outline'; |
| 25 | +import { CheckIcon } from '@heroicons/react/16/solid'; |
| 26 | +import { PlayIcon, PauseIcon } from '@heroicons/react/20/solid'; |
| 27 | + |
| 28 | +export const iconMap = { |
| 29 | + action: ChevronRightIcon, |
| 30 | + 'arrow-right': ArrowRightIcon, |
| 31 | + 'arrow-left': ArrowLeftIcon, |
| 32 | + 'arrow-up': ArrowUpIcon, |
| 33 | + 'arrow-down': ArrowDownIcon, |
| 34 | + back: ArrowLeftIcon, |
| 35 | + copy: DocumentDuplicateIcon, |
| 36 | + check: CheckIcon, |
| 37 | + 'chevron-down': ChevronDownIcon, |
| 38 | + 'chevron-left': ChevronLeftIcon, |
| 39 | + 'chevron-right': ChevronRightIcon, |
| 40 | + 'chevron-up': ChevronUpIcon, |
| 41 | + download: ArrowDownTrayIcon, |
| 42 | + expand: ArrowsPointingOutIcon, |
| 43 | + 'triangle-down': PlayIcon, |
| 44 | + 'triangle-right': PlayIcon, |
| 45 | + 'triangle-up': PlayIcon, |
| 46 | + cursor: CursorArrowRaysIcon, |
| 47 | + close: XMarkIcon, |
| 48 | + email: EnvelopeIcon, |
| 49 | + external: ArrowUpRightIcon, |
| 50 | + flip: ArrowPathIcon, |
| 51 | + left: ArrowLeftIcon, |
| 52 | + link: LinkIcon, |
| 53 | + location: MapPinIcon, |
| 54 | + menu: Bars3Icon, |
| 55 | + minus: MinusIcon, |
| 56 | + more: ArrowRightIcon, |
| 57 | + pause: PauseIcon, |
| 58 | + play: PlayIcon, |
| 59 | + 'play-outline': PlayCircleIcon, |
| 60 | + plus: PlusIcon, |
| 61 | + right: ArrowRightIcon, |
| 62 | + up: ArrowUpIcon, |
| 63 | +}; |
| 64 | +export type IconType = keyof typeof iconMap; |
| 65 | + |
| 66 | +/** |
| 67 | + * Normalized base size and position of each icon (finetuned manually) for use in eg, buttons |
| 68 | + * Only add to this map if different from default class w-1em |
| 69 | + * If you wish to use the HeroIcon without any base styles, set the noBaseStyle boolean prop to true |
| 70 | + */ |
| 71 | + |
| 72 | +// This basically means that the keys from iconBaseStyle are from the keys of iconMap |
| 73 | +type IconBaseStyleType = Partial<{ |
| 74 | + [Key in IconType]: string; |
| 75 | +}>; |
| 76 | + |
| 77 | +export const iconBaseStyleDefault = 'w-1em'; |
| 78 | +export const iconBaseStyle: IconBaseStyleType = { |
| 79 | + 'arrow-left': 'w-09em -mt-01em', |
| 80 | + 'arrow-right': 'w-09em -mt-01em', |
| 81 | + 'triangle-right': 'w-09em scale-x-90 mt-01em', |
| 82 | + 'triangle-down': 'w-09em scale-x-90 rotate-90 mt-01em', |
| 83 | + 'triangle-up': 'w-09em scale-x-90 -rotate-90 mt-02em', |
| 84 | + download: 'w-09em', |
| 85 | + expand: 'w-1em -mt-02em', |
| 86 | + external: 'w-08em stroke-[2.5]', |
| 87 | + left: 'w-08em', |
| 88 | + link: 'w-09em -mt-01em', |
| 89 | + more: 'w-08em', |
| 90 | + plus: 'w-08em', |
| 91 | + right: 'w-08em', |
| 92 | +}; |
0 commit comments