Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

19.7 KB
Raw Blame
// Same names as packages/ui/src/components/icon.tsx, so screens and the web share one icon vocabulary.
// Each glyph is a deep import: the package index pulls in every Phosphor icon, and Metro does not tree-shake.
import type { Icon as PhosphorIcon } from "phosphor-react-native";
import { ArrowClockwiseIcon } from "phosphor-react-native/src/icons/ArrowClockwise";
import { ArrowCounterClockwiseIcon } from "phosphor-react-native/src/icons/ArrowCounterClockwise";
import { ArrowDownIcon } from "phosphor-react-native/src/icons/ArrowDown";
import { ArrowLeftIcon } from "phosphor-react-native/src/icons/ArrowLeft";
import { ArrowRightIcon } from "phosphor-react-native/src/icons/ArrowRight";
import { ArrowsClockwiseIcon } from "phosphor-react-native/src/icons/ArrowsClockwise";
import { ArrowsDownUpIcon } from "phosphor-react-native/src/icons/ArrowsDownUp";
import { ArrowsInLineVerticalIcon } from "phosphor-react-native/src/icons/ArrowsInLineVertical";
import { ArrowsInSimpleIcon } from "phosphor-react-native/src/icons/ArrowsInSimple";
import { ArrowsLeftRightIcon } from "phosphor-react-native/src/icons/ArrowsLeftRight";
import { ArrowsOutSimpleIcon } from "phosphor-react-native/src/icons/ArrowsOutSimple";
import { ArrowSquareOutIcon } from "phosphor-react-native/src/icons/ArrowSquareOut";
import { ArrowUpIcon } from "phosphor-react-native/src/icons/ArrowUp";
import { ArrowUpRightIcon } from "phosphor-react-native/src/icons/ArrowUpRight";
import { ArrowUUpLeftIcon } from "phosphor-react-native/src/icons/ArrowUUpLeft";
import { ArrowUUpRightIcon } from "phosphor-react-native/src/icons/ArrowUUpRight";
import { BellIcon } from "phosphor-react-native/src/icons/Bell";
import { BookmarkSimpleIcon } from "phosphor-react-native/src/icons/BookmarkSimple";
import { BookOpenIcon } from "phosphor-react-native/src/icons/BookOpen";
import { BookOpenTextIcon } from "phosphor-react-native/src/icons/BookOpenText";
import { BooksIcon } from "phosphor-react-native/src/icons/Books";
import { BracketsCurlyIcon } from "phosphor-react-native/src/icons/BracketsCurly";
import { BrainIcon } from "phosphor-react-native/src/icons/Brain";
import { BriefcaseIcon } from "phosphor-react-native/src/icons/Briefcase";
import { BugIcon } from "phosphor-react-native/src/icons/Bug";
import { CalendarBlankIcon } from "phosphor-react-native/src/icons/CalendarBlank";
import { CalendarDotIcon } from "phosphor-react-native/src/icons/CalendarDot";
import { CalendarDotsIcon } from "phosphor-react-native/src/icons/CalendarDots";
import { CalendarPlusIcon } from "phosphor-react-native/src/icons/CalendarPlus";
import { CameraIcon } from "phosphor-react-native/src/icons/Camera";
import { CameraPlusIcon } from "phosphor-react-native/src/icons/CameraPlus";
import { CaretDownIcon } from "phosphor-react-native/src/icons/CaretDown";
import { CaretLeftIcon } from "phosphor-react-native/src/icons/CaretLeft";
import { CaretRightIcon } from "phosphor-react-native/src/icons/CaretRight";
import { ChartLineUpIcon } from "phosphor-react-native/src/icons/ChartLineUp";
import { ChatCenteredTextIcon } from "phosphor-react-native/src/icons/ChatCenteredText";
import { ChatTextIcon } from "phosphor-react-native/src/icons/ChatText";
import { CheckIcon } from "phosphor-react-native/src/icons/Check";
import { CheckCircleIcon } from "phosphor-react-native/src/icons/CheckCircle";
import { CheckSquareIcon } from "phosphor-react-native/src/icons/CheckSquare";
import { CircleIcon } from "phosphor-react-native/src/icons/Circle";
import { CircleHalfIcon } from "phosphor-react-native/src/icons/CircleHalf";
import { ClipboardTextIcon } from "phosphor-react-native/src/icons/ClipboardText";
import { ClockIcon } from "phosphor-react-native/src/icons/Clock";
import { ClockCounterClockwiseIcon } from "phosphor-react-native/src/icons/ClockCounterClockwise";
import { CloudCheckIcon } from "phosphor-react-native/src/icons/CloudCheck";
import { CloudSlashIcon } from "phosphor-react-native/src/icons/CloudSlash";
import { CloudWarningIcon } from "phosphor-react-native/src/icons/CloudWarning";
import { CodeIcon } from "phosphor-react-native/src/icons/Code";
import { CompassIcon } from "phosphor-react-native/src/icons/Compass";
import { CopyIcon } from "phosphor-react-native/src/icons/Copy";
import { DiscordLogoIcon } from "phosphor-react-native/src/icons/DiscordLogo";
import { DotsSixVerticalIcon } from "phosphor-react-native/src/icons/DotsSixVertical";
import { DotsThreeIcon } from "phosphor-react-native/src/icons/DotsThree";
import { DotsThreeVerticalIcon } from "phosphor-react-native/src/icons/DotsThreeVertical";
import { DownloadSimpleIcon } from "phosphor-react-native/src/icons/DownloadSimple";
import { EnvelopeIcon } from "phosphor-react-native/src/icons/Envelope";
import { EnvelopeSimpleIcon } from "phosphor-react-native/src/icons/EnvelopeSimple";
import { ExportIcon } from "phosphor-react-native/src/icons/Export";
import { EyeIcon } from "phosphor-react-native/src/icons/Eye";
import { EyeSlashIcon } from "phosphor-react-native/src/icons/EyeSlash";
import { FileIcon } from "phosphor-react-native/src/icons/File";
import { FileArrowUpIcon } from "phosphor-react-native/src/icons/FileArrowUp";
import { FileDocIcon } from "phosphor-react-native/src/icons/FileDoc";
import { FilePdfIcon } from "phosphor-react-native/src/icons/FilePdf";
import { FilePlusIcon } from "phosphor-react-native/src/icons/FilePlus";
import { FileTextIcon } from "phosphor-react-native/src/icons/FileText";
import { FingerprintIcon } from "phosphor-react-native/src/icons/Fingerprint";
import { GearSixIcon } from "phosphor-react-native/src/icons/GearSix";
import { GithubLogoIcon } from "phosphor-react-native/src/icons/GithubLogo";
import { GlobeIcon } from "phosphor-react-native/src/icons/Globe";
import { GlobeHemisphereWestIcon } from "phosphor-react-native/src/icons/GlobeHemisphereWest";
import { GlobeSimpleIcon } from "phosphor-react-native/src/icons/GlobeSimple";
import { GraduationCapIcon } from "phosphor-react-native/src/icons/GraduationCap";
import { GraphIcon } from "phosphor-react-native/src/icons/Graph";
import { HandHeartIcon } from "phosphor-react-native/src/icons/HandHeart";
import { HighlighterIcon } from "phosphor-react-native/src/icons/Highlighter";
import { HourglassIcon } from "phosphor-react-native/src/icons/Hourglass";
import { HouseIcon } from "phosphor-react-native/src/icons/House";
import { ImageIcon } from "phosphor-react-native/src/icons/Image";
import { InfoIcon } from "phosphor-react-native/src/icons/Info";
import { KanbanIcon } from "phosphor-react-native/src/icons/Kanban";
import { KeyIcon } from "phosphor-react-native/src/icons/Key";
import { KeyboardIcon } from "phosphor-react-native/src/icons/Keyboard";
import { LightningIcon } from "phosphor-react-native/src/icons/Lightning";
import { LinkBreakIcon } from "phosphor-react-native/src/icons/LinkBreak";
import { LinkSimpleHorizontalIcon } from "phosphor-react-native/src/icons/LinkSimpleHorizontal";
import { LinkSimpleHorizontalBreakIcon } from "phosphor-react-native/src/icons/LinkSimpleHorizontalBreak";
import { ListBulletsIcon } from "phosphor-react-native/src/icons/ListBullets";
import { ListChecksIcon } from "phosphor-react-native/src/icons/ListChecks";
import { ListDashesIcon } from "phosphor-react-native/src/icons/ListDashes";
import { ListMagnifyingGlassIcon } from "phosphor-react-native/src/icons/ListMagnifyingGlass";
import { ListNumbersIcon } from "phosphor-react-native/src/icons/ListNumbers";
import { LockIcon } from "phosphor-react-native/src/icons/Lock";
import { LockOpenIcon } from "phosphor-react-native/src/icons/LockOpen";
import { MagicWandIcon } from "phosphor-react-native/src/icons/MagicWand";
import { MagnifyingGlassIcon } from "phosphor-react-native/src/icons/MagnifyingGlass";
import { MagnifyingGlassMinusIcon } from "phosphor-react-native/src/icons/MagnifyingGlassMinus";
import { MagnifyingGlassPlusIcon } from "phosphor-react-native/src/icons/MagnifyingGlassPlus";
import { MapPinIcon } from "phosphor-react-native/src/icons/MapPin";
import { MicrophoneIcon } from "phosphor-react-native/src/icons/Microphone";
import { MinusIcon } from "phosphor-react-native/src/icons/Minus";
import { MoonIcon } from "phosphor-react-native/src/icons/Moon";
import { NoteIcon } from "phosphor-react-native/src/icons/Note";
import { NotePencilIcon } from "phosphor-react-native/src/icons/NotePencil";
import { PaletteIcon } from "phosphor-react-native/src/icons/Palette";
import { PaperclipIcon } from "phosphor-react-native/src/icons/Paperclip";
import { ParagraphIcon } from "phosphor-react-native/src/icons/Paragraph";
import { PasswordIcon } from "phosphor-react-native/src/icons/Password";
import { PauseIcon } from "phosphor-react-native/src/icons/Pause";
import { PencilLineIcon } from "phosphor-react-native/src/icons/PencilLine";
import { PencilSimpleIcon } from "phosphor-react-native/src/icons/PencilSimple";
import { PhoneIcon } from "phosphor-react-native/src/icons/Phone";
import { PlayIcon } from "phosphor-react-native/src/icons/Play";
import { PlugsConnectedIcon } from "phosphor-react-native/src/icons/PlugsConnected";
import { PlusIcon } from "phosphor-react-native/src/icons/Plus";
import { PlusCircleIcon } from "phosphor-react-native/src/icons/PlusCircle";
import { PrinterIcon } from "phosphor-react-native/src/icons/Printer";
import { QrCodeIcon } from "phosphor-react-native/src/icons/QrCode";
import { QuestionIcon } from "phosphor-react-native/src/icons/Question";
import { RobotIcon } from "phosphor-react-native/src/icons/Robot";
import { RowsIcon } from "phosphor-react-native/src/icons/Rows";
import { ScalesIcon } from "phosphor-react-native/src/icons/Scales";
import { ScissorsIcon } from "phosphor-react-native/src/icons/Scissors";
import { ScrollIcon } from "phosphor-react-native/src/icons/Scroll";
import { SealCheckIcon } from "phosphor-react-native/src/icons/SealCheck";
import { ShareNetworkIcon } from "phosphor-react-native/src/icons/ShareNetwork";
import { ShieldCheckIcon } from "phosphor-react-native/src/icons/ShieldCheck";
import { SidebarSimpleIcon } from "phosphor-react-native/src/icons/SidebarSimple";
import { SignOutIcon } from "phosphor-react-native/src/icons/SignOut";
import { SlidersHorizontalIcon } from "phosphor-react-native/src/icons/SlidersHorizontal";
import { SparkleIcon } from "phosphor-react-native/src/icons/Sparkle";
import { SpeakerHighIcon } from "phosphor-react-native/src/icons/SpeakerHigh";
import { SquareIcon } from "phosphor-react-native/src/icons/Square";
import { SquaresFourIcon } from "phosphor-react-native/src/icons/SquaresFour";
import { SquareSplitHorizontalIcon } from "phosphor-react-native/src/icons/SquareSplitHorizontal";
import { StarIcon } from "phosphor-react-native/src/icons/Star";
import { StopIcon } from "phosphor-react-native/src/icons/Stop";
import { StopCircleIcon } from "phosphor-react-native/src/icons/StopCircle";
import { SunIcon } from "phosphor-react-native/src/icons/Sun";
import { TagIcon } from "phosphor-react-native/src/icons/Tag";
import { TerminalWindowIcon } from "phosphor-react-native/src/icons/TerminalWindow";
import { TextAaIcon } from "phosphor-react-native/src/icons/TextAa";
import { TextAlignCenterIcon } from "phosphor-react-native/src/icons/TextAlignCenter";
import { TextAlignJustifyIcon } from "phosphor-react-native/src/icons/TextAlignJustify";
import { TextAlignLeftIcon } from "phosphor-react-native/src/icons/TextAlignLeft";
import { TextAlignRightIcon } from "phosphor-react-native/src/icons/TextAlignRight";
import { TextBIcon } from "phosphor-react-native/src/icons/TextB";
import { TextHOneIcon } from "phosphor-react-native/src/icons/TextHOne";
import { TextHThreeIcon } from "phosphor-react-native/src/icons/TextHThree";
import { TextHTwoIcon } from "phosphor-react-native/src/icons/TextHTwo";
import { TextIndentIcon } from "phosphor-react-native/src/icons/TextIndent";
import { TextItalicIcon } from "phosphor-react-native/src/icons/TextItalic";
import { TextOutdentIcon } from "phosphor-react-native/src/icons/TextOutdent";
import { TextStrikethroughIcon } from "phosphor-react-native/src/icons/TextStrikethrough";
import { TextTIcon } from "phosphor-react-native/src/icons/TextT";
import { TextTSlashIcon } from "phosphor-react-native/src/icons/TextTSlash";
import { TextUnderlineIcon } from "phosphor-react-native/src/icons/TextUnderline";
import { ThumbsUpIcon } from "phosphor-react-native/src/icons/ThumbsUp";
import { TimerIcon } from "phosphor-react-native/src/icons/Timer";
import { TranslateIcon } from "phosphor-react-native/src/icons/Translate";
import { TrashIcon } from "phosphor-react-native/src/icons/Trash";
import { TrayIcon } from "phosphor-react-native/src/icons/Tray";
import { TrendUpIcon } from "phosphor-react-native/src/icons/TrendUp";
import { UploadSimpleIcon } from "phosphor-react-native/src/icons/UploadSimple";
import { UserCircleIcon } from "phosphor-react-native/src/icons/UserCircle";
import { UserPlusIcon } from "phosphor-react-native/src/icons/UserPlus";
import { UserSoundIcon } from "phosphor-react-native/src/icons/UserSound";
import { VibrateIcon } from "phosphor-react-native/src/icons/Vibrate";
import { WarningIcon } from "phosphor-react-native/src/icons/Warning";
import { WarningCircleIcon } from "phosphor-react-native/src/icons/WarningCircle";
import { WaveformIcon } from "phosphor-react-native/src/icons/Waveform";
import { WifiSlashIcon } from "phosphor-react-native/src/icons/WifiSlash";
import { WrenchIcon } from "phosphor-react-native/src/icons/Wrench";
import { XIcon } from "phosphor-react-native/src/icons/X";
import { XCircleIcon } from "phosphor-react-native/src/icons/XCircle";
import { I18nManager } from "react-native";
import { useTheme } from "./theme";

