icons.stories.tsx 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382
  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. },
  1031. {
  1032. id: 'chart',
  1033. label: 'Visualizations',
  1034. icons: [
  1035. {
  1036. id: 'graph-type-line',
  1037. groups: ['chart'],
  1038. keywords: ['line', 'plot'],
  1039. additionalProps: ['type'],
  1040. name: 'Graph',
  1041. defaultProps: {
  1042. type: 'line',
  1043. },
  1044. },
  1045. {
  1046. id: 'graph-type-circle',
  1047. name: 'Graph',
  1048. defaultProps: {
  1049. type: 'circle',
  1050. },
  1051. },
  1052. {
  1053. id: 'graph-type-bar',
  1054. name: 'Graph',
  1055. defaultProps: {
  1056. type: 'bar',
  1057. },
  1058. },
  1059. {
  1060. id: 'graph-type-area',
  1061. name: 'Graph',
  1062. defaultProps: {
  1063. type: 'area',
  1064. },
  1065. },
  1066. {
  1067. id: 'graph-type-scatter',
  1068. name: 'Graph',
  1069. defaultProps: {
  1070. type: 'scatter',
  1071. },
  1072. },
  1073. {
  1074. id: 'stack',
  1075. groups: ['chart'],
  1076. keywords: ['group', 'combine', 'view'],
  1077. name: 'Stack',
  1078. defaultProps: {},
  1079. },
  1080. {
  1081. id: 'span',
  1082. groups: ['chart'],
  1083. keywords: ['performance', 'transaction'],
  1084. name: 'Span',
  1085. defaultProps: {},
  1086. },
  1087. {
  1088. id: 'number',
  1089. groups: ['chart'],
  1090. keywords: ['value'],
  1091. name: 'Number',
  1092. defaultProps: {},
  1093. },
  1094. {
  1095. id: 'profiling',
  1096. name: 'Profiling',
  1097. defaultProps: {},
  1098. },
  1099. {
  1100. id: 'table',
  1101. name: 'Table',
  1102. defaultProps: {},
  1103. },
  1104. ],
  1105. },
  1106. {
  1107. id: 'device',
  1108. label: 'Device',
  1109. icons: [
  1110. {
  1111. id: 'return',
  1112. groups: ['device'],
  1113. keywords: ['enter'],
  1114. name: 'Return',
  1115. defaultProps: {},
  1116. },
  1117. {
  1118. id: 'file',
  1119. groups: ['device'],
  1120. keywords: ['document'],
  1121. name: 'File',
  1122. defaultProps: {},
  1123. },
  1124. {
  1125. id: 'print',
  1126. groups: ['device'],
  1127. keywords: [],
  1128. name: 'Print',
  1129. defaultProps: {},
  1130. },
  1131. {
  1132. id: 'code',
  1133. groups: ['device'],
  1134. keywords: ['snippet', 'javascript', 'json', 'curly', 'source'],
  1135. name: 'Code',
  1136. defaultProps: {},
  1137. },
  1138. {
  1139. id: 'json',
  1140. groups: ['device'],
  1141. keywords: ['snippet', 'code', 'javascript', 'source'],
  1142. name: 'Json',
  1143. defaultProps: {},
  1144. },
  1145. {
  1146. id: 'markdown',
  1147. groups: ['device'],
  1148. keywords: ['code'],
  1149. name: 'Markdown',
  1150. defaultProps: {},
  1151. },
  1152. {
  1153. id: 'terminal',
  1154. groups: ['device', 'device'],
  1155. keywords: ['code', 'bash', 'command'],
  1156. name: 'Terminal',
  1157. defaultProps: {},
  1158. },
  1159. {
  1160. id: 'commit',
  1161. groups: ['device'],
  1162. keywords: ['git', 'github'],
  1163. name: 'Commit',
  1164. defaultProps: {},
  1165. },
  1166. {
  1167. id: 'laptop',
  1168. groups: ['device'],
  1169. keywords: ['computer', 'macbook'],
  1170. name: 'Laptop',
  1171. defaultProps: {},
  1172. },
  1173. {
  1174. id: 'mobile',
  1175. groups: ['device'],
  1176. keywords: ['phone', 'iphone'],
  1177. name: 'Mobile',
  1178. defaultProps: {},
  1179. },
  1180. {
  1181. id: 'window',
  1182. groups: ['device'],
  1183. keywords: ['application'],
  1184. name: 'Window',
  1185. defaultProps: {},
  1186. },
  1187. {
  1188. id: 'calendar',
  1189. groups: ['device'],
  1190. keywords: ['time', 'date'],
  1191. name: 'Calendar',
  1192. defaultProps: {},
  1193. },
  1194. {
  1195. id: 'mail',
  1196. groups: ['device'],
  1197. keywords: ['email'],
  1198. name: 'Mail',
  1199. defaultProps: {},
  1200. },
  1201. {
  1202. id: 'input',
  1203. groups: ['device'],
  1204. keywords: ['text'],
  1205. name: 'Input',
  1206. defaultProps: {},
  1207. },
  1208. {
  1209. id: 'fileBroken',
  1210. groups: ['device'],
  1211. keywords: ['file', 'missing', 'error'],
  1212. name: 'FileBroken',
  1213. defaultProps: {},
  1214. },
  1215. {
  1216. id: 'image',
  1217. groups: ['device'],
  1218. keywords: ['image', 'photo', 'screenshot'],
  1219. name: 'Image',
  1220. defaultProps: {},
  1221. },
  1222. ],
  1223. },
  1224. ];
  1225. export default function IconsStories() {
  1226. const [searchTerm, setSearchTerm] = useState('');
  1227. const definedWithPrefix = new Set<string>();
  1228. SECTIONS.forEach(section =>
  1229. section.icons.forEach(icon => definedWithPrefix.add(`Icon${icon.name}`))
  1230. );
  1231. const unclassifiedSection = {
  1232. id: 'other',
  1233. label: 'Unclassified',
  1234. icons: Object.keys(Icons)
  1235. .filter(name => !definedWithPrefix.has(name))
  1236. .map((name): TIcon => ({id: name, name})),
  1237. };
  1238. const filteredSections = searchTerm
  1239. ? SECTIONS.map(section => ({
  1240. ...section,
  1241. icons: section.icons.filter(
  1242. icon =>
  1243. icon.name.toLowerCase().includes(searchTerm) ||
  1244. icon.keywords?.some(keyword => keyword.toLowerCase().includes(searchTerm))
  1245. ),
  1246. }))
  1247. : SECTIONS;
  1248. return (
  1249. <Fragment>
  1250. <StyledSticky>
  1251. <p>
  1252. In addition to icon name, you can also search by keyword. For example, typing
  1253. either <kbd>checkmark</kbd> or <kbd>success</kbd> will return{' '}
  1254. <samp>IconCheckmark</samp>.
  1255. </p>
  1256. <Input
  1257. placeholder="Search icons by name or keyword"
  1258. onChange={e => setSearchTerm(e.target.value.toLowerCase())}
  1259. />
  1260. </StyledSticky>
  1261. <Section section={unclassifiedSection} />
  1262. {filteredSections.map(section => (
  1263. <Section key={section.id} section={section} />
  1264. ))}
  1265. <PlatformIconsSection searchTerm={searchTerm} />
  1266. </Fragment>
  1267. );
  1268. }
  1269. function Section({section}: {section: TSection}) {
  1270. if (section.icons.length === 0) {
  1271. return null;
  1272. }
  1273. return (
  1274. <section>
  1275. <SectionHeader>{section.label}</SectionHeader>
  1276. <p>
  1277. <code>{"import { ... } from 'sentry/icons';"}</code>
  1278. </p>
  1279. <Grid style={{gridTemplateColumns: 'repeat(4, 1fr)'}}>
  1280. {section.icons.map(icon => {
  1281. const name = icon.name.startsWith('Icon') ? icon.name : `Icon${icon.name}`;
  1282. const Component = Icons[name];
  1283. const props = {color: 'gray500', size: 'sm', ...icon.defaultProps};
  1284. return (
  1285. <Tooltip
  1286. key={icon.id}
  1287. isHoverable
  1288. overlayStyle={{maxWidth: 440}}
  1289. title={<JSXNode name={name} props={props} />}
  1290. >
  1291. <Cell>
  1292. <Component {...props} />
  1293. {name}
  1294. </Cell>
  1295. </Tooltip>
  1296. );
  1297. })}
  1298. </Grid>
  1299. </section>
  1300. );
  1301. }
  1302. function PlatformIconsSection({searchTerm}: {searchTerm: string}) {
  1303. const filteredPlatforms = platforms.filter(platform => platform.includes(searchTerm));
  1304. return (
  1305. <section>
  1306. <SectionHeader>PlatformIcons</SectionHeader>
  1307. <p>
  1308. <code>{"import {PlatformIcon} from 'platformicons';"}</code>
  1309. </p>
  1310. <Grid
  1311. style={{
  1312. gridAutoFlow: 'column',
  1313. gridTemplateRows: `repeat(${Math.ceil(filteredPlatforms.length / 4)}, 1fr)`,
  1314. }}
  1315. >
  1316. {filteredPlatforms.map(platform => (
  1317. <Tooltip
  1318. key={platform}
  1319. isHoverable
  1320. overlayStyle={{maxWidth: 440}}
  1321. title={
  1322. <Fragment>
  1323. <JSXNode name="PlatformIcon" props={{platform}} />
  1324. </Fragment>
  1325. }
  1326. >
  1327. <Cell>
  1328. <PlatformIcon platform={platform} /> {platform}
  1329. </Cell>
  1330. </Tooltip>
  1331. ))}
  1332. </Grid>
  1333. </section>
  1334. );
  1335. }
  1336. const StyledSticky = styled(Sticky)`
  1337. background: ${p => p.theme.background};
  1338. z-index: ${p => p.theme.zIndex.initial};
  1339. &[data-stuck='true'] {
  1340. box-shadow: 0px 10px 20px -8px rgba(128, 128, 128, 0.89);
  1341. }
  1342. `;
  1343. const SectionHeader = styled('h5')`
  1344. margin-block: ${space(2)};
  1345. `;
  1346. const Grid = styled('div')`
  1347. display: grid;
  1348. gap: ${space(1)};
  1349. align-items: center;
  1350. `;
  1351. const Cell = styled('div')`
  1352. display: flex;
  1353. gap: ${space(1)};
  1354. align-items: center;
  1355. border: 1px solid transparent;
  1356. border-radius: ${p => p.theme.borderRadius};
  1357. padding: ${space(1)};
  1358. cursor: pointer;
  1359. &:hover {
  1360. border-color: ${p => p.theme.border};
  1361. }
  1362. `;