1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384 |
- import {Fragment, useState} from 'react';
- import styled from '@emotion/styled';
- import {PlatformIcon, platforms} from 'platformicons';
- import Input from 'sentry/components/input';
- import {Sticky} from 'sentry/components/sticky';
- import JSXNode from 'sentry/components/stories/jsxNode';
- import {Tooltip} from 'sentry/components/tooltip';
- import * as Icons from 'sentry/icons';
- import {space} from 'sentry/styles/space';
- type TIcon = {
- id: string;
- name: string;
- additionalProps?: string[];
- defaultProps?: Record<string, unknown>;
- groups?: string[];
- keywords?: string[];
- };
- type TSection = {
- icons: TIcon[];
- id: string;
- label: string;
- };
- const SECTIONS: TSection[] = [
- {
- id: 'product',
- label: 'Product',
- icons: [
- {
- id: 'dashboard',
- groups: ['product'],
- keywords: ['overview', 'group', 'organize', 'widgets'],
- name: 'Dashboard',
- defaultProps: {},
- },
- {
- id: 'stats',
- groups: ['product'],
- keywords: ['bar', 'graph'],
- name: 'Stats',
- defaultProps: {},
- },
- {
- id: 'project',
- groups: ['product'],
- keywords: [],
- name: 'Project',
- defaultProps: {},
- },
- {
- id: 'issues',
- groups: ['product'],
- keywords: ['stack'],
- name: 'Issues',
- defaultProps: {},
- },
- {
- id: 'releases',
- groups: ['product'],
- keywords: ['stack', 'versions'],
- name: 'Releases',
- defaultProps: {},
- },
- {
- id: 'archive',
- groups: ['product'],
- keywords: [],
- name: 'Archive',
- defaultProps: {},
- },
- {
- id: 'support',
- groups: ['product'],
- keywords: ['microphone', 'help'],
- name: 'Support',
- defaultProps: {},
- },
- {
- id: 'settings',
- groups: ['product'],
- keywords: ['preference'],
- name: 'Settings',
- defaultProps: {},
- },
- {
- id: 'lab',
- groups: ['product'],
- keywords: ['experiment', 'test'],
- name: 'Lab',
- defaultProps: {},
- },
- {
- id: 'broadcast',
- groups: ['product'],
- keywords: ['stream'],
- name: 'Broadcast',
- defaultProps: {},
- },
- {
- id: 'wifi',
- groups: ['product'],
- keywords: ['internet'],
- name: 'Wifi',
- defaultProps: {},
- },
- {
- id: 'telescope',
- groups: ['product'],
- keywords: [],
- name: 'Telescope',
- defaultProps: {},
- },
- {
- id: 'lightning',
- groups: ['product'],
- keywords: ['feature', 'new', 'fresh'],
- name: 'Lightning',
- defaultProps: {},
- },
- {
- id: 'business',
- groups: ['product'],
- keywords: ['feature', 'promotion', 'fresh', 'new'],
- name: 'Business',
- defaultProps: {},
- },
- {
- id: 'siren',
- groups: ['product'],
- keywords: ['alert', 'important', 'warning'],
- name: 'Siren',
- defaultProps: {},
- },
- {
- id: 'profiling',
- groups: ['product', 'chart'],
- keywords: ['performance', 'span', 'flame', 'icicle'],
- name: 'Profiling',
- defaultProps: {},
- },
- {
- id: 'timer',
- groups: ['product', 'action'],
- keywords: ['cron', 'monitors', 'clock', 'cycle'],
- name: 'Timer',
- defaultProps: {},
- },
- ],
- },
- {
- id: 'logo',
- label: 'Logos',
- icons: [
- {
- id: 'sentry',
- groups: ['logo'],
- keywords: [],
- name: 'Sentry',
- defaultProps: {},
- },
- {
- id: 'codecov',
- groups: ['logo'],
- keywords: [],
- name: 'Codecov',
- defaultProps: {},
- },
- {
- id: 'bitbucket',
- groups: ['logo'],
- keywords: [],
- name: 'Bitbucket',
- defaultProps: {},
- },
- {
- id: 'discord',
- groups: ['logo'],
- keywords: [],
- name: 'Discord',
- defaultProps: {},
- },
- {
- id: 'github',
- groups: ['logo'],
- keywords: [],
- name: 'Github',
- defaultProps: {},
- },
- {
- id: 'gitlab',
- groups: ['logo'],
- keywords: [],
- name: 'Gitlab',
- defaultProps: {},
- },
- {
- id: 'google',
- groups: ['logo'],
- keywords: [],
- name: 'Google',
- defaultProps: {},
- },
- {
- id: 'jira',
- groups: ['logo'],
- keywords: [],
- name: 'Jira',
- defaultProps: {},
- },
- {
- id: 'trello',
- groups: ['logo'],
- keywords: [],
- name: 'Trello',
- defaultProps: {},
- },
- {
- id: 'vsts',
- groups: ['logo'],
- keywords: [],
- name: 'Vsts',
- defaultProps: {},
- },
- {
- id: 'generic',
- groups: ['logo'],
- keywords: [],
- name: 'Generic',
- defaultProps: {},
- },
- {
- id: 'asana',
- groups: ['logo'],
- keywords: [''],
- name: 'Asana',
- defaultProps: {},
- },
- {
- id: 'vercel',
- groups: ['logo'],
- keywords: [''],
- name: 'Vercel',
- defaultProps: {},
- },
- {
- id: 'teamwork',
- groups: ['logo'],
- keywords: [],
- name: 'Teamwork',
- defaultProps: {},
- },
- ],
- },
- {
- id: 'navigation',
- label: 'Navigation',
- icons: [
- {
- id: 'chevron-direction-left',
- groups: ['navigation'],
- keywords: [
- 'up',
- 'down',
- 'left',
- 'right',
- 'point',
- 'direct',
- 'move',
- 'expand',
- 'collapse',
- 'arrow',
- ],
- additionalProps: ['isCircled', 'direction'],
- name: 'Chevron',
- defaultProps: {
- isCircled: false,
- direction: 'left',
- },
- },
- {
- id: 'chevron-direction-right',
- name: 'Chevron',
- defaultProps: {
- isCircled: false,
- direction: 'right',
- },
- },
- {
- id: 'chevron-direction-up',
- name: 'Chevron',
- defaultProps: {
- isCircled: false,
- direction: 'up',
- },
- },
- {
- id: 'chevron-direction-down',
- name: 'Chevron',
- defaultProps: {
- isCircled: false,
- direction: 'down',
- },
- },
- {
- id: 'chevron-isCircled-direction-left',
- name: 'Chevron',
- defaultProps: {
- isCircled: true,
- direction: 'left',
- },
- },
- {
- id: 'chevron-isCircled-direction-right',
- name: 'Chevron',
- defaultProps: {
- isCircled: true,
- direction: 'right',
- },
- },
- {
- id: 'chevron-isCircled-direction-up',
- name: 'Chevron',
- defaultProps: {
- isCircled: true,
- direction: 'up',
- },
- },
- {
- id: 'chevron-isCircled-direction-down',
- name: 'Chevron',
- defaultProps: {
- isCircled: true,
- direction: 'down',
- },
- },
- {
- id: 'arrow-direction-left',
- groups: ['navigation'],
- keywords: ['up', 'down', 'left', 'right', 'point', 'direct', 'move'],
- additionalProps: ['direction'],
- name: 'Arrow',
- defaultProps: {
- direction: 'left',
- },
- },
- {
- id: 'arrow-direction-right',
- name: 'Arrow',
- defaultProps: {
- direction: 'right',
- },
- },
- {
- id: 'arrow-direction-up',
- name: 'Arrow',
- defaultProps: {
- direction: 'up',
- },
- },
- {
- id: 'arrow-direction-down',
- name: 'Arrow',
- defaultProps: {
- direction: 'down',
- },
- },
- {
- id: 'panel-direction-left',
- groups: ['navigation'],
- keywords: ['sidebar', 'footer', 'header'],
- additionalProps: ['direction'],
- name: 'Panel',
- defaultProps: {
- direction: 'left',
- },
- },
- {
- id: 'panel-direction-right',
- name: 'Panel',
- defaultProps: {
- direction: 'right',
- },
- },
- {
- id: 'panel-direction-up',
- name: 'Panel',
- defaultProps: {
- direction: 'up',
- },
- },
- {
- id: 'panel-direction-down',
- name: 'Panel',
- defaultProps: {
- direction: 'down',
- },
- },
- ],
- },
- {
- id: 'status',
- label: 'Status',
- icons: [
- {
- id: 'lock',
- groups: ['action', 'status'],
- keywords: ['secure'],
- additionalProps: ['isSolid'],
- name: 'Lock',
- defaultProps: {
- isSolid: false,
- },
- },
- {
- id: 'lock-isSolid',
- name: 'Lock',
- defaultProps: {
- isSolid: true,
- },
- },
- {
- id: 'fire',
- groups: ['status'],
- keywords: ['danger', 'severe', 'critical'],
- name: 'Fire',
- defaultProps: {},
- },
- {
- id: 'fatal',
- groups: ['status'],
- keywords: ['skull'],
- name: 'Fatal',
- defaultProps: {},
- },
- {
- id: 'warning',
- groups: ['status'],
- keywords: ['alert', 'notification'],
- name: 'Warning',
- defaultProps: {},
- },
- {
- id: 'exclamation',
- groups: ['status'],
- keywords: ['alert', 'warning'],
- name: 'Exclamation',
- defaultProps: {},
- },
- {
- id: 'not',
- groups: ['status'],
- keywords: ['invalid', 'no', 'forbidden'],
- name: 'Not',
- defaultProps: {},
- },
- {
- id: 'circle',
- groups: ['status'],
- keywords: ['shape', 'round'],
- name: 'Circle',
- defaultProps: {},
- },
- {
- id: 'circleFill',
- groups: ['status'],
- keywords: ['shape', 'round'],
- name: 'CircleFill',
- defaultProps: {},
- },
- {
- id: 'diamond',
- groups: ['status'],
- keywords: ['shape', 'alert', 'diamond'],
- name: 'Diamond',
- defaultProps: {},
- },
- {
- id: 'flag',
- groups: ['status'],
- keywords: ['bookmark', 'mark', 'save', 'warning', 'message'],
- name: 'Flag',
- defaultProps: {},
- },
- {
- id: 'happy',
- groups: ['status'],
- keywords: ['good'],
- name: 'Happy',
- defaultProps: {},
- },
- {
- id: 'meh',
- groups: ['status'],
- keywords: ['meh'],
- name: 'Meh',
- defaultProps: {},
- },
- {
- id: 'sad',
- groups: ['status'],
- keywords: ['poor'],
- name: 'Sad',
- defaultProps: {},
- },
- {
- id: 'frozen',
- groups: ['status'],
- keywords: ['frame', 'mobile'],
- name: 'Frozen',
- defaultProps: {},
- },
- {
- id: 'slow',
- groups: ['status'],
- keywords: ['frame', 'mobile'],
- name: 'Slow',
- defaultProps: {},
- },
- ],
- },
- {
- id: 'action',
- label: 'Action',
- icons: [
- {
- id: 'add',
- groups: ['action'],
- keywords: ['plus'],
- additionalProps: ['isCircled'],
- name: 'Add',
- defaultProps: {
- isCircled: false,
- },
- },
- {
- id: 'add-isCircled',
- name: 'Add',
- defaultProps: {
- isCircled: true,
- },
- },
- {
- id: 'subtract',
- groups: ['action'],
- keywords: ['minus'],
- additionalProps: ['isCircled'],
- name: 'Subtract',
- defaultProps: {
- isCircled: false,
- },
- },
- {
- id: 'subtract-isCircled',
- name: 'Subtract',
- defaultProps: {
- isCircled: true,
- },
- },
- {
- id: 'checkmark',
- groups: ['action'],
- keywords: ['done', 'finish', 'success', 'confirm', 'resolve'],
- additionalProps: ['isCircled'],
- name: 'Checkmark',
- defaultProps: {
- isCircled: false,
- },
- },
- {
- id: 'checkmark-isCircled',
- name: 'Checkmark',
- defaultProps: {
- isCircled: true,
- },
- },
- {
- id: 'close',
- groups: ['action'],
- keywords: ['cross', 'deny', 'terminate'],
- additionalProps: ['isCircled'],
- name: 'Close',
- defaultProps: {
- isCircled: false,
- },
- },
- {
- id: 'close-isCircled',
- name: 'Close',
- defaultProps: {
- isCircled: true,
- },
- },
- {
- id: 'upload',
- groups: ['action'],
- keywords: ['file', 'image', 'up'],
- name: 'Upload',
- defaultProps: {},
- },
- {
- id: 'download',
- groups: ['action'],
- keywords: ['file', 'image', 'down'],
- name: 'Download',
- defaultProps: {},
- },
- {
- id: 'sync',
- groups: ['action'],
- keywords: ['swap'],
- name: 'Sync',
- defaultProps: {},
- },
- {
- id: 'menu',
- groups: ['action'],
- keywords: ['navigate'],
- name: 'Menu',
- defaultProps: {},
- },
- {
- id: 'list',
- groups: ['action'],
- keywords: ['item'],
- name: 'List',
- defaultProps: {},
- },
- {
- id: 'upgrade',
- groups: ['action'],
- keywords: ['up'],
- name: 'Upgrade',
- defaultProps: {},
- },
- {
- id: 'open',
- groups: ['action'],
- keywords: ['link', 'hyperlink', 'external'],
- name: 'Open',
- defaultProps: {},
- },
- {
- id: 'refresh',
- groups: ['action'],
- keywords: ['reload', 'restart', 'repeat'],
- name: 'Refresh',
- defaultProps: {},
- },
- {
- id: 'bookmark',
- groups: ['action'],
- keywords: ['favorite', 'star', 'mark'],
- additionalProps: ['isSolid'],
- name: 'Bookmark',
- defaultProps: {
- isSolid: false,
- },
- },
- {
- id: 'bookmark-isSolid',
- name: 'Bookmark',
- defaultProps: {
- isSolid: true,
- },
- },
- {
- id: 'pin',
- groups: ['action'],
- keywords: ['stick'],
- additionalProps: ['isSolid'],
- name: 'Pin',
- defaultProps: {
- isSolid: false,
- },
- },
- {
- id: 'pin-isSolid',
- name: 'Pin',
- defaultProps: {
- isSolid: true,
- },
- },
- {
- id: 'star',
- groups: ['action'],
- keywords: ['favorite', 'star', 'bookmark'],
- additionalProps: ['isSolid'],
- name: 'Star',
- defaultProps: {
- isSolid: false,
- },
- },
- {
- id: 'star-isSolid',
- name: 'Star',
- defaultProps: {
- isSolid: true,
- },
- },
- {
- id: 'archive',
- groups: ['product'],
- keywords: [],
- name: 'Archive',
- defaultProps: {},
- },
- {
- id: 'play',
- groups: ['action'],
- keywords: ['video', 'audio', 'unpause'],
- name: 'Play',
- defaultProps: {},
- },
- {
- id: 'pause',
- groups: ['action'],
- keywords: ['video', 'audio', 'stop'],
- name: 'Pause',
- defaultProps: {},
- },
- {
- id: 'previous',
- groups: ['action'],
- keywords: ['video', 'audio', 'back', 'return', 'rewind'],
- name: 'Previous',
- defaultProps: {},
- },
- {
- id: 'next',
- groups: ['action'],
- keywords: ['video', 'audio', 'skip', 'forward'],
- name: 'Next',
- defaultProps: {},
- },
- {
- id: 'search',
- groups: ['action'],
- keywords: ['find', 'look', 'query'],
- name: 'Search',
- defaultProps: {},
- },
- {
- id: 'copy',
- groups: ['action'],
- keywords: ['duplicate'],
- name: 'Copy',
- defaultProps: {},
- },
- {
- id: 'delete',
- groups: ['action'],
- keywords: ['trash', 'can', 'dumpster', 'remove', 'erase', 'clear'],
- name: 'Delete',
- defaultProps: {},
- },
- {
- id: 'docs',
- groups: ['action'],
- keywords: ['document'],
- name: 'Docs',
- defaultProps: {},
- },
- {
- id: 'link',
- groups: ['action'],
- keywords: ['hyperlink'],
- name: 'Link',
- defaultProps: {},
- },
- {
- id: 'attachment',
- groups: ['action'],
- keywords: ['include', 'clip'],
- name: 'Attachment',
- defaultProps: {},
- },
- {
- id: 'location',
- groups: ['action'],
- keywords: ['pin', 'position', 'map'],
- name: 'Location',
- defaultProps: {},
- },
- {
- id: 'edit',
- groups: ['action'],
- keywords: ['pencil'],
- name: 'Edit',
- defaultProps: {},
- },
- {
- id: 'filter',
- groups: ['action'],
- keywords: [],
- name: 'Filter',
- defaultProps: {},
- },
- {
- id: 'sort',
- groups: ['action'],
- keywords: [],
- name: 'Sort',
- defaultProps: {},
- },
- {
- id: 'show',
- groups: ['action'],
- keywords: ['visible'],
- name: 'Show',
- defaultProps: {},
- },
- {
- id: 'lock',
- name: 'Lock',
- defaultProps: {
- isSolid: false,
- },
- },
- {
- id: 'lock-isSolid',
- name: 'Lock',
- defaultProps: {
- isSolid: true,
- },
- },
- {
- id: 'grabbable',
- groups: ['action'],
- keywords: ['move', 'arrange', 'organize', 'rank', 'switch'],
- name: 'Grabbable',
- defaultProps: {},
- },
- {
- id: 'ellipsis',
- groups: ['action'],
- keywords: ['expand', 'open', 'more', 'hidden'],
- name: 'Ellipsis',
- defaultProps: {},
- },
- {
- id: 'megaphone',
- groups: ['action'],
- keywords: ['speaker', 'announce'],
- name: 'Megaphone',
- defaultProps: {},
- },
- {
- id: 'question',
- groups: ['action'],
- keywords: ['info', 'about', 'information', 'ask', 'faq', 'q&a'],
- name: 'Question',
- defaultProps: {},
- },
- {
- id: 'info',
- groups: ['action'],
- keywords: ['more', 'about', 'information', 'ask', 'faq', 'q&a'],
- name: 'Info',
- defaultProps: {},
- },
- {
- id: 'user',
- groups: ['action'],
- keywords: ['person', 'portrait'],
- name: 'User',
- defaultProps: {},
- },
- {
- id: 'chat',
- groups: ['action', 'action'],
- keywords: ['message', 'bubble'],
- name: 'Chat',
- defaultProps: {},
- },
- {
- id: 'clock',
- groups: ['action'],
- keywords: ['time', 'watch'],
- name: 'Clock',
- defaultProps: {},
- },
- {
- id: 'sliders-direction-left',
- groups: ['action'],
- keywords: ['settings', 'slide', 'adjust'],
- additionalProps: ['direction'],
- name: 'Sliders',
- defaultProps: {
- direction: 'left',
- },
- },
- {
- id: 'sliders-direction-up',
- name: 'Sliders',
- defaultProps: {
- direction: 'up',
- },
- },
- {
- id: 'toggle',
- groups: ['action'],
- keywords: ['switch', 'form', 'disable', 'enable'],
- name: 'Toggle',
- defaultProps: {},
- },
- {
- id: 'fix',
- groups: ['action'],
- keywords: ['wrench', 'resolve'],
- name: 'Fix',
- defaultProps: {},
- },
- {
- id: 'tag',
- groups: ['action'],
- keywords: ['price', 'category', 'group'],
- name: 'Tag',
- defaultProps: {},
- },
- {
- id: 'moon',
- groups: ['action'],
- keywords: ['dark', 'night'],
- name: 'Moon',
- defaultProps: {},
- },
- {
- id: 'subscribed',
- groups: ['action'],
- keywords: ['alert', 'notification', 'subscribe', 'bell', 'ring'],
- name: 'Subscribed',
- defaultProps: {},
- },
- {
- id: 'unsubscribed',
- groups: ['action'],
- keywords: ['alert', 'notification', 'subscribe', 'bell', 'ring'],
- name: 'Unsubscribed',
- defaultProps: {},
- },
- {
- id: 'sound',
- groups: ['action'],
- keywords: ['audio'],
- name: 'Sound',
- defaultProps: {},
- },
- {
- id: 'mute',
- groups: ['action'],
- keywords: ['audio'],
- name: 'Mute',
- defaultProps: {},
- },
- {
- id: 'resize',
- groups: ['action'],
- keywords: ['scale', 'stretch'],
- name: 'Resize',
- defaultProps: {},
- },
- {
- id: 'expand',
- groups: ['action'],
- keywords: ['open'],
- name: 'Expand',
- defaultProps: {},
- },
- {
- id: 'contract',
- groups: ['action'],
- keywords: ['close'],
- name: 'Contract',
- defaultProps: {},
- },
- {
- id: 'group',
- groups: ['action'],
- keywords: ['users', 'person', 'people'],
- name: 'Group',
- defaultProps: {},
- },
- {
- id: 'rewind10',
- groups: ['action'],
- keywords: ['rewind'],
- name: 'Rewind10',
- defaultProps: {},
- },
- {
- id: 'timer',
- name: 'Timer',
- defaultProps: {},
- },
- {
- id: 'cursorArrow',
- keywords: ['pointer', 'mouse'],
- name: 'CursorArrow',
- defaultProps: {},
- },
- {
- id: 'keyDown',
- keywords: ['keyboard', 'press', 'click', 'tap'],
- name: 'KeyDown',
- defaultProps: {},
- },
- {
- id: 'zoom-out',
- keywords: [],
- name: 'Zoom',
- defaultProps: {isZoomIn: false},
- },
- {
- id: 'zoom-in',
- keywords: [],
- name: 'Zoom',
- defaultProps: {isZoomIn: true},
- },
- {
- id: 'focus',
- keywords: ['foreground'],
- name: 'Focus',
- defaultProps: {isFocused: true},
- },
- {
- id: 'blur',
- keywords: ['background'],
- name: 'Focus',
- defaultProps: {isFocused: false},
- },
- {
- id: 'tap',
- keywords: ['finger', 'hand', 'cursor'],
- name: 'Tap',
- defaultProps: {},
- },
- ],
- },
- {
- id: 'chart',
- label: 'Chart',
- icons: [
- {
- id: 'graph-type-line',
- groups: ['chart'],
- keywords: ['line', 'plot'],
- additionalProps: ['type'],
- name: 'Graph',
- defaultProps: {
- type: 'line',
- },
- },
- {
- id: 'graph-type-circle',
- name: 'Graph',
- defaultProps: {
- type: 'circle',
- },
- },
- {
- id: 'graph-type-bar',
- name: 'Graph',
- defaultProps: {
- type: 'bar',
- },
- },
- {
- id: 'graph-type-area',
- name: 'Graph',
- defaultProps: {
- type: 'area',
- },
- },
- {
- id: 'stack',
- groups: ['chart'],
- keywords: ['group', 'combine', 'view'],
- name: 'Stack',
- defaultProps: {},
- },
- {
- id: 'span',
- groups: ['chart'],
- keywords: ['performance', 'transaction'],
- name: 'Span',
- defaultProps: {},
- },
- {
- id: 'number',
- groups: ['chart'],
- keywords: ['value'],
- name: 'Number',
- defaultProps: {},
- },
- {
- id: 'profiling',
- name: 'Profiling',
- defaultProps: {},
- },
- ],
- },
- {
- id: 'device',
- label: 'Device',
- icons: [
- {
- id: 'return',
- groups: ['device'],
- keywords: ['enter'],
- name: 'Return',
- defaultProps: {},
- },
- {
- id: 'file',
- groups: ['device'],
- keywords: ['document'],
- name: 'File',
- defaultProps: {},
- },
- {
- id: 'print',
- groups: ['device'],
- keywords: [],
- name: 'Print',
- defaultProps: {},
- },
- {
- id: 'code',
- groups: ['device'],
- keywords: ['snippet', 'javascript', 'json', 'curly', 'source'],
- name: 'Code',
- defaultProps: {},
- },
- {
- id: 'json',
- groups: ['device'],
- keywords: ['snippet', 'code', 'javascript', 'source'],
- name: 'Json',
- defaultProps: {},
- },
- {
- id: 'markdown',
- groups: ['device'],
- keywords: ['code'],
- name: 'Markdown',
- defaultProps: {},
- },
- {
- id: 'terminal',
- groups: ['device', 'device'],
- keywords: ['code', 'bash', 'command'],
- name: 'Terminal',
- defaultProps: {},
- },
- {
- id: 'commit',
- groups: ['device'],
- keywords: ['git', 'github'],
- name: 'Commit',
- defaultProps: {},
- },
- {
- id: 'laptop',
- groups: ['device'],
- keywords: ['computer', 'macbook'],
- name: 'Laptop',
- defaultProps: {},
- },
- {
- id: 'mobile',
- groups: ['device'],
- keywords: ['phone', 'iphone'],
- name: 'Mobile',
- defaultProps: {},
- },
- {
- id: 'window',
- groups: ['device'],
- keywords: ['application'],
- name: 'Window',
- defaultProps: {},
- },
- {
- id: 'calendar',
- groups: ['device'],
- keywords: ['time', 'date'],
- name: 'Calendar',
- defaultProps: {},
- },
- {
- id: 'mail',
- groups: ['device'],
- keywords: ['email'],
- name: 'Mail',
- defaultProps: {},
- },
- {
- id: 'input',
- groups: ['device'],
- keywords: ['text'],
- name: 'Input',
- defaultProps: {},
- },
- {
- id: 'option',
- groups: ['device'],
- keywords: [''],
- name: 'Option',
- defaultProps: {},
- },
- {
- id: 'fileBroken',
- groups: ['device'],
- keywords: ['file', 'missing', 'error'],
- name: 'FileBroken',
- defaultProps: {},
- },
- {
- id: 'image',
- groups: ['device'],
- keywords: ['image', 'photo', 'screenshot'],
- name: 'Image',
- defaultProps: {},
- },
- ],
- },
- ];
- export default function IconsStories() {
- const [searchTerm, setSearchTerm] = useState('');
- const definedWithPrefix = new Set<string>();
- SECTIONS.forEach(section =>
- section.icons.forEach(icon => definedWithPrefix.add(`Icon${icon.name}`))
- );
- const unclassifiedSection = {
- id: 'other',
- label: 'Unclassified',
- icons: Object.keys(Icons)
- .filter(name => !definedWithPrefix.has(name))
- .map((name): TIcon => ({id: name, name})),
- };
- const filteredSections = searchTerm
- ? SECTIONS.map(section => ({
- ...section,
- icons: section.icons.filter(
- icon =>
- icon.name.toLowerCase().includes(searchTerm) ||
- icon.keywords?.some(keyword => keyword.toLowerCase().includes(searchTerm))
- ),
- }))
- : SECTIONS;
- return (
- <Fragment>
- <StyledSticky>
- <p>
- In addition to icon name, you can also search by keyword. For example, typing
- either <kbd>checkmark</kbd> or <kbd>success</kbd> will return{' '}
- <samp>IconCheckmark</samp>.
- </p>
- <Input
- placeholder="Search icons by name or keyword"
- onChange={e => setSearchTerm(e.target.value.toLowerCase())}
- />
- </StyledSticky>
- <Section section={unclassifiedSection} />
- {filteredSections.map(section => (
- <Section key={section.id} section={section} />
- ))}
- <PlatformIconsSection searchTerm={searchTerm} />
- </Fragment>
- );
- }
- function Section({section}: {section: TSection}) {
- if (section.icons.length === 0) {
- return null;
- }
- return (
- <section>
- <SectionHeader>{section.label}</SectionHeader>
- <p>
- <code>{"import { ... } from 'sentry/icons';"}</code>
- </p>
- <Grid style={{gridTemplateColumns: 'repeat(4, 1fr)'}}>
- {section.icons.map(icon => {
- const name = icon.name.startsWith('Icon') ? icon.name : `Icon${icon.name}`;
- const Component = Icons[name];
- const props = {color: 'gray500', size: 'sm', ...icon.defaultProps};
- return (
- <Tooltip
- key={icon.id}
- isHoverable
- overlayStyle={{maxWidth: 440}}
- title={<JSXNode name={name} props={props} />}
- >
- <Cell>
- <Component {...props} />
- {name}
- </Cell>
- </Tooltip>
- );
- })}
- </Grid>
- </section>
- );
- }
- function PlatformIconsSection({searchTerm}: {searchTerm: string}) {
- const filteredPlatforms = platforms.filter(platform => platform.includes(searchTerm));
- return (
- <section>
- <SectionHeader>PlatformIcons</SectionHeader>
- <p>
- <code>{"import {PlatformIcon} from 'platformicons';"}</code>
- </p>
- <Grid
- style={{
- gridAutoFlow: 'column',
- gridTemplateRows: `repeat(${Math.ceil(filteredPlatforms.length / 4)}, 1fr)`,
- }}
- >
- {filteredPlatforms.map(platform => (
- <Tooltip
- key={platform}
- isHoverable
- overlayStyle={{maxWidth: 440}}
- title={
- <Fragment>
- <JSXNode name="PlatformIcon" props={{platform}} />
- </Fragment>
- }
- >
- <Cell>
- <PlatformIcon platform={platform} /> {platform}
- </Cell>
- </Tooltip>
- ))}
- </Grid>
- </section>
- );
- }
- const StyledSticky = styled(Sticky)`
- background: ${p => p.theme.background};
- z-index: ${p => p.theme.zIndex.initial};
- &[data-stuck='true'] {
- box-shadow: 0px 10px 20px -8px rgba(128, 128, 128, 0.89);
- }
- `;
- const SectionHeader = styled('h5')`
- margin-block: ${space(2)};
- `;
- const Grid = styled('div')`
- display: grid;
- gap: ${space(1)};
- align-items: center;
- `;
- const Cell = styled('div')`
- display: flex;
- gap: ${space(1)};
- align-items: center;
- border: 1px solid transparent;
- border-radius: ${p => p.theme.borderRadius};
- padding: ${space(1)};
- cursor: pointer;
- &:hover {
- border-color: ${p => p.theme.border};
- }
- `;
|