icons.stories.tsx 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359
  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: 'telescope',
  100. groups: ['product'],
  101. keywords: [],
  102. name: 'Telescope',
  103. defaultProps: {},
  104. },
  105. {
  106. id: 'lightning',
  107. groups: ['product'],
  108. keywords: ['feature', 'new', 'fresh'],
  109. name: 'Lightning',
  110. defaultProps: {},
  111. },
  112. {
  113. id: 'business',
  114. groups: ['product'],
  115. keywords: ['feature', 'promotion', 'fresh', 'new'],
  116. name: 'Business',
  117. defaultProps: {},
  118. },
  119. {
  120. id: 'siren',
  121. groups: ['product'],
  122. keywords: ['alert', 'important', 'warning'],
  123. name: 'Siren',
  124. defaultProps: {},
  125. },
  126. {
  127. id: 'profiling',
  128. groups: ['product', 'chart'],
  129. keywords: ['performance', 'span', 'flame', 'icicle'],
  130. name: 'Profiling',
  131. defaultProps: {},
  132. },
  133. {
  134. id: 'timer',
  135. groups: ['product', 'action'],
  136. keywords: ['cron', 'monitors', 'clock', 'cycle'],
  137. name: 'Timer',
  138. defaultProps: {},
  139. },
  140. ],
  141. },
  142. {
  143. id: 'logo',
  144. label: 'Logos',
  145. icons: [
  146. {
  147. id: 'sentry',
  148. groups: ['logo'],
  149. keywords: [],
  150. name: 'Sentry',
  151. defaultProps: {},
  152. },
  153. {
  154. id: 'codecov',
  155. groups: ['logo'],
  156. keywords: [],
  157. name: 'Codecov',
  158. defaultProps: {},
  159. },
  160. {
  161. id: 'bitbucket',
  162. groups: ['logo'],
  163. keywords: [],
  164. name: 'Bitbucket',
  165. defaultProps: {},
  166. },
  167. {
  168. id: 'discord',
  169. groups: ['logo'],
  170. keywords: [],
  171. name: 'Discord',
  172. defaultProps: {},
  173. },
  174. {
  175. id: 'github',
  176. groups: ['logo'],
  177. keywords: [],
  178. name: 'Github',
  179. defaultProps: {},
  180. },
  181. {
  182. id: 'gitlab',
  183. groups: ['logo'],
  184. keywords: [],
  185. name: 'Gitlab',
  186. defaultProps: {},
  187. },
  188. {
  189. id: 'google',
  190. groups: ['logo'],
  191. keywords: [],
  192. name: 'Google',
  193. defaultProps: {},
  194. },
  195. {
  196. id: 'jira',
  197. groups: ['logo'],
  198. keywords: [],
  199. name: 'Jira',
  200. defaultProps: {},
  201. },
  202. {
  203. id: 'trello',
  204. groups: ['logo'],
  205. keywords: [],
  206. name: 'Trello',
  207. defaultProps: {},
  208. },
  209. {
  210. id: 'vsts',
  211. groups: ['logo'],
  212. keywords: [],
  213. name: 'Vsts',
  214. defaultProps: {},
  215. },
  216. {
  217. id: 'generic',
  218. groups: ['logo'],
  219. keywords: [],
  220. name: 'Generic',
  221. defaultProps: {},
  222. },
  223. {
  224. id: 'asana',
  225. groups: ['logo'],
  226. keywords: [''],
  227. name: 'Asana',
  228. defaultProps: {},
  229. },
  230. {
  231. id: 'vercel',
  232. groups: ['logo'],
  233. keywords: [''],
  234. name: 'Vercel',
  235. defaultProps: {},
  236. },
  237. {
  238. id: 'teamwork',
  239. groups: ['logo'],
  240. keywords: [],
  241. name: 'Teamwork',
  242. defaultProps: {},
  243. },
  244. ],
  245. },
  246. {
  247. id: 'navigation',
  248. label: 'Navigation',
  249. icons: [
  250. {
  251. id: 'chevron-direction-left',
  252. groups: ['navigation'],
  253. keywords: [
  254. 'up',
  255. 'down',
  256. 'left',
  257. 'right',
  258. 'point',
  259. 'direct',
  260. 'move',
  261. 'expand',
  262. 'collapse',
  263. 'arrow',
  264. ],
  265. additionalProps: ['isCircled', 'direction'],
  266. name: 'Chevron',
  267. defaultProps: {
  268. isCircled: false,
  269. direction: 'left',
  270. },
  271. },
  272. {
  273. id: 'chevron-direction-right',
  274. name: 'Chevron',
  275. defaultProps: {
  276. isCircled: false,
  277. direction: 'right',
  278. },
  279. },
  280. {
  281. id: 'chevron-direction-up',
  282. name: 'Chevron',
  283. defaultProps: {
  284. isCircled: false,
  285. direction: 'up',
  286. },
  287. },
  288. {
  289. id: 'chevron-direction-down',
  290. name: 'Chevron',
  291. defaultProps: {
  292. isCircled: false,
  293. direction: 'down',
  294. },
  295. },
  296. {
  297. id: 'chevron-isCircled-direction-left',
  298. name: 'Chevron',
  299. defaultProps: {
  300. isCircled: true,
  301. direction: 'left',
  302. },
  303. },
  304. {
  305. id: 'chevron-isCircled-direction-right',
  306. name: 'Chevron',
  307. defaultProps: {
  308. isCircled: true,
  309. direction: 'right',
  310. },
  311. },
  312. {
  313. id: 'chevron-isCircled-direction-up',
  314. name: 'Chevron',
  315. defaultProps: {
  316. isCircled: true,
  317. direction: 'up',
  318. },
  319. },
  320. {
  321. id: 'chevron-isCircled-direction-down',
  322. name: 'Chevron',
  323. defaultProps: {
  324. isCircled: true,
  325. direction: 'down',
  326. },
  327. },
  328. {
  329. id: 'arrow-direction-left',
  330. groups: ['navigation'],
  331. keywords: ['up', 'down', 'left', 'right', 'point', 'direct', 'move'],
  332. additionalProps: ['direction'],
  333. name: 'Arrow',
  334. defaultProps: {
  335. direction: 'left',
  336. },
  337. },
  338. {
  339. id: 'arrow-direction-right',
  340. name: 'Arrow',
  341. defaultProps: {
  342. direction: 'right',
  343. },
  344. },
  345. {
  346. id: 'arrow-direction-up',
  347. name: 'Arrow',
  348. defaultProps: {
  349. direction: 'up',
  350. },
  351. },
  352. {
  353. id: 'arrow-direction-down',
  354. name: 'Arrow',
  355. defaultProps: {
  356. direction: 'down',
  357. },
  358. },
  359. {
  360. id: 'panel-direction-left',
  361. groups: ['navigation'],
  362. keywords: ['sidebar', 'footer', 'header'],
  363. additionalProps: ['direction'],
  364. name: 'Panel',
  365. defaultProps: {
  366. direction: 'left',
  367. },
  368. },
  369. {
  370. id: 'panel-direction-right',
  371. name: 'Panel',
  372. defaultProps: {
  373. direction: 'right',
  374. },
  375. },
  376. {
  377. id: 'panel-direction-up',
  378. name: 'Panel',
  379. defaultProps: {
  380. direction: 'up',
  381. },
  382. },
  383. {
  384. id: 'panel-direction-down',
  385. name: 'Panel',
  386. defaultProps: {
  387. direction: 'down',
  388. },
  389. },
  390. ],
  391. },
  392. {
  393. id: 'status',
  394. label: 'Status',
  395. icons: [
  396. {
  397. id: 'lock',
  398. groups: ['action', 'status'],
  399. keywords: ['secure'],
  400. additionalProps: ['isSolid'],
  401. name: 'Lock',
  402. defaultProps: {
  403. isSolid: false,
  404. },
  405. },
  406. {
  407. id: 'lock-isSolid',
  408. name: 'Lock',
  409. defaultProps: {
  410. isSolid: true,
  411. },
  412. },
  413. {
  414. id: 'fire',
  415. groups: ['status'],
  416. keywords: ['danger', 'severe', 'critical'],
  417. name: 'Fire',
  418. defaultProps: {},
  419. },
  420. {
  421. id: 'fatal',
  422. groups: ['status'],
  423. keywords: ['skull'],
  424. name: 'Fatal',
  425. defaultProps: {},
  426. },
  427. {
  428. id: 'warning',
  429. groups: ['status'],
  430. keywords: ['alert', 'notification'],
  431. name: 'Warning',
  432. defaultProps: {},
  433. },
  434. {
  435. id: 'exclamation',
  436. groups: ['status'],
  437. keywords: ['alert', 'warning'],
  438. name: 'Exclamation',
  439. defaultProps: {},
  440. },
  441. {
  442. id: 'not',
  443. groups: ['status'],
  444. keywords: ['invalid', 'no', 'forbidden'],
  445. name: 'Not',
  446. defaultProps: {},
  447. },
  448. {
  449. id: 'circle',
  450. groups: ['status'],
  451. keywords: ['shape', 'round'],
  452. name: 'Circle',
  453. defaultProps: {},
  454. },
  455. {
  456. id: 'circleFill',
  457. groups: ['status'],
  458. keywords: ['shape', 'round'],
  459. name: 'CircleFill',
  460. defaultProps: {},
  461. },
  462. {
  463. id: 'diamond',
  464. groups: ['status'],
  465. keywords: ['shape', 'alert', 'diamond'],
  466. name: 'Diamond',
  467. defaultProps: {},
  468. },
  469. {
  470. id: 'flag',
  471. groups: ['status'],
  472. keywords: ['bookmark', 'mark', 'save', 'warning', 'message'],
  473. name: 'Flag',
  474. defaultProps: {},
  475. },
  476. {
  477. id: 'happy',
  478. groups: ['status'],
  479. keywords: ['good'],
  480. name: 'Happy',
  481. defaultProps: {},
  482. },
  483. {
  484. id: 'meh',
  485. groups: ['status'],
  486. keywords: ['meh'],
  487. name: 'Meh',
  488. defaultProps: {},
  489. },
  490. {
  491. id: 'sad',
  492. groups: ['status'],
  493. keywords: ['poor'],
  494. name: 'Sad',
  495. defaultProps: {},
  496. },
  497. {
  498. id: 'frozen',
  499. groups: ['status'],
  500. keywords: ['frame', 'mobile'],
  501. name: 'Frozen',
  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. },
  1013. {
  1014. id: 'chart',
  1015. label: 'Chart',
  1016. icons: [
  1017. {
  1018. id: 'graph-type-line',
  1019. groups: ['chart'],
  1020. keywords: ['line', 'plot'],
  1021. additionalProps: ['type'],
  1022. name: 'Graph',
  1023. defaultProps: {
  1024. type: 'line',
  1025. },
  1026. },
  1027. {
  1028. id: 'graph-type-circle',
  1029. name: 'Graph',
  1030. defaultProps: {
  1031. type: 'circle',
  1032. },
  1033. },
  1034. {
  1035. id: 'graph-type-bar',
  1036. name: 'Graph',
  1037. defaultProps: {
  1038. type: 'bar',
  1039. },
  1040. },
  1041. {
  1042. id: 'graph-type-area',
  1043. name: 'Graph',
  1044. defaultProps: {
  1045. type: 'area',
  1046. },
  1047. },
  1048. {
  1049. id: 'stack',
  1050. groups: ['chart'],
  1051. keywords: ['group', 'combine', 'view'],
  1052. name: 'Stack',
  1053. defaultProps: {},
  1054. },
  1055. {
  1056. id: 'span',
  1057. groups: ['chart'],
  1058. keywords: ['performance', 'transaction'],
  1059. name: 'Span',
  1060. defaultProps: {},
  1061. },
  1062. {
  1063. id: 'number',
  1064. groups: ['chart'],
  1065. keywords: ['value'],
  1066. name: 'Number',
  1067. defaultProps: {},
  1068. },
  1069. {
  1070. id: 'profiling',
  1071. name: 'Profiling',
  1072. defaultProps: {},
  1073. },
  1074. ],
  1075. },
  1076. {
  1077. id: 'device',
  1078. label: 'Device',
  1079. icons: [
  1080. {
  1081. id: 'return',
  1082. groups: ['device'],
  1083. keywords: ['enter'],
  1084. name: 'Return',
  1085. defaultProps: {},
  1086. },
  1087. {
  1088. id: 'file',
  1089. groups: ['device'],
  1090. keywords: ['document'],
  1091. name: 'File',
  1092. defaultProps: {},
  1093. },
  1094. {
  1095. id: 'print',
  1096. groups: ['device'],
  1097. keywords: [],
  1098. name: 'Print',
  1099. defaultProps: {},
  1100. },
  1101. {
  1102. id: 'code',
  1103. groups: ['device'],
  1104. keywords: ['snippet', 'javascript', 'json', 'curly', 'source'],
  1105. name: 'Code',
  1106. defaultProps: {},
  1107. },
  1108. {
  1109. id: 'json',
  1110. groups: ['device'],
  1111. keywords: ['snippet', 'code', 'javascript', 'source'],
  1112. name: 'Json',
  1113. defaultProps: {},
  1114. },
  1115. {
  1116. id: 'markdown',
  1117. groups: ['device'],
  1118. keywords: ['code'],
  1119. name: 'Markdown',
  1120. defaultProps: {},
  1121. },
  1122. {
  1123. id: 'terminal',
  1124. groups: ['device', 'device'],
  1125. keywords: ['code', 'bash', 'command'],
  1126. name: 'Terminal',
  1127. defaultProps: {},
  1128. },
  1129. {
  1130. id: 'commit',
  1131. groups: ['device'],
  1132. keywords: ['git', 'github'],
  1133. name: 'Commit',
  1134. defaultProps: {},
  1135. },
  1136. {
  1137. id: 'laptop',
  1138. groups: ['device'],
  1139. keywords: ['computer', 'macbook'],
  1140. name: 'Laptop',
  1141. defaultProps: {},
  1142. },
  1143. {
  1144. id: 'mobile',
  1145. groups: ['device'],
  1146. keywords: ['phone', 'iphone'],
  1147. name: 'Mobile',
  1148. defaultProps: {},
  1149. },
  1150. {
  1151. id: 'window',
  1152. groups: ['device'],
  1153. keywords: ['application'],
  1154. name: 'Window',
  1155. defaultProps: {},
  1156. },
  1157. {
  1158. id: 'calendar',
  1159. groups: ['device'],
  1160. keywords: ['time', 'date'],
  1161. name: 'Calendar',
  1162. defaultProps: {},
  1163. },
  1164. {
  1165. id: 'mail',
  1166. groups: ['device'],
  1167. keywords: ['email'],
  1168. name: 'Mail',
  1169. defaultProps: {},
  1170. },
  1171. {
  1172. id: 'input',
  1173. groups: ['device'],
  1174. keywords: ['text'],
  1175. name: 'Input',
  1176. defaultProps: {},
  1177. },
  1178. {
  1179. id: 'option',
  1180. groups: ['device'],
  1181. keywords: [''],
  1182. name: 'Option',
  1183. defaultProps: {},
  1184. },
  1185. {
  1186. id: 'fileBroken',
  1187. groups: ['device'],
  1188. keywords: ['file', 'missing', 'error'],
  1189. name: 'FileBroken',
  1190. defaultProps: {},
  1191. },
  1192. {
  1193. id: 'image',
  1194. groups: ['device'],
  1195. keywords: ['image', 'photo', 'screenshot'],
  1196. name: 'Image',
  1197. defaultProps: {},
  1198. },
  1199. ],
  1200. },
  1201. ];
  1202. export default function IconsStories() {
  1203. const [searchTerm, setSearchTerm] = useState('');
  1204. const definedWithPrefix = new Set<string>();
  1205. SECTIONS.forEach(section =>
  1206. section.icons.forEach(icon => definedWithPrefix.add(`Icon${icon.name}`))
  1207. );
  1208. const unclassifiedSection = {
  1209. id: 'other',
  1210. label: 'Unclassified',
  1211. icons: Object.keys(Icons)
  1212. .filter(name => !definedWithPrefix.has(name))
  1213. .map((name): TIcon => ({id: name, name})),
  1214. };
  1215. const filteredSections = searchTerm
  1216. ? SECTIONS.map(section => ({
  1217. ...section,
  1218. icons: section.icons.filter(
  1219. icon =>
  1220. icon.name.toLowerCase().includes(searchTerm) ||
  1221. icon.keywords?.some(keyword => keyword.toLowerCase().includes(searchTerm))
  1222. ),
  1223. }))
  1224. : SECTIONS;
  1225. return (
  1226. <Fragment>
  1227. <StyledSticky>
  1228. <p>
  1229. In addition to icon name, you can also search by keyword. For example, typing
  1230. either <kbd>checkmark</kbd> or <kbd>success</kbd> will return{' '}
  1231. <samp>IconCheckmark</samp>.
  1232. </p>
  1233. <Input
  1234. placeholder="Search icons by name or keyword"
  1235. onChange={e => setSearchTerm(e.target.value.toLowerCase())}
  1236. />
  1237. </StyledSticky>
  1238. <Section section={unclassifiedSection} />
  1239. {filteredSections.map(section => (
  1240. <Section key={section.id} section={section} />
  1241. ))}
  1242. <PlatformIconsSection searchTerm={searchTerm} />
  1243. </Fragment>
  1244. );
  1245. }
  1246. function Section({section}: {section: TSection}) {
  1247. if (section.icons.length === 0) {
  1248. return null;
  1249. }
  1250. return (
  1251. <section>
  1252. <SectionHeader>{section.label}</SectionHeader>
  1253. <p>
  1254. <code>{"import { ... } from 'sentry/icons';"}</code>
  1255. </p>
  1256. <Grid style={{gridTemplateColumns: 'repeat(4, 1fr)'}}>
  1257. {section.icons.map(icon => {
  1258. const name = icon.name.startsWith('Icon') ? icon.name : `Icon${icon.name}`;
  1259. const Component = Icons[name];
  1260. const props = {color: 'gray500', size: 'sm', ...icon.defaultProps};
  1261. return (
  1262. <Tooltip
  1263. key={icon.id}
  1264. isHoverable
  1265. overlayStyle={{maxWidth: 440}}
  1266. title={<JSXNode name={name} props={props} />}
  1267. >
  1268. <Cell>
  1269. <Component {...props} />
  1270. {name}
  1271. </Cell>
  1272. </Tooltip>
  1273. );
  1274. })}
  1275. </Grid>
  1276. </section>
  1277. );
  1278. }
  1279. function PlatformIconsSection({searchTerm}: {searchTerm: string}) {
  1280. const filteredPlatforms = platforms.filter(platform => platform.includes(searchTerm));
  1281. return (
  1282. <section>
  1283. <SectionHeader>PlatformIcons</SectionHeader>
  1284. <p>
  1285. <code>{"import {PlatformIcon} from 'platformicons';"}</code>
  1286. </p>
  1287. <Grid
  1288. style={{
  1289. gridAutoFlow: 'column',
  1290. gridTemplateRows: `repeat(${Math.ceil(filteredPlatforms.length / 4)}, 1fr)`,
  1291. }}
  1292. >
  1293. {filteredPlatforms.map(platform => (
  1294. <Tooltip
  1295. key={platform}
  1296. isHoverable
  1297. overlayStyle={{maxWidth: 440}}
  1298. title={
  1299. <Fragment>
  1300. <JSXNode name="PlatformIcon" props={{platform}} />
  1301. </Fragment>
  1302. }
  1303. >
  1304. <Cell>
  1305. <PlatformIcon platform={platform} /> {platform}
  1306. </Cell>
  1307. </Tooltip>
  1308. ))}
  1309. </Grid>
  1310. </section>
  1311. );
  1312. }
  1313. const StyledSticky = styled(Sticky)`
  1314. background: ${p => p.theme.background};
  1315. z-index: ${p => p.theme.zIndex.initial};
  1316. &[data-stuck='true'] {
  1317. box-shadow: 0px 10px 20px -8px rgba(128, 128, 128, 0.89);
  1318. }
  1319. `;
  1320. const SectionHeader = styled('h5')`
  1321. margin-block: ${space(2)};
  1322. `;
  1323. const Grid = styled('div')`
  1324. display: grid;
  1325. gap: ${space(1)};
  1326. align-items: center;
  1327. `;
  1328. const Cell = styled('div')`
  1329. display: flex;
  1330. gap: ${space(1)};
  1331. align-items: center;
  1332. border: 1px solid transparent;
  1333. border-radius: ${p => p.theme.borderRadius};
  1334. padding: ${space(1)};
  1335. cursor: pointer;
  1336. &:hover {
  1337. border-color: ${p => p.theme.border};
  1338. }
  1339. `;