icons.stories.tsx 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384
  1. import {Fragment, useState} from 'react';
  2. import styled from '@emotion/styled';
  3. import {PlatformIcon, platforms} from 'platformicons';
  4. import Input from 'sentry/components/input';
  5. import {Sticky} from 'sentry/components/sticky';
  6. import JSXNode from 'sentry/components/stories/jsxNode';
  7. import {Tooltip} from 'sentry/components/tooltip';
  8. import * as Icons from 'sentry/icons';
  9. import {space} from 'sentry/styles/space';
  10. type TIcon = {
  11. id: string;
  12. name: string;
  13. additionalProps?: string[];
  14. defaultProps?: Record<string, unknown>;
  15. groups?: string[];
  16. keywords?: string[];
  17. };
  18. type TSection = {
  19. icons: TIcon[];
  20. id: string;
  21. label: string;
  22. };
  23. const SECTIONS: TSection[] = [
  24. {
  25. id: 'product',
  26. label: 'Product',
  27. icons: [
  28. {
  29. id: 'dashboard',
  30. groups: ['product'],
  31. keywords: ['overview', 'group', 'organize', 'widgets'],
  32. name: 'Dashboard',
  33. defaultProps: {},
  34. },
  35. {
  36. id: 'stats',
  37. groups: ['product'],
  38. keywords: ['bar', 'graph'],
  39. name: 'Stats',
  40. defaultProps: {},
  41. },
  42. {
  43. id: 'project',
  44. groups: ['product'],
  45. keywords: [],
  46. name: 'Project',
  47. defaultProps: {},
  48. },
  49. {
  50. id: 'issues',
  51. groups: ['product'],
  52. keywords: ['stack'],
  53. name: 'Issues',
  54. defaultProps: {},
  55. },
  56. {
  57. id: 'releases',
  58. groups: ['product'],
  59. keywords: ['stack', 'versions'],
  60. name: 'Releases',
  61. defaultProps: {},
  62. },
  63. {
  64. id: 'archive',
  65. groups: ['product'],
  66. keywords: [],
  67. name: 'Archive',
  68. defaultProps: {},
  69. },
  70. {
  71. id: 'support',
  72. groups: ['product'],
  73. keywords: ['microphone', 'help'],
  74. name: 'Support',
  75. defaultProps: {},
  76. },
  77. {
  78. id: 'settings',
  79. groups: ['product'],
  80. keywords: ['preference'],
  81. name: 'Settings',
  82. defaultProps: {},
  83. },
  84. {
  85. id: 'lab',
  86. groups: ['product'],
  87. keywords: ['experiment', 'test'],
  88. name: 'Lab',
  89. defaultProps: {},
  90. },
  91. {
  92. id: 'broadcast',
  93. groups: ['product'],
  94. keywords: ['stream'],
  95. name: 'Broadcast',
  96. defaultProps: {},
  97. },
  98. {
  99. id: 'wifi',
  100. groups: ['product'],
  101. keywords: ['internet'],
  102. name: 'Wifi',
  103. defaultProps: {},
  104. },
  105. {
  106. id: 'telescope',
  107. groups: ['product'],
  108. keywords: [],
  109. name: 'Telescope',
  110. defaultProps: {},
  111. },
  112. {
  113. id: 'lightning',
  114. groups: ['product'],
  115. keywords: ['feature', 'new', 'fresh'],
  116. name: 'Lightning',
  117. defaultProps: {},
  118. },
  119. {
  120. id: 'business',
  121. groups: ['product'],
  122. keywords: ['feature', 'promotion', 'fresh', 'new'],
  123. name: 'Business',
  124. defaultProps: {},
  125. },
  126. {
  127. id: 'siren',
  128. groups: ['product'],
  129. keywords: ['alert', 'important', 'warning'],
  130. name: 'Siren',
  131. defaultProps: {},
  132. },
  133. {
  134. id: 'profiling',
  135. groups: ['product', 'chart'],
  136. keywords: ['performance', 'span', 'flame', 'icicle'],
  137. name: 'Profiling',
  138. defaultProps: {},
  139. },
  140. {
  141. id: 'timer',
  142. groups: ['product', 'action'],
  143. keywords: ['cron', 'monitors', 'clock', 'cycle'],
  144. name: 'Timer',
  145. defaultProps: {},
  146. },
  147. ],
  148. },
  149. {
  150. id: 'logo',
  151. label: 'Logos',
  152. icons: [
  153. {
  154. id: 'sentry',
  155. groups: ['logo'],
  156. keywords: [],
  157. name: 'Sentry',
  158. defaultProps: {},
  159. },
  160. {
  161. id: 'codecov',
  162. groups: ['logo'],
  163. keywords: [],
  164. name: 'Codecov',
  165. defaultProps: {},
  166. },
  167. {
  168. id: 'bitbucket',
  169. groups: ['logo'],
  170. keywords: [],
  171. name: 'Bitbucket',
  172. defaultProps: {},
  173. },
  174. {
  175. id: 'discord',
  176. groups: ['logo'],
  177. keywords: [],
  178. name: 'Discord',
  179. defaultProps: {},
  180. },
  181. {
  182. id: 'github',
  183. groups: ['logo'],
  184. keywords: [],
  185. name: 'Github',
  186. defaultProps: {},
  187. },
  188. {
  189. id: 'gitlab',
  190. groups: ['logo'],
  191. keywords: [],
  192. name: 'Gitlab',
  193. defaultProps: {},
  194. },
  195. {
  196. id: 'google',
  197. groups: ['logo'],
  198. keywords: [],
  199. name: 'Google',
  200. defaultProps: {},
  201. },
  202. {
  203. id: 'jira',
  204. groups: ['logo'],
  205. keywords: [],
  206. name: 'Jira',
  207. defaultProps: {},
  208. },
  209. {
  210. id: 'trello',
  211. groups: ['logo'],
  212. keywords: [],
  213. name: 'Trello',
  214. defaultProps: {},
  215. },
  216. {
  217. id: 'vsts',
  218. groups: ['logo'],
  219. keywords: [],
  220. name: 'Vsts',
  221. defaultProps: {},
  222. },
  223. {
  224. id: 'generic',
  225. groups: ['logo'],
  226. keywords: [],
  227. name: 'Generic',
  228. defaultProps: {},
  229. },
  230. {
  231. id: 'asana',
  232. groups: ['logo'],
  233. keywords: [''],
  234. name: 'Asana',
  235. defaultProps: {},
  236. },
  237. {
  238. id: 'vercel',
  239. groups: ['logo'],
  240. keywords: [''],
  241. name: 'Vercel',
  242. defaultProps: {},
  243. },
  244. {
  245. id: 'teamwork',
  246. groups: ['logo'],
  247. keywords: [],
  248. name: 'Teamwork',
  249. defaultProps: {},
  250. },
  251. ],
  252. },
  253. {
  254. id: 'navigation',
  255. label: 'Navigation',
  256. icons: [
  257. {
  258. id: 'chevron-direction-left',
  259. groups: ['navigation'],
  260. keywords: [
  261. 'up',
  262. 'down',
  263. 'left',
  264. 'right',
  265. 'point',
  266. 'direct',
  267. 'move',
  268. 'expand',
  269. 'collapse',
  270. 'arrow',
  271. ],
  272. additionalProps: ['isCircled', 'direction'],
  273. name: 'Chevron',
  274. defaultProps: {
  275. isCircled: false,
  276. direction: 'left',
  277. },
  278. },
  279. {
  280. id: 'chevron-direction-right',
  281. name: 'Chevron',
  282. defaultProps: {
  283. isCircled: false,
  284. direction: 'right',
  285. },
  286. },
  287. {
  288. id: 'chevron-direction-up',
  289. name: 'Chevron',
  290. defaultProps: {
  291. isCircled: false,
  292. direction: 'up',
  293. },
  294. },
  295. {
  296. id: 'chevron-direction-down',
  297. name: 'Chevron',
  298. defaultProps: {
  299. isCircled: false,
  300. direction: 'down',
  301. },
  302. },
  303. {
  304. id: 'chevron-isCircled-direction-left',
  305. name: 'Chevron',
  306. defaultProps: {
  307. isCircled: true,
  308. direction: 'left',
  309. },
  310. },
  311. {
  312. id: 'chevron-isCircled-direction-right',
  313. name: 'Chevron',
  314. defaultProps: {
  315. isCircled: true,
  316. direction: 'right',
  317. },
  318. },
  319. {
  320. id: 'chevron-isCircled-direction-up',
  321. name: 'Chevron',
  322. defaultProps: {
  323. isCircled: true,
  324. direction: 'up',
  325. },
  326. },
  327. {
  328. id: 'chevron-isCircled-direction-down',
  329. name: 'Chevron',
  330. defaultProps: {
  331. isCircled: true,
  332. direction: 'down',
  333. },
  334. },
  335. {
  336. id: 'arrow-direction-left',
  337. groups: ['navigation'],
  338. keywords: ['up', 'down', 'left', 'right', 'point', 'direct', 'move'],
  339. additionalProps: ['direction'],
  340. name: 'Arrow',
  341. defaultProps: {
  342. direction: 'left',
  343. },
  344. },
  345. {
  346. id: 'arrow-direction-right',
  347. name: 'Arrow',
  348. defaultProps: {
  349. direction: 'right',
  350. },
  351. },
  352. {
  353. id: 'arrow-direction-up',
  354. name: 'Arrow',
  355. defaultProps: {
  356. direction: 'up',
  357. },
  358. },
  359. {
  360. id: 'arrow-direction-down',
  361. name: 'Arrow',
  362. defaultProps: {
  363. direction: 'down',
  364. },
  365. },
  366. {
  367. id: 'panel-direction-left',
  368. groups: ['navigation'],
  369. keywords: ['sidebar', 'footer', 'header'],
  370. additionalProps: ['direction'],
  371. name: 'Panel',
  372. defaultProps: {
  373. direction: 'left',
  374. },
  375. },
  376. {
  377. id: 'panel-direction-right',
  378. name: 'Panel',
  379. defaultProps: {
  380. direction: 'right',
  381. },
  382. },
  383. {
  384. id: 'panel-direction-up',
  385. name: 'Panel',
  386. defaultProps: {
  387. direction: 'up',
  388. },
  389. },
  390. {
  391. id: 'panel-direction-down',
  392. name: 'Panel',
  393. defaultProps: {
  394. direction: 'down',
  395. },
  396. },
  397. ],
  398. },
  399. {
  400. id: 'status',
  401. label: 'Status',
  402. icons: [
  403. {
  404. id: 'lock',
  405. groups: ['action', 'status'],
  406. keywords: ['secure'],
  407. additionalProps: ['isSolid'],
  408. name: 'Lock',
  409. defaultProps: {
  410. isSolid: false,
  411. },
  412. },
  413. {
  414. id: 'lock-isSolid',
  415. name: 'Lock',
  416. defaultProps: {
  417. isSolid: true,
  418. },
  419. },
  420. {
  421. id: 'fire',
  422. groups: ['status'],
  423. keywords: ['danger', 'severe', 'critical'],
  424. name: 'Fire',
  425. defaultProps: {},
  426. },
  427. {
  428. id: 'fatal',
  429. groups: ['status'],
  430. keywords: ['skull'],
  431. name: 'Fatal',
  432. defaultProps: {},
  433. },
  434. {
  435. id: 'warning',
  436. groups: ['status'],
  437. keywords: ['alert', 'notification'],
  438. name: 'Warning',
  439. defaultProps: {},
  440. },
  441. {
  442. id: 'exclamation',
  443. groups: ['status'],
  444. keywords: ['alert', 'warning'],
  445. name: 'Exclamation',
  446. defaultProps: {},
  447. },
  448. {
  449. id: 'not',
  450. groups: ['status'],
  451. keywords: ['invalid', 'no', 'forbidden'],
  452. name: 'Not',
  453. defaultProps: {},
  454. },
  455. {
  456. id: 'circle',
  457. groups: ['status'],
  458. keywords: ['shape', 'round'],
  459. name: 'Circle',
  460. defaultProps: {},
  461. },
  462. {
  463. id: 'circleFill',
  464. groups: ['status'],
  465. keywords: ['shape', 'round'],
  466. name: 'CircleFill',
  467. defaultProps: {},
  468. },
  469. {
  470. id: 'diamond',
  471. groups: ['status'],
  472. keywords: ['shape', 'alert', 'diamond'],
  473. name: 'Diamond',
  474. defaultProps: {},
  475. },
  476. {
  477. id: 'flag',
  478. groups: ['status'],
  479. keywords: ['bookmark', 'mark', 'save', 'warning', 'message'],
  480. name: 'Flag',
  481. defaultProps: {},
  482. },
  483. {
  484. id: 'happy',
  485. groups: ['status'],
  486. keywords: ['good'],
  487. name: 'Happy',
  488. defaultProps: {},
  489. },
  490. {
  491. id: 'meh',
  492. groups: ['status'],
  493. keywords: ['meh'],
  494. name: 'Meh',
  495. defaultProps: {},
  496. },
  497. {
  498. id: 'sad',
  499. groups: ['status'],
  500. keywords: ['poor'],
  501. name: 'Sad',
  502. defaultProps: {},
  503. },
  504. {
  505. id: 'frozen',
  506. groups: ['status'],
  507. keywords: ['frame', 'mobile'],
  508. name: 'Frozen',
  509. defaultProps: {},
  510. },
  511. {
  512. id: 'slow',
  513. groups: ['status'],
  514. keywords: ['frame', 'mobile'],
  515. name: 'Slow',
  516. defaultProps: {},
  517. },
  518. ],
  519. },
  520. {
  521. id: 'action',
  522. label: 'Action',
  523. icons: [
  524. {
  525. id: 'add',
  526. groups: ['action'],
  527. keywords: ['plus'],
  528. additionalProps: ['isCircled'],
  529. name: 'Add',
  530. defaultProps: {
  531. isCircled: false,
  532. },
  533. },
  534. {
  535. id: 'add-isCircled',
  536. name: 'Add',
  537. defaultProps: {
  538. isCircled: true,
  539. },
  540. },
  541. {
  542. id: 'subtract',
  543. groups: ['action'],
  544. keywords: ['minus'],
  545. additionalProps: ['isCircled'],
  546. name: 'Subtract',
  547. defaultProps: {
  548. isCircled: false,
  549. },
  550. },
  551. {
  552. id: 'subtract-isCircled',
  553. name: 'Subtract',
  554. defaultProps: {
  555. isCircled: true,
  556. },
  557. },
  558. {
  559. id: 'checkmark',
  560. groups: ['action'],
  561. keywords: ['done', 'finish', 'success', 'confirm', 'resolve'],
  562. additionalProps: ['isCircled'],
  563. name: 'Checkmark',
  564. defaultProps: {
  565. isCircled: false,
  566. },
  567. },
  568. {
  569. id: 'checkmark-isCircled',
  570. name: 'Checkmark',
  571. defaultProps: {
  572. isCircled: true,
  573. },
  574. },
  575. {
  576. id: 'close',
  577. groups: ['action'],
  578. keywords: ['cross', 'deny', 'terminate'],
  579. additionalProps: ['isCircled'],
  580. name: 'Close',
  581. defaultProps: {
  582. isCircled: false,
  583. },
  584. },
  585. {
  586. id: 'close-isCircled',
  587. name: 'Close',
  588. defaultProps: {
  589. isCircled: true,
  590. },
  591. },
  592. {
  593. id: 'upload',
  594. groups: ['action'],
  595. keywords: ['file', 'image', 'up'],
  596. name: 'Upload',
  597. defaultProps: {},
  598. },
  599. {
  600. id: 'download',
  601. groups: ['action'],
  602. keywords: ['file', 'image', 'down'],
  603. name: 'Download',
  604. defaultProps: {},
  605. },
  606. {
  607. id: 'sync',
  608. groups: ['action'],
  609. keywords: ['swap'],
  610. name: 'Sync',
  611. defaultProps: {},
  612. },
  613. {
  614. id: 'menu',
  615. groups: ['action'],
  616. keywords: ['navigate'],
  617. name: 'Menu',
  618. defaultProps: {},
  619. },
  620. {
  621. id: 'list',
  622. groups: ['action'],
  623. keywords: ['item'],
  624. name: 'List',
  625. defaultProps: {},
  626. },
  627. {
  628. id: 'upgrade',
  629. groups: ['action'],
  630. keywords: ['up'],
  631. name: 'Upgrade',
  632. defaultProps: {},
  633. },
  634. {
  635. id: 'open',
  636. groups: ['action'],
  637. keywords: ['link', 'hyperlink', 'external'],
  638. name: 'Open',
  639. defaultProps: {},
  640. },
  641. {
  642. id: 'refresh',
  643. groups: ['action'],
  644. keywords: ['reload', 'restart', 'repeat'],
  645. name: 'Refresh',
  646. defaultProps: {},
  647. },
  648. {
  649. id: 'bookmark',
  650. groups: ['action'],
  651. keywords: ['favorite', 'star', 'mark'],
  652. additionalProps: ['isSolid'],
  653. name: 'Bookmark',
  654. defaultProps: {
  655. isSolid: false,
  656. },
  657. },
  658. {
  659. id: 'bookmark-isSolid',
  660. name: 'Bookmark',
  661. defaultProps: {
  662. isSolid: true,
  663. },
  664. },
  665. {
  666. id: 'pin',
  667. groups: ['action'],
  668. keywords: ['stick'],
  669. additionalProps: ['isSolid'],
  670. name: 'Pin',
  671. defaultProps: {
  672. isSolid: false,
  673. },
  674. },
  675. {
  676. id: 'pin-isSolid',
  677. name: 'Pin',
  678. defaultProps: {
  679. isSolid: true,
  680. },
  681. },
  682. {
  683. id: 'star',
  684. groups: ['action'],
  685. keywords: ['favorite', 'star', 'bookmark'],
  686. additionalProps: ['isSolid'],
  687. name: 'Star',
  688. defaultProps: {
  689. isSolid: false,
  690. },
  691. },
  692. {
  693. id: 'star-isSolid',
  694. name: 'Star',
  695. defaultProps: {
  696. isSolid: true,
  697. },
  698. },
  699. {
  700. id: 'archive',
  701. groups: ['product'],
  702. keywords: [],
  703. name: 'Archive',
  704. defaultProps: {},
  705. },
  706. {
  707. id: 'play',
  708. groups: ['action'],
  709. keywords: ['video', 'audio', 'unpause'],
  710. name: 'Play',
  711. defaultProps: {},
  712. },
  713. {
  714. id: 'pause',
  715. groups: ['action'],
  716. keywords: ['video', 'audio', 'stop'],
  717. name: 'Pause',
  718. defaultProps: {},
  719. },
  720. {
  721. id: 'previous',
  722. groups: ['action'],
  723. keywords: ['video', 'audio', 'back', 'return', 'rewind'],
  724. name: 'Previous',
  725. defaultProps: {},
  726. },
  727. {
  728. id: 'next',
  729. groups: ['action'],
  730. keywords: ['video', 'audio', 'skip', 'forward'],
  731. name: 'Next',
  732. defaultProps: {},
  733. },
  734. {
  735. id: 'search',
  736. groups: ['action'],
  737. keywords: ['find', 'look', 'query'],
  738. name: 'Search',
  739. defaultProps: {},
  740. },
  741. {
  742. id: 'copy',
  743. groups: ['action'],
  744. keywords: ['duplicate'],
  745. name: 'Copy',
  746. defaultProps: {},
  747. },
  748. {
  749. id: 'delete',
  750. groups: ['action'],
  751. keywords: ['trash', 'can', 'dumpster', 'remove', 'erase', 'clear'],
  752. name: 'Delete',
  753. defaultProps: {},
  754. },
  755. {
  756. id: 'docs',
  757. groups: ['action'],
  758. keywords: ['document'],
  759. name: 'Docs',
  760. defaultProps: {},
  761. },
  762. {
  763. id: 'link',
  764. groups: ['action'],
  765. keywords: ['hyperlink'],
  766. name: 'Link',
  767. defaultProps: {},
  768. },
  769. {
  770. id: 'attachment',
  771. groups: ['action'],
  772. keywords: ['include', 'clip'],
  773. name: 'Attachment',
  774. defaultProps: {},
  775. },
  776. {
  777. id: 'location',
  778. groups: ['action'],
  779. keywords: ['pin', 'position', 'map'],
  780. name: 'Location',
  781. defaultProps: {},
  782. },
  783. {
  784. id: 'edit',
  785. groups: ['action'],
  786. keywords: ['pencil'],
  787. name: 'Edit',
  788. defaultProps: {},
  789. },
  790. {
  791. id: 'filter',
  792. groups: ['action'],
  793. keywords: [],
  794. name: 'Filter',
  795. defaultProps: {},
  796. },
  797. {
  798. id: 'sort',
  799. groups: ['action'],
  800. keywords: [],
  801. name: 'Sort',
  802. defaultProps: {},
  803. },
  804. {
  805. id: 'show',
  806. groups: ['action'],
  807. keywords: ['visible'],
  808. name: 'Show',
  809. defaultProps: {},
  810. },
  811. {
  812. id: 'lock',
  813. name: 'Lock',
  814. defaultProps: {
  815. isSolid: false,
  816. },
  817. },
  818. {
  819. id: 'lock-isSolid',
  820. name: 'Lock',
  821. defaultProps: {
  822. isSolid: true,
  823. },
  824. },
  825. {
  826. id: 'grabbable',
  827. groups: ['action'],
  828. keywords: ['move', 'arrange', 'organize', 'rank', 'switch'],
  829. name: 'Grabbable',
  830. defaultProps: {},
  831. },
  832. {
  833. id: 'ellipsis',
  834. groups: ['action'],
  835. keywords: ['expand', 'open', 'more', 'hidden'],
  836. name: 'Ellipsis',
  837. defaultProps: {},
  838. },
  839. {
  840. id: 'megaphone',
  841. groups: ['action'],
  842. keywords: ['speaker', 'announce'],
  843. name: 'Megaphone',
  844. defaultProps: {},
  845. },
  846. {
  847. id: 'question',
  848. groups: ['action'],
  849. keywords: ['info', 'about', 'information', 'ask', 'faq', 'q&a'],
  850. name: 'Question',
  851. defaultProps: {},
  852. },
  853. {
  854. id: 'info',
  855. groups: ['action'],
  856. keywords: ['more', 'about', 'information', 'ask', 'faq', 'q&a'],
  857. name: 'Info',
  858. defaultProps: {},
  859. },
  860. {
  861. id: 'user',
  862. groups: ['action'],
  863. keywords: ['person', 'portrait'],
  864. name: 'User',
  865. defaultProps: {},
  866. },
  867. {
  868. id: 'chat',
  869. groups: ['action', 'action'],
  870. keywords: ['message', 'bubble'],
  871. name: 'Chat',
  872. defaultProps: {},
  873. },
  874. {
  875. id: 'clock',
  876. groups: ['action'],
  877. keywords: ['time', 'watch'],
  878. name: 'Clock',
  879. defaultProps: {},
  880. },
  881. {
  882. id: 'sliders-direction-left',
  883. groups: ['action'],
  884. keywords: ['settings', 'slide', 'adjust'],
  885. additionalProps: ['direction'],
  886. name: 'Sliders',
  887. defaultProps: {
  888. direction: 'left',
  889. },
  890. },
  891. {
  892. id: 'sliders-direction-up',
  893. name: 'Sliders',
  894. defaultProps: {
  895. direction: 'up',
  896. },
  897. },
  898. {
  899. id: 'toggle',
  900. groups: ['action'],
  901. keywords: ['switch', 'form', 'disable', 'enable'],
  902. name: 'Toggle',
  903. defaultProps: {},
  904. },
  905. {
  906. id: 'fix',
  907. groups: ['action'],
  908. keywords: ['wrench', 'resolve'],
  909. name: 'Fix',
  910. defaultProps: {},
  911. },
  912. {
  913. id: 'tag',
  914. groups: ['action'],
  915. keywords: ['price', 'category', 'group'],
  916. name: 'Tag',
  917. defaultProps: {},
  918. },
  919. {
  920. id: 'moon',
  921. groups: ['action'],
  922. keywords: ['dark', 'night'],
  923. name: 'Moon',
  924. defaultProps: {},
  925. },
  926. {
  927. id: 'subscribed',
  928. groups: ['action'],
  929. keywords: ['alert', 'notification', 'subscribe', 'bell', 'ring'],
  930. name: 'Subscribed',
  931. defaultProps: {},
  932. },
  933. {
  934. id: 'unsubscribed',
  935. groups: ['action'],
  936. keywords: ['alert', 'notification', 'subscribe', 'bell', 'ring'],
  937. name: 'Unsubscribed',
  938. defaultProps: {},
  939. },
  940. {
  941. id: 'sound',
  942. groups: ['action'],
  943. keywords: ['audio'],
  944. name: 'Sound',
  945. defaultProps: {},
  946. },
  947. {
  948. id: 'mute',
  949. groups: ['action'],
  950. keywords: ['audio'],
  951. name: 'Mute',
  952. defaultProps: {},
  953. },
  954. {
  955. id: 'resize',
  956. groups: ['action'],
  957. keywords: ['scale', 'stretch'],
  958. name: 'Resize',
  959. defaultProps: {},
  960. },
  961. {
  962. id: 'expand',
  963. groups: ['action'],
  964. keywords: ['open'],
  965. name: 'Expand',
  966. defaultProps: {},
  967. },
  968. {
  969. id: 'contract',
  970. groups: ['action'],
  971. keywords: ['close'],
  972. name: 'Contract',
  973. defaultProps: {},
  974. },
  975. {
  976. id: 'group',
  977. groups: ['action'],
  978. keywords: ['users', 'person', 'people'],
  979. name: 'Group',
  980. defaultProps: {},
  981. },
  982. {
  983. id: 'rewind10',
  984. groups: ['action'],
  985. keywords: ['rewind'],
  986. name: 'Rewind10',
  987. defaultProps: {},
  988. },
  989. {
  990. id: 'timer',
  991. name: 'Timer',
  992. defaultProps: {},
  993. },
  994. {
  995. id: 'cursorArrow',
  996. keywords: ['pointer', 'mouse'],
  997. name: 'CursorArrow',
  998. defaultProps: {},
  999. },
  1000. {
  1001. id: 'keyDown',
  1002. keywords: ['keyboard', 'press', 'click', 'tap'],
  1003. name: 'KeyDown',
  1004. defaultProps: {},
  1005. },
  1006. {
  1007. id: 'zoom-out',
  1008. keywords: [],
  1009. name: 'Zoom',
  1010. defaultProps: {isZoomIn: false},
  1011. },
  1012. {
  1013. id: 'zoom-in',
  1014. keywords: [],
  1015. name: 'Zoom',
  1016. defaultProps: {isZoomIn: true},
  1017. },
  1018. {
  1019. id: 'focus',
  1020. keywords: ['foreground'],
  1021. name: 'Focus',
  1022. defaultProps: {isFocused: true},
  1023. },
  1024. {
  1025. id: 'blur',
  1026. keywords: ['background'],
  1027. name: 'Focus',
  1028. defaultProps: {isFocused: false},
  1029. },
  1030. {
  1031. id: 'tap',
  1032. keywords: ['finger', 'hand', 'cursor'],
  1033. name: 'Tap',
  1034. defaultProps: {},
  1035. },
  1036. ],
  1037. },
  1038. {
  1039. id: 'chart',
  1040. label: 'Chart',
  1041. icons: [
  1042. {
  1043. id: 'graph-type-line',
  1044. groups: ['chart'],
  1045. keywords: ['line', 'plot'],
  1046. additionalProps: ['type'],
  1047. name: 'Graph',
  1048. defaultProps: {
  1049. type: 'line',
  1050. },
  1051. },
  1052. {
  1053. id: 'graph-type-circle',
  1054. name: 'Graph',
  1055. defaultProps: {
  1056. type: 'circle',
  1057. },
  1058. },
  1059. {
  1060. id: 'graph-type-bar',
  1061. name: 'Graph',
  1062. defaultProps: {
  1063. type: 'bar',
  1064. },
  1065. },
  1066. {
  1067. id: 'graph-type-area',
  1068. name: 'Graph',
  1069. defaultProps: {
  1070. type: 'area',
  1071. },
  1072. },
  1073. {
  1074. id: 'stack',
  1075. groups: ['chart'],
  1076. keywords: ['group', 'combine', 'view'],
  1077. name: 'Stack',
  1078. defaultProps: {},
  1079. },
  1080. {
  1081. id: 'span',
  1082. groups: ['chart'],
  1083. keywords: ['performance', 'transaction'],
  1084. name: 'Span',
  1085. defaultProps: {},
  1086. },
  1087. {
  1088. id: 'number',
  1089. groups: ['chart'],
  1090. keywords: ['value'],
  1091. name: 'Number',
  1092. defaultProps: {},
  1093. },
  1094. {
  1095. id: 'profiling',
  1096. name: 'Profiling',
  1097. defaultProps: {},
  1098. },
  1099. ],
  1100. },
  1101. {
  1102. id: 'device',
  1103. label: 'Device',
  1104. icons: [
  1105. {
  1106. id: 'return',
  1107. groups: ['device'],
  1108. keywords: ['enter'],
  1109. name: 'Return',
  1110. defaultProps: {},
  1111. },
  1112. {
  1113. id: 'file',
  1114. groups: ['device'],
  1115. keywords: ['document'],
  1116. name: 'File',
  1117. defaultProps: {},
  1118. },
  1119. {
  1120. id: 'print',
  1121. groups: ['device'],
  1122. keywords: [],
  1123. name: 'Print',
  1124. defaultProps: {},
  1125. },
  1126. {
  1127. id: 'code',
  1128. groups: ['device'],
  1129. keywords: ['snippet', 'javascript', 'json', 'curly', 'source'],
  1130. name: 'Code',
  1131. defaultProps: {},
  1132. },
  1133. {
  1134. id: 'json',
  1135. groups: ['device'],
  1136. keywords: ['snippet', 'code', 'javascript', 'source'],
  1137. name: 'Json',
  1138. defaultProps: {},
  1139. },
  1140. {
  1141. id: 'markdown',
  1142. groups: ['device'],
  1143. keywords: ['code'],
  1144. name: 'Markdown',
  1145. defaultProps: {},
  1146. },
  1147. {
  1148. id: 'terminal',
  1149. groups: ['device', 'device'],
  1150. keywords: ['code', 'bash', 'command'],
  1151. name: 'Terminal',
  1152. defaultProps: {},
  1153. },
  1154. {
  1155. id: 'commit',
  1156. groups: ['device'],
  1157. keywords: ['git', 'github'],
  1158. name: 'Commit',
  1159. defaultProps: {},
  1160. },
  1161. {
  1162. id: 'laptop',
  1163. groups: ['device'],
  1164. keywords: ['computer', 'macbook'],
  1165. name: 'Laptop',
  1166. defaultProps: {},
  1167. },
  1168. {
  1169. id: 'mobile',
  1170. groups: ['device'],
  1171. keywords: ['phone', 'iphone'],
  1172. name: 'Mobile',
  1173. defaultProps: {},
  1174. },
  1175. {
  1176. id: 'window',
  1177. groups: ['device'],
  1178. keywords: ['application'],
  1179. name: 'Window',
  1180. defaultProps: {},
  1181. },
  1182. {
  1183. id: 'calendar',
  1184. groups: ['device'],
  1185. keywords: ['time', 'date'],
  1186. name: 'Calendar',
  1187. defaultProps: {},
  1188. },
  1189. {
  1190. id: 'mail',
  1191. groups: ['device'],
  1192. keywords: ['email'],
  1193. name: 'Mail',
  1194. defaultProps: {},
  1195. },
  1196. {
  1197. id: 'input',
  1198. groups: ['device'],
  1199. keywords: ['text'],
  1200. name: 'Input',
  1201. defaultProps: {},
  1202. },
  1203. {
  1204. id: 'option',
  1205. groups: ['device'],
  1206. keywords: [''],
  1207. name: 'Option',
  1208. defaultProps: {},
  1209. },
  1210. {
  1211. id: 'fileBroken',
  1212. groups: ['device'],
  1213. keywords: ['file', 'missing', 'error'],
  1214. name: 'FileBroken',
  1215. defaultProps: {},
  1216. },
  1217. {
  1218. id: 'image',
  1219. groups: ['device'],
  1220. keywords: ['image', 'photo', 'screenshot'],
  1221. name: 'Image',
  1222. defaultProps: {},
  1223. },
  1224. ],
  1225. },
  1226. ];
  1227. export default function IconsStories() {
  1228. const [searchTerm, setSearchTerm] = useState('');
  1229. const definedWithPrefix = new Set<string>();
  1230. SECTIONS.forEach(section =>
  1231. section.icons.forEach(icon => definedWithPrefix.add(`Icon${icon.name}`))
  1232. );
  1233. const unclassifiedSection = {
  1234. id: 'other',
  1235. label: 'Unclassified',
  1236. icons: Object.keys(Icons)
  1237. .filter(name => !definedWithPrefix.has(name))
  1238. .map((name): TIcon => ({id: name, name})),
  1239. };
  1240. const filteredSections = searchTerm
  1241. ? SECTIONS.map(section => ({
  1242. ...section,
  1243. icons: section.icons.filter(
  1244. icon =>
  1245. icon.name.toLowerCase().includes(searchTerm) ||
  1246. icon.keywords?.some(keyword => keyword.toLowerCase().includes(searchTerm))
  1247. ),
  1248. }))
  1249. : SECTIONS;
  1250. return (
  1251. <Fragment>
  1252. <StyledSticky>
  1253. <p>
  1254. In addition to icon name, you can also search by keyword. For example, typing
  1255. either <kbd>checkmark</kbd> or <kbd>success</kbd> will return{' '}
  1256. <samp>IconCheckmark</samp>.
  1257. </p>
  1258. <Input
  1259. placeholder="Search icons by name or keyword"
  1260. onChange={e => setSearchTerm(e.target.value.toLowerCase())}
  1261. />
  1262. </StyledSticky>
  1263. <Section section={unclassifiedSection} />
  1264. {filteredSections.map(section => (
  1265. <Section key={section.id} section={section} />
  1266. ))}
  1267. <PlatformIconsSection searchTerm={searchTerm} />
  1268. </Fragment>
  1269. );
  1270. }
  1271. function Section({section}: {section: TSection}) {
  1272. if (section.icons.length === 0) {
  1273. return null;
  1274. }
  1275. return (
  1276. <section>
  1277. <SectionHeader>{section.label}</SectionHeader>
  1278. <p>
  1279. <code>{"import { ... } from 'sentry/icons';"}</code>
  1280. </p>
  1281. <Grid style={{gridTemplateColumns: 'repeat(4, 1fr)'}}>
  1282. {section.icons.map(icon => {
  1283. const name = icon.name.startsWith('Icon') ? icon.name : `Icon${icon.name}`;
  1284. const Component = Icons[name];
  1285. const props = {color: 'gray500', size: 'sm', ...icon.defaultProps};
  1286. return (
  1287. <Tooltip
  1288. key={icon.id}
  1289. isHoverable
  1290. overlayStyle={{maxWidth: 440}}
  1291. title={<JSXNode name={name} props={props} />}
  1292. >
  1293. <Cell>
  1294. <Component {...props} />
  1295. {name}
  1296. </Cell>
  1297. </Tooltip>
  1298. );
  1299. })}
  1300. </Grid>
  1301. </section>
  1302. );
  1303. }
  1304. function PlatformIconsSection({searchTerm}: {searchTerm: string}) {
  1305. const filteredPlatforms = platforms.filter(platform => platform.includes(searchTerm));
  1306. return (
  1307. <section>
  1308. <SectionHeader>PlatformIcons</SectionHeader>
  1309. <p>
  1310. <code>{"import {PlatformIcon} from 'platformicons';"}</code>
  1311. </p>
  1312. <Grid
  1313. style={{
  1314. gridAutoFlow: 'column',
  1315. gridTemplateRows: `repeat(${Math.ceil(filteredPlatforms.length / 4)}, 1fr)`,
  1316. }}
  1317. >
  1318. {filteredPlatforms.map(platform => (
  1319. <Tooltip
  1320. key={platform}
  1321. isHoverable
  1322. overlayStyle={{maxWidth: 440}}
  1323. title={
  1324. <Fragment>
  1325. <JSXNode name="PlatformIcon" props={{platform}} />
  1326. </Fragment>
  1327. }
  1328. >
  1329. <Cell>
  1330. <PlatformIcon platform={platform} /> {platform}
  1331. </Cell>
  1332. </Tooltip>
  1333. ))}
  1334. </Grid>
  1335. </section>
  1336. );
  1337. }
  1338. const StyledSticky = styled(Sticky)`
  1339. background: ${p => p.theme.background};
  1340. z-index: ${p => p.theme.zIndex.initial};
  1341. &[data-stuck='true'] {
  1342. box-shadow: 0px 10px 20px -8px rgba(128, 128, 128, 0.89);
  1343. }
  1344. `;
  1345. const SectionHeader = styled('h5')`
  1346. margin-block: ${space(2)};
  1347. `;
  1348. const Grid = styled('div')`
  1349. display: grid;
  1350. gap: ${space(1)};
  1351. align-items: center;
  1352. `;
  1353. const Cell = styled('div')`
  1354. display: flex;
  1355. gap: ${space(1)};
  1356. align-items: center;
  1357. border: 1px solid transparent;
  1358. border-radius: ${p => p.theme.borderRadius};
  1359. padding: ${space(1)};
  1360. cursor: pointer;
  1361. &:hover {
  1362. border-color: ${p => p.theme.border};
  1363. }
  1364. `;