icons.stories.tsx 32 KB

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