icons.stories.tsx 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352
  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. },
  1194. ];
  1195. export default function IconsStories() {
  1196. const [searchTerm, setSearchTerm] = useState('');
  1197. const definedWithPrefix = new Set<string>();
  1198. SECTIONS.forEach(section =>
  1199. section.icons.forEach(icon => definedWithPrefix.add(`Icon${icon.name}`))
  1200. );
  1201. const unclassifiedSection = {
  1202. id: 'other',
  1203. label: 'Unclassified',
  1204. icons: Object.keys(Icons)
  1205. .filter(name => !definedWithPrefix.has(name))
  1206. .map((name): TIcon => ({id: name, name})),
  1207. };
  1208. const filteredSections = searchTerm
  1209. ? SECTIONS.map(section => ({
  1210. ...section,
  1211. icons: section.icons.filter(
  1212. icon =>
  1213. icon.name.toLowerCase().includes(searchTerm) ||
  1214. icon.keywords?.some(keyword => keyword.toLowerCase().includes(searchTerm))
  1215. ),
  1216. }))
  1217. : SECTIONS;
  1218. return (
  1219. <Fragment>
  1220. <StyledSticky>
  1221. <p>
  1222. In addition to icon name, you can also search by keyword. For example, typing
  1223. either <kbd>checkmark</kbd> or <kbd>success</kbd> will return{' '}
  1224. <samp>IconCheckmark</samp>.
  1225. </p>
  1226. <Input
  1227. placeholder="Search icons by name or keyword"
  1228. onChange={e => setSearchTerm(e.target.value.toLowerCase())}
  1229. />
  1230. </StyledSticky>
  1231. <Section section={unclassifiedSection} />
  1232. {filteredSections.map(section => (
  1233. <Section key={section.id} section={section} />
  1234. ))}
  1235. <PlatformIconsSection searchTerm={searchTerm} />
  1236. </Fragment>
  1237. );
  1238. }
  1239. function Section({section}: {section: TSection}) {
  1240. if (section.icons.length === 0) {
  1241. return null;
  1242. }
  1243. return (
  1244. <section>
  1245. <SectionHeader>{section.label}</SectionHeader>
  1246. <p>
  1247. <code>{"import { ... } from 'sentry/icons';"}</code>
  1248. </p>
  1249. <Grid style={{gridTemplateColumns: 'repeat(4, 1fr)'}}>
  1250. {section.icons.map(icon => {
  1251. const name = icon.name.startsWith('Icon') ? icon.name : `Icon${icon.name}`;
  1252. const Component = Icons[name];
  1253. const props = {color: 'gray500', size: 'sm', ...icon.defaultProps};
  1254. return (
  1255. <Tooltip
  1256. key={icon.id}
  1257. isHoverable
  1258. overlayStyle={{maxWidth: 440}}
  1259. title={<JSXNode name={name} props={props} />}
  1260. >
  1261. <Cell>
  1262. <Component {...props} />
  1263. {name}
  1264. </Cell>
  1265. </Tooltip>
  1266. );
  1267. })}
  1268. </Grid>
  1269. </section>
  1270. );
  1271. }
  1272. function PlatformIconsSection({searchTerm}: {searchTerm: string}) {
  1273. const filteredPlatforms = platforms.filter(platform => platform.includes(searchTerm));
  1274. return (
  1275. <section>
  1276. <SectionHeader>PlatformIcons</SectionHeader>
  1277. <p>
  1278. <code>{"import {PlatformIcon} from 'platformicons';"}</code>
  1279. </p>
  1280. <Grid
  1281. style={{
  1282. gridAutoFlow: 'column',
  1283. gridTemplateRows: `repeat(${Math.ceil(filteredPlatforms.length / 4)}, 1fr)`,
  1284. }}
  1285. >
  1286. {filteredPlatforms.map(platform => (
  1287. <Tooltip
  1288. key={platform}
  1289. isHoverable
  1290. overlayStyle={{maxWidth: 440}}
  1291. title={
  1292. <Fragment>
  1293. <JSXNode name="PlatformIcon" props={{platform}} />
  1294. </Fragment>
  1295. }
  1296. >
  1297. <Cell>
  1298. <PlatformIcon platform={platform} /> {platform}
  1299. </Cell>
  1300. </Tooltip>
  1301. ))}
  1302. </Grid>
  1303. </section>
  1304. );
  1305. }
  1306. const StyledSticky = styled(Sticky)`
  1307. background: ${p => p.theme.background};
  1308. z-index: ${p => p.theme.zIndex.initial};
  1309. &[data-stuck='true'] {
  1310. box-shadow: 0px 10px 20px -8px rgba(128, 128, 128, 0.89);
  1311. }
  1312. `;
  1313. const SectionHeader = styled('h5')`
  1314. margin-block: ${space(2)};
  1315. `;
  1316. const Grid = styled('div')`
  1317. display: grid;
  1318. gap: ${space(1)};
  1319. align-items: center;
  1320. `;
  1321. const Cell = styled('div')`
  1322. display: flex;
  1323. gap: ${space(1)};
  1324. align-items: center;
  1325. border: 1px solid transparent;
  1326. border-radius: ${p => p.theme.borderRadius};
  1327. padding: ${space(1)};
  1328. cursor: pointer;
  1329. &:hover {
  1330. border-color: ${p => p.theme.border};
  1331. }
  1332. `;