const icons = {
	"arrow-clockwise": ArrowClockwiseIcon,
	"arrow-counter-clockwise": ArrowCounterClockwiseIcon,
	"arrow-down": ArrowDownIcon,
	"arrow-left": ArrowLeftIcon,
	"arrow-right": ArrowRightIcon,
	"arrow-square-out": ArrowSquareOutIcon,
	"arrow-u-up-left": ArrowUUpLeftIcon,
	"arrow-u-up-right": ArrowUUpRightIcon,
	"arrow-up": ArrowUpIcon,
	"arrow-up-right": ArrowUpRightIcon,
	"arrows-clockwise": ArrowsClockwiseIcon,
	"arrows-down-up": ArrowsDownUpIcon,
	"arrows-in-line-vertical": ArrowsInLineVerticalIcon,
	"arrows-in-simple": ArrowsInSimpleIcon,
	"arrows-left-right": ArrowsLeftRightIcon,
	"arrows-out-simple": ArrowsOutSimpleIcon,
	bell: BellIcon,
	"book-open": BookOpenIcon,
	"book-open-text": BookOpenTextIcon,
	"bookmark-simple": BookmarkSimpleIcon,
	books: BooksIcon,
	"brackets-curly": BracketsCurlyIcon,
	brain: BrainIcon,
	briefcase: BriefcaseIcon,
	bug: BugIcon,
	"calendar-blank": CalendarBlankIcon,
	"calendar-dot": CalendarDotIcon,
	"calendar-dots": CalendarDotsIcon,
	"calendar-plus": CalendarPlusIcon,
	camera: CameraIcon,
	"camera-plus": CameraPlusIcon,
	"caret-down": CaretDownIcon,
	"caret-left": CaretLeftIcon,
	"caret-right": CaretRightIcon,
	"chart-line-up": ChartLineUpIcon,
	"chat-centered-text": ChatCenteredTextIcon,
	"chat-text": ChatTextIcon,
	check: CheckIcon,
	"check-circle": CheckCircleIcon,
	"check-square": CheckSquareIcon,
	circle: CircleIcon,
	"circle-half": CircleHalfIcon,
	"clipboard-text": ClipboardTextIcon,
	clock: ClockIcon,
	"clock-counter-clockwise": ClockCounterClockwiseIcon,
	"cloud-check": CloudCheckIcon,
	"cloud-slash": CloudSlashIcon,
	"cloud-warning": CloudWarningIcon,
	code: CodeIcon,
	compass: CompassIcon,
	copy: CopyIcon,
	"discord-logo": DiscordLogoIcon,
	"dots-six-vertical": DotsSixVerticalIcon,
	"dots-three": DotsThreeIcon,
	"dots-three-vertical": DotsThreeVerticalIcon,
	"download-simple": DownloadSimpleIcon,
	envelope: EnvelopeIcon,
	"envelope-simple": EnvelopeSimpleIcon,
	export: ExportIcon,
	eye: EyeIcon,
	"eye-slash": EyeSlashIcon,
	file: FileIcon,
	"file-arrow-up": FileArrowUpIcon,
	"file-doc": FileDocIcon,
	"file-pdf": FilePdfIcon,
	"file-plus": FilePlusIcon,
	"file-text": FileTextIcon,
	fingerprint: FingerprintIcon,
	"gear-six": GearSixIcon,
	"github-logo": GithubLogoIcon,
	globe: GlobeIcon,
	"globe-hemisphere-west": GlobeHemisphereWestIcon,
	"globe-simple": GlobeSimpleIcon,
	"graduation-cap": GraduationCapIcon,
	graph: GraphIcon,
	"hand-heart": HandHeartIcon,
	highlighter: HighlighterIcon,
	hourglass: HourglassIcon,
	house: HouseIcon,
	image: ImageIcon,
	info: InfoIcon,
	kanban: KanbanIcon,
	key: KeyIcon,
	keyboard: KeyboardIcon,
	lightning: LightningIcon,
	"link-break": LinkBreakIcon,
	"link-simple-horizontal": LinkSimpleHorizontalIcon,
	"link-simple-horizontal-break": LinkSimpleHorizontalBreakIcon,
	"list-bullets": ListBulletsIcon,
	"list-checks": ListChecksIcon,
	"list-dashes": ListDashesIcon,
	"list-magnifying-glass": ListMagnifyingGlassIcon,
	"list-numbers": ListNumbersIcon,
	lock: LockIcon,
	"lock-open": LockOpenIcon,
	"magic-wand": MagicWandIcon,
	"magnifying-glass": MagnifyingGlassIcon,
	"magnifying-glass-minus": MagnifyingGlassMinusIcon,
	"magnifying-glass-plus": MagnifyingGlassPlusIcon,
	"map-pin": MapPinIcon,
	microphone: MicrophoneIcon,
	minus: MinusIcon,
	moon: MoonIcon,
	note: NoteIcon,
	"note-pencil": NotePencilIcon,
	palette: PaletteIcon,
	paragraph: ParagraphIcon,
	paperclip: PaperclipIcon,
	password: PasswordIcon,
	pause: PauseIcon,
	"pencil-line": PencilLineIcon,
	"pencil-simple": PencilSimpleIcon,
	phone: PhoneIcon,
	play: PlayIcon,
	"plugs-connected": PlugsConnectedIcon,
	plus: PlusIcon,
	"plus-circle": PlusCircleIcon,
	printer: PrinterIcon,
	"qr-code": QrCodeIcon,
	question: QuestionIcon,
	robot: RobotIcon,
	rows: RowsIcon,
	scales: ScalesIcon,
	scissors: ScissorsIcon,
	scroll: ScrollIcon,
	"seal-check": SealCheckIcon,
	"share-network": ShareNetworkIcon,
	"shield-check": ShieldCheckIcon,
	"sidebar-simple": SidebarSimpleIcon,
	"sign-out": SignOutIcon,
	"sliders-horizontal": SlidersHorizontalIcon,
	sparkle: SparkleIcon,
	"terminal-window": TerminalWindowIcon,
	"speaker-high": SpeakerHighIcon,
	square: SquareIcon,
	"square-split-horizontal": SquareSplitHorizontalIcon,
	"squares-four": SquaresFourIcon,
	star: StarIcon,
	stop: StopIcon,
	"stop-circle": StopCircleIcon,
	sun: SunIcon,
	tag: TagIcon,
	"text-aa": TextAaIcon,
	"text-align-center": TextAlignCenterIcon,
	"text-align-justify": TextAlignJustifyIcon,
	"text-align-left": TextAlignLeftIcon,
	"text-align-right": TextAlignRightIcon,
	"text-h-one": TextHOneIcon,
	"text-h-three": TextHThreeIcon,
	"text-h-two": TextHTwoIcon,
	"text-indent": TextIndentIcon,
	"text-outdent": TextOutdentIcon,
	"text-strikethrough": TextStrikethroughIcon,
	"text-underline": TextUnderlineIcon,
	"text-b": TextBIcon,
	"text-italic": TextItalicIcon,
	"text-t": TextTIcon,
	"text-t-slash": TextTSlashIcon,
	"thumbs-up": ThumbsUpIcon,
	timer: TimerIcon,
	translate: TranslateIcon,
	trash: TrashIcon,
	tray: TrayIcon,
	"trend-up": TrendUpIcon,
	"upload-simple": UploadSimpleIcon,
	"user-circle": UserCircleIcon,
	"user-plus": UserPlusIcon,
	"user-sound": UserSoundIcon,
	vibrate: VibrateIcon,
	warning: WarningIcon,
	"warning-circle": WarningCircleIcon,
	waveform: WaveformIcon,
	"wifi-slash": WifiSlashIcon,
	wrench: WrenchIcon,
	x: XIcon,
	"x-circle": XCircleIcon,
} satisfies Record<string, PhosphorIcon>;

export type IconName = keyof typeof icons;

// Icons that point somewhere are mirrored in right-to-left layouts.
const DIRECTIONAL_ICONS = new Set<IconName>([
	"arrow-left",
	"arrow-right",
	"arrow-u-up-left",
	"arrow-u-up-right",
	"caret-left",
	"caret-right",
]);

export type IconProps = {
	name: IconName;
	/** The filled glyph. The design system reserves it for the selected navigation item. */
	filled?: boolean | undefined;
	/** Glyph size in pt: 16 inline meta, 20 list rows, 22 toolbars, 24 tab bar and nav bar (tokens `size.icon`). */
	size?: number | undefined;
	/** Defaults to the theme `ink`. */
	color?: string | undefined;
};

/** A decorative Phosphor glyph: the control it sits in carries the accessible name. */
export function Icon({ name, filled = false, size = 20, color }: IconProps) {
	const { colors } = useTheme();
	const Glyph = icons[name];

	return (
		<Glyph
			size={size}
			color={color ?? colors.ink}
			weight={filled ? "fill" : "regular"}
			mirrored={I18nManager.isRTL && DIRECTIONAL_ICONS.has(name)}
		/>
	);
}