icons.stories.tsx 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398
  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: 'slow',
  506. groups: ['status'],
  507. keywords: ['frame', 'mobile'],
  508. name: 'Slow',
  509. defaultProps: {},
  510. },
  511. ],
  512. },
  513. {
  514. id: 'action',
  515. label: 'Action',
  516. icons: [
  517. {
  518. id: 'add',
  519. groups: ['action'],
  520. keywords: ['plus'],
  521. additionalProps: ['isCircled'],
  522. name: 'Add',
  523. defaultProps: {
  524. isCircled: false,
  525. },
  526. },
  527. {
  528. id: 'add-isCircled',
  529. name: 'Add',
  530. defaultProps: {
  531. isCircled: true,
  532. },
  533. },
  534. {
  535. id: 'subtract',
  536. groups: ['action'],
  537. keywords: ['minus'],
  538. additionalProps: ['isCircled'],
  539. name: 'Subtract',
  540. defaultProps: {
  541. isCircled: false,
  542. },
  543. },
  544. {
  545. id: 'subtract-isCircled',
  546. name: 'Subtract',
  547. defaultProps: {
  548. isCircled: true,
  549. },
  550. },
  551. {
  552. id: 'checkmark',
  553. groups: ['action'],
  554. keywords: ['done', 'finish', 'success', 'confirm', 'resolve'],
  555. additionalProps: ['isCircled'],
  556. name: 'Checkmark',
  557. defaultProps: {
  558. isCircled: false,
  559. },
  560. },
  561. {
  562. id: 'checkmark-isCircled',
  563. name: 'Checkmark',
  564. defaultProps: {
  565. isCircled: true,
  566. },
  567. },
  568. {
  569. id: 'close',
  570. groups: ['action'],
  571. keywords: ['cross', 'deny', 'terminate'],
  572. additionalProps: ['isCircled'],
  573. name: 'Close',
  574. defaultProps: {
  575. isCircled: false,
  576. },
  577. },
  578. {
  579. id: 'close-isCircled',
  580. name: 'Close',
  581. defaultProps: {
  582. isCircled: true,
  583. },
  584. },
  585. {
  586. id: 'upload',
  587. groups: ['action'],
  588. keywords: ['file', 'image', 'up'],
  589. name: 'Upload',
  590. defaultProps: {},
  591. },
  592. {
  593. id: 'download',
  594. groups: ['action'],
  595. keywords: ['file', 'image', 'down'],
  596. name: 'Download',
  597. defaultProps: {},
  598. },
  599. {
  600. id: 'sync',
  601. groups: ['action'],
  602. keywords: ['swap'],
  603. name: 'Sync',
  604. defaultProps: {},
  605. },
  606. {
  607. id: 'menu',
  608. groups: ['action'],
  609. keywords: ['navigate'],
  610. name: 'Menu',
  611. defaultProps: {},
  612. },
  613. {
  614. id: 'list',
  615. groups: ['action'],
  616. keywords: ['item'],
  617. name: 'List',
  618. defaultProps: {},
  619. },
  620. {
  621. id: 'upgrade',
  622. groups: ['action'],
  623. keywords: ['up'],
  624. name: 'Upgrade',
  625. defaultProps: {},
  626. },
  627. {
  628. id: 'open',
  629. groups: ['action'],
  630. keywords: ['link', 'hyperlink', 'external'],
  631. name: 'Open',
  632. defaultProps: {},
  633. },
  634. {
  635. id: 'refresh',
  636. groups: ['action'],
  637. keywords: ['reload', 'restart', 'repeat'],
  638. name: 'Refresh',
  639. defaultProps: {},
  640. },
  641. {
  642. id: 'bookmark',
  643. groups: ['action'],
  644. keywords: ['favorite', 'star', 'mark'],
  645. additionalProps: ['isSolid'],
  646. name: 'Bookmark',
  647. defaultProps: {
  648. isSolid: false,
  649. },
  650. },
  651. {
  652. id: 'bookmark-isSolid',
  653. name: 'Bookmark',
  654. defaultProps: {
  655. isSolid: true,
  656. },
  657. },
  658. {
  659. id: 'pin',
  660. groups: ['action'],
  661. keywords: ['stick'],
  662. additionalProps: ['isSolid'],
  663. name: 'Pin',
  664. defaultProps: {
  665. isSolid: false,
  666. },
  667. },
  668. {
  669. id: 'pin-isSolid',
  670. name: 'Pin',
  671. defaultProps: {
  672. isSolid: true,
  673. },
  674. },
  675. {
  676. id: 'star',
  677. groups: ['action'],
  678. keywords: ['favorite', 'star', 'bookmark'],
  679. additionalProps: ['isSolid'],
  680. name: 'Star',
  681. defaultProps: {
  682. isSolid: false,
  683. },
  684. },
  685. {
  686. id: 'star-isSolid',
  687. name: 'Star',
  688. defaultProps: {
  689. isSolid: true,
  690. },
  691. },
  692. {
  693. id: 'archive',
  694. groups: ['product'],
  695. keywords: [],
  696. name: 'Archive',
  697. defaultProps: {},
  698. },
  699. {
  700. id: 'play',
  701. groups: ['action'],
  702. keywords: ['video', 'audio', 'unpause'],
  703. name: 'Play',
  704. defaultProps: {},
  705. },
  706. {
  707. id: 'pause',
  708. groups: ['action'],
  709. keywords: ['video', 'audio', 'stop'],
  710. name: 'Pause',
  711. defaultProps: {},
  712. },
  713. {
  714. id: 'previous',
  715. groups: ['action'],
  716. keywords: ['video', 'audio', 'back', 'return', 'rewind'],
  717. name: 'Previous',
  718. defaultProps: {},
  719. },
  720. {
  721. id: 'next',
  722. groups: ['action'],
  723. keywords: ['video', 'audio', 'skip', 'forward'],
  724. name: 'Next',
  725. defaultProps: {},
  726. },
  727. {
  728. id: 'search',
  729. groups: ['action'],
  730. keywords: ['find', 'look', 'query'],
  731. name: 'Search',
  732. defaultProps: {},
  733. },
  734. {
  735. id: 'copy',
  736. groups: ['action'],
  737. keywords: ['duplicate'],
  738. name: 'Copy',
  739. defaultProps: {},
  740. },
  741. {
  742. id: 'delete',
  743. groups: ['action'],
  744. keywords: ['trash', 'can', 'dumpster', 'remove', 'erase', 'clear'],
  745. name: 'Delete',
  746. defaultProps: {},
  747. },
  748. {
  749. id: 'docs',
  750. groups: ['action'],
  751. keywords: ['document'],
  752. name: 'Docs',
  753. defaultProps: {},
  754. },
  755. {
  756. id: 'link',
  757. groups: ['action'],
  758. keywords: ['hyperlink'],
  759. name: 'Link',
  760. defaultProps: {},
  761. },
  762. {
  763. id: 'attachment',
  764. groups: ['action'],
  765. keywords: ['include', 'clip'],
  766. name: 'Attachment',
  767. defaultProps: {},
  768. },
  769. {
  770. id: 'location',
  771. groups: ['action'],
  772. keywords: ['pin', 'position', 'map'],
  773. name: 'Location',
  774. defaultProps: {},
  775. },
  776. {
  777. id: 'edit',
  778. groups: ['action'],
  779. keywords: ['pencil'],
  780. name: 'Edit',
  781. defaultProps: {},
  782. },
  783. {
  784. id: 'filter',
  785. groups: ['action'],
  786. keywords: [],
  787. name: 'Filter',
  788. defaultProps: {},
  789. },
  790. {
  791. id: 'sort',
  792. groups: ['action'],
  793. keywords: [],
  794. name: 'Sort',
  795. defaultProps: {},
  796. },
  797. {
  798. id: 'show',
  799. groups: ['action'],
  800. keywords: ['visible'],
  801. name: 'Show',
  802. defaultProps: {},
  803. },
  804. {
  805. id: 'lock',
  806. name: 'Lock',
  807. defaultProps: {
  808. isSolid: false,
  809. },
  810. },
  811. {
  812. id: 'lock-isSolid',
  813. name: 'Lock',
  814. defaultProps: {
  815. isSolid: true,
  816. },
  817. },
  818. {
  819. id: 'grabbable',
  820. groups: ['action'],
  821. keywords: ['move', 'arrange', 'organize', 'rank', 'switch'],
  822. name: 'Grabbable',
  823. defaultProps: {},
  824. },
  825. {
  826. id: 'ellipsis',
  827. groups: ['action'],
  828. keywords: ['expand', 'open', 'more', 'hidden'],
  829. name: 'Ellipsis',
  830. defaultProps: {},
  831. },
  832. {
  833. id: 'megaphone',
  834. groups: ['action'],
  835. keywords: ['speaker', 'announce'],
  836. name: 'Megaphone',
  837. defaultProps: {},
  838. },
  839. {
  840. id: 'question',
  841. groups: ['action'],
  842. keywords: ['info', 'about', 'information', 'ask', 'faq', 'q&a'],
  843. name: 'Question',
  844. defaultProps: {},
  845. },
  846. {
  847. id: 'info',
  848. groups: ['action'],
  849. keywords: ['more', 'about', 'information', 'ask', 'faq', 'q&a'],
  850. name: 'Info',
  851. defaultProps: {},
  852. },
  853. {
  854. id: 'user',
  855. groups: ['action'],
  856. keywords: ['person', 'portrait'],
  857. name: 'User',
  858. defaultProps: {},
  859. },
  860. {
  861. id: 'chat',
  862. groups: ['action', 'action'],
  863. keywords: ['message', 'bubble'],
  864. name: 'Chat',
  865. defaultProps: {},
  866. },
  867. {
  868. id: 'clock',
  869. groups: ['action'],
  870. keywords: ['time', 'watch'],
  871. name: 'Clock',
  872. defaultProps: {},
  873. },
  874. {
  875. id: 'sliders-direction-left',
  876. groups: ['action'],
  877. keywords: ['settings', 'slide', 'adjust'],
  878. additionalProps: ['direction'],
  879. name: 'Sliders',
  880. defaultProps: {
  881. direction: 'left',
  882. },
  883. },
  884. {
  885. id: 'sliders-direction-up',
  886. name: 'Sliders',
  887. defaultProps: {
  888. direction: 'up',
  889. },
  890. },
  891. {
  892. id: 'toggle',
  893. groups: ['action'],
  894. keywords: ['switch', 'form', 'disable', 'enable'],
  895. name: 'Toggle',
  896. defaultProps: {},
  897. },
  898. {
  899. id: 'fix',
  900. groups: ['action'],
  901. keywords: ['wrench', 'resolve'],
  902. name: 'Fix',
  903. defaultProps: {},
  904. },
  905. {
  906. id: 'tag',
  907. groups: ['action'],
  908. keywords: ['price', 'category', 'group'],
  909. name: 'Tag',
  910. defaultProps: {},
  911. },
  912. {
  913. id: 'moon',
  914. groups: ['action'],
  915. keywords: ['dark', 'night'],
  916. name: 'Moon',
  917. defaultProps: {},
  918. },
  919. {
  920. id: 'subscribed',
  921. groups: ['action'],
  922. keywords: ['alert', 'notification', 'subscribe', 'bell', 'ring'],
  923. name: 'Subscribed',
  924. defaultProps: {},
  925. },
  926. {
  927. id: 'unsubscribed',
  928. groups: ['action'],
  929. keywords: ['alert', 'notification', 'subscribe', 'bell', 'ring'],
  930. name: 'Unsubscribed',
  931. defaultProps: {},
  932. },
  933. {
  934. id: 'sound',
  935. groups: ['action'],
  936. keywords: ['audio'],
  937. name: 'Sound',
  938. defaultProps: {},
  939. },
  940. {
  941. id: 'mute',
  942. groups: ['action'],
  943. keywords: ['audio'],
  944. name: 'Mute',
  945. defaultProps: {},
  946. },
  947. {
  948. id: 'resize',
  949. groups: ['action'],
  950. keywords: ['scale', 'stretch'],
  951. name: 'Resize',
  952. defaultProps: {},
  953. },
  954. {
  955. id: 'expand',
  956. groups: ['action'],
  957. keywords: ['open'],
  958. name: 'Expand',
  959. defaultProps: {},
  960. },
  961. {
  962. id: 'contract',
  963. groups: ['action'],
  964. keywords: ['close'],
  965. name: 'Contract',
  966. defaultProps: {},
  967. },
  968. {
  969. id: 'group',
  970. groups: ['action'],
  971. keywords: ['users', 'person', 'people'],
  972. name: 'Group',
  973. defaultProps: {},
  974. },
  975. {
  976. id: 'rewind10',
  977. groups: ['action'],
  978. keywords: ['rewind'],
  979. name: 'Rewind10',
  980. defaultProps: {},
  981. },
  982. {
  983. id: 'timer',
  984. name: 'Timer',
  985. defaultProps: {},
  986. },
  987. {
  988. id: 'cursorArrow',
  989. keywords: ['pointer', 'mouse'],
  990. name: 'CursorArrow',
  991. defaultProps: {},
  992. },
  993. {
  994. id: 'keyDown',
  995. keywords: ['keyboard', 'press', 'click', 'tap'],
  996. name: 'KeyDown',
  997. defaultProps: {},
  998. },
  999. {
  1000. id: 'zoom-out',
  1001. keywords: [],
  1002. name: 'Zoom',
  1003. defaultProps: {isZoomIn: false},
  1004. },
  1005. {
  1006. id: 'zoom-in',
  1007. keywords: [],
  1008. name: 'Zoom',
  1009. defaultProps: {isZoomIn: true},
  1010. },
  1011. {
  1012. id: 'focus',
  1013. keywords: ['foreground'],
  1014. name: 'Focus',
  1015. defaultProps: {isFocused: true},
  1016. },
  1017. {
  1018. id: 'blur',
  1019. keywords: ['background'],
  1020. name: 'Focus',
  1021. defaultProps: {isFocused: false},
  1022. },
  1023. {
  1024. id: 'tap',
  1025. keywords: ['finger', 'hand', 'cursor'],
  1026. name: 'Tap',
  1027. defaultProps: {},
  1028. },
  1029. {
  1030. id: 'thumb',
  1031. keywords: ['feedback', 'good'],
  1032. additionalProps: ['direction'],
  1033. name: 'Thumb',
  1034. defaultProps: {},
  1035. },
  1036. {
  1037. id: 'thumb',
  1038. keywords: ['feedback', 'bad', 'poor'],
  1039. additionalProps: ['direction'],
  1040. name: 'Thumb',
  1041. defaultProps: {
  1042. direction: ['down'],
  1043. },
  1044. },
  1045. ],
  1046. },
  1047. {
  1048. id: 'chart',
  1049. label: 'Visualizations',
  1050. icons: [
  1051. {
  1052. id: 'graph-type-line',
  1053. groups: ['chart'],
  1054. keywords: ['line', 'plot'],
  1055. additionalProps: ['type'],
  1056. name: 'Graph',
  1057. defaultProps: {
  1058. type: 'line',
  1059. },
  1060. },
  1061. {
  1062. id: 'graph-type-circle',
  1063. name: 'Graph',
  1064. defaultProps: {
  1065. type: 'circle',
  1066. },
  1067. },
  1068. {
  1069. id: 'graph-type-bar',
  1070. name: 'Graph',
  1071. defaultProps: {
  1072. type: 'bar',
  1073. },
  1074. },
  1075. {
  1076. id: 'graph-type-area',
  1077. name: 'Graph',
  1078. defaultProps: {
  1079. type: 'area',
  1080. },
  1081. },
  1082. {
  1083. id: 'graph-type-scatter',
  1084. name: 'Graph',
  1085. defaultProps: {
  1086. type: 'scatter',
  1087. },
  1088. },
  1089. {
  1090. id: 'stack',
  1091. groups: ['chart'],
  1092. keywords: ['group', 'combine', 'view'],
  1093. name: 'Stack',
  1094. defaultProps: {},
  1095. },
  1096. {
  1097. id: 'span',
  1098. groups: ['chart'],
  1099. keywords: ['performance', 'transaction'],
  1100. name: 'Span',
  1101. defaultProps: {},
  1102. },
  1103. {
  1104. id: 'number',
  1105. groups: ['chart'],
  1106. keywords: ['value'],
  1107. name: 'Number',
  1108. defaultProps: {},
  1109. },
  1110. {
  1111. id: 'profiling',
  1112. name: 'Profiling',
  1113. defaultProps: {},
  1114. },
  1115. {
  1116. id: 'table',
  1117. name: 'Table',
  1118. defaultProps: {},
  1119. },
  1120. ],
  1121. },
  1122. {
  1123. id: 'device',
  1124. label: 'Device',
  1125. icons: [
  1126. {
  1127. id: 'return',
  1128. groups: ['device'],
  1129. keywords: ['enter'],
  1130. name: 'Return',
  1131. defaultProps: {},
  1132. },
  1133. {
  1134. id: 'file',
  1135. groups: ['device'],
  1136. keywords: ['document'],
  1137. name: 'File',
  1138. defaultProps: {},
  1139. },
  1140. {
  1141. id: 'print',
  1142. groups: ['device'],
  1143. keywords: [],
  1144. name: 'Print',
  1145. defaultProps: {},
  1146. },
  1147. {
  1148. id: 'code',
  1149. groups: ['device'],
  1150. keywords: ['snippet', 'javascript', 'json', 'curly', 'source'],
  1151. name: 'Code',
  1152. defaultProps: {},
  1153. },
  1154. {
  1155. id: 'json',
  1156. groups: ['device'],
  1157. keywords: ['snippet', 'code', 'javascript', 'source'],
  1158. name: 'Json',
  1159. defaultProps: {},
  1160. },
  1161. {
  1162. id: 'markdown',
  1163. groups: ['device'],
  1164. keywords: ['code'],
  1165. name: 'Markdown',
  1166. defaultProps: {},
  1167. },
  1168. {
  1169. id: 'terminal',
  1170. groups: ['device', 'device'],
  1171. keywords: ['code', 'bash', 'command'],
  1172. name: 'Terminal',
  1173. defaultProps: {},
  1174. },
  1175. {
  1176. id: 'commit',
  1177. groups: ['device'],
  1178. keywords: ['git', 'github'],
  1179. name: 'Commit',
  1180. defaultProps: {},
  1181. },
  1182. {
  1183. id: 'laptop',
  1184. groups: ['device'],
  1185. keywords: ['computer', 'macbook'],
  1186. name: 'Laptop',
  1187. defaultProps: {},
  1188. },
  1189. {
  1190. id: 'mobile',
  1191. groups: ['device'],
  1192. keywords: ['phone', 'iphone'],
  1193. name: 'Mobile',
  1194. defaultProps: {},
  1195. },
  1196. {
  1197. id: 'window',
  1198. groups: ['device'],
  1199. keywords: ['application'],
  1200. name: 'Window',
  1201. defaultProps: {},
  1202. },
  1203. {
  1204. id: 'calendar',
  1205. groups: ['device'],
  1206. keywords: ['time', 'date'],
  1207. name: 'Calendar',
  1208. defaultProps: {},
  1209. },
  1210. {
  1211. id: 'mail',
  1212. groups: ['device'],
  1213. keywords: ['email'],
  1214. name: 'Mail',
  1215. defaultProps: {},
  1216. },
  1217. {
  1218. id: 'input',
  1219. groups: ['device'],
  1220. keywords: ['text'],
  1221. name: 'Input',
  1222. defaultProps: {},
  1223. },
  1224. {
  1225. id: 'fileBroken',
  1226. groups: ['device'],
  1227. keywords: ['file', 'missing', 'error'],
  1228. name: 'FileBroken',
  1229. defaultProps: {},
  1230. },
  1231. {
  1232. id: 'image',
  1233. groups: ['device'],
  1234. keywords: ['image', 'photo', 'screenshot'],
  1235. name: 'Image',
  1236. defaultProps: {},
  1237. },
  1238. ],
  1239. },
  1240. ];
  1241. export default function IconsStories() {
  1242. const [searchTerm, setSearchTerm] = useState('');
  1243. const definedWithPrefix = new Set<string>();
  1244. SECTIONS.forEach(section =>
  1245. section.icons.forEach(icon => definedWithPrefix.add(`Icon${icon.name}`))
  1246. );
  1247. const unclassifiedSection = {
  1248. id: 'other',
  1249. label: 'Unclassified',
  1250. icons: Object.keys(Icons)
  1251. .filter(name => !definedWithPrefix.has(name))
  1252. .map((name): TIcon => ({id: name, name})),
  1253. };
  1254. const filteredSections = searchTerm
  1255. ? SECTIONS.map(section => ({
  1256. ...section,
  1257. icons: section.icons.filter(
  1258. icon =>
  1259. icon.name.toLowerCase().includes(searchTerm) ||
  1260. icon.keywords?.some(keyword => keyword.toLowerCase().includes(searchTerm))
  1261. ),
  1262. }))
  1263. : SECTIONS;
  1264. return (
  1265. <Fragment>
  1266. <StyledSticky>
  1267. <p>
  1268. In addition to icon name, you can also search by keyword. For example, typing
  1269. either <kbd>checkmark</kbd> or <kbd>success</kbd> will return{' '}
  1270. <samp>IconCheckmark</samp>.
  1271. </p>
  1272. <Input
  1273. placeholder="Search icons by name or keyword"
  1274. onChange={e => setSearchTerm(e.target.value.toLowerCase())}
  1275. />
  1276. </StyledSticky>
  1277. <Section section={unclassifiedSection} />
  1278. {filteredSections.map(section => (
  1279. <Section key={section.id} section={section} />
  1280. ))}
  1281. <PlatformIconsSection searchTerm={searchTerm} />
  1282. </Fragment>
  1283. );
  1284. }
  1285. function Section({section}: {section: TSection}) {
  1286. if (section.icons.length === 0) {
  1287. return null;
  1288. }
  1289. return (
  1290. <section>
  1291. <SectionHeader>{section.label}</SectionHeader>
  1292. <p>
  1293. <code>{"import { ... } from 'sentry/icons';"}</code>
  1294. </p>
  1295. <Grid style={{gridTemplateColumns: 'repeat(4, 1fr)'}}>
  1296. {section.icons.map(icon => {
  1297. const name = icon.name.startsWith('Icon') ? icon.name : `Icon${icon.name}`;
  1298. const Component = Icons[name];
  1299. const props = {color: 'gray500', size: 'sm', ...icon.defaultProps};
  1300. return (
  1301. <Tooltip
  1302. key={icon.id}
  1303. isHoverable
  1304. overlayStyle={{maxWidth: 440}}
  1305. title={<JSXNode name={name} props={props} />}
  1306. >
  1307. <Cell>
  1308. <Component {...props} />
  1309. {name}
  1310. </Cell>
  1311. </Tooltip>
  1312. );
  1313. })}
  1314. </Grid>
  1315. </section>
  1316. );
  1317. }
  1318. function PlatformIconsSection({searchTerm}: {searchTerm: string}) {
  1319. const filteredPlatforms = platforms.filter(platform => platform.includes(searchTerm));
  1320. return (
  1321. <section>
  1322. <SectionHeader>PlatformIcons</SectionHeader>
  1323. <p>
  1324. <code>{"import {PlatformIcon} from 'platformicons';"}</code>
  1325. </p>
  1326. <Grid
  1327. style={{
  1328. gridAutoFlow: 'column',
  1329. gridTemplateRows: `repeat(${Math.ceil(filteredPlatforms.length / 4)}, 1fr)`,
  1330. }}
  1331. >
  1332. {filteredPlatforms.map(platform => (
  1333. <Tooltip
  1334. key={platform}
  1335. isHoverable
  1336. overlayStyle={{maxWidth: 440}}
  1337. title={
  1338. <Fragment>
  1339. <JSXNode name="PlatformIcon" props={{platform}} />
  1340. </Fragment>
  1341. }
  1342. >
  1343. <Cell>
  1344. <PlatformIcon platform={platform} /> {platform}
  1345. </Cell>
  1346. </Tooltip>
  1347. ))}
  1348. </Grid>
  1349. </section>
  1350. );
  1351. }
  1352. const StyledSticky = styled(Sticky)`
  1353. background: ${p => p.theme.background};
  1354. z-index: ${p => p.theme.zIndex.initial};
  1355. &[data-stuck='true'] {
  1356. box-shadow: 0px 10px 20px -8px rgba(128, 128, 128, 0.89);
  1357. }
  1358. `;
  1359. const SectionHeader = styled('h5')`
  1360. margin-block: ${space(2)};
  1361. `;
  1362. const Grid = styled('div')`
  1363. display: grid;
  1364. gap: ${space(1)};
  1365. align-items: center;
  1366. `;
  1367. const Cell = styled('div')`
  1368. display: flex;
  1369. gap: ${space(1)};
  1370. align-items: center;
  1371. border: 1px solid transparent;
  1372. border-radius: ${p => p.theme.borderRadius};
  1373. padding: ${space(1)};
  1374. cursor: pointer;
  1375. &:hover {
  1376. border-color: ${p => p.theme.border};
  1377. }
  1378. `;