@khanacademy/wonder-blocks-icon 1.2.29 → 1.2.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @khanacademy/wonder-blocks-icon
2
2
 
3
+ ## 1.2.30
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [6ee20af9]
8
+ - @khanacademy/wonder-blocks-core@4.4.0
9
+
3
10
  ## 1.2.29
4
11
 
5
12
  ### Patch Changes
package/dist/index.js CHANGED
@@ -82,7 +82,7 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 6);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 7);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ([
@@ -240,20 +240,21 @@ const getPathForIcon = (icon, size) => {
240
240
 
241
241
  "use strict";
242
242
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Icon; });
243
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
244
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
245
- /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
246
- /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_1__);
247
- /* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5);
248
- /* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2__);
249
- /* harmony import */ var _util_icon_util_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1);
250
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
243
+ /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
244
+ /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
245
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
246
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
247
+ /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5);
248
+ /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_2__);
249
+ /* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6);
250
+ /* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_3__);
251
+ /* harmony import */ var _util_icon_util_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1);
251
252
 
252
253
 
253
254
 
254
255
 
255
256
 
256
- const StyledSVG = Object(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2__["addStyle"])("svg");
257
+ const StyledSVG = Object(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_3__["addStyle"])("svg");
257
258
  /**
258
259
  * An Icon displays a small informational or decorative image as an SVG.
259
260
  *
@@ -290,7 +291,7 @@ const StyledSVG = Object(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODUL
290
291
  * respectively.
291
292
  */
292
293
 
293
- class Icon extends react__WEBPACK_IMPORTED_MODULE_0__["PureComponent"] {
294
+ class Icon extends react__WEBPACK_IMPORTED_MODULE_1__["PureComponent"] {
294
295
  render() {
295
296
  const {
296
297
  color,
@@ -303,16 +304,16 @@ class Icon extends react__WEBPACK_IMPORTED_MODULE_0__["PureComponent"] {
303
304
  const {
304
305
  assetSize,
305
306
  path
306
- } = Object(_util_icon_util_js__WEBPACK_IMPORTED_MODULE_3__[/* getPathForIcon */ "a"])(icon, size);
307
- const pixelSize = Object(_util_icon_util_js__WEBPACK_IMPORTED_MODULE_3__[/* viewportPixelsForSize */ "b"])(size);
308
- const viewboxPixelSize = Object(_util_icon_util_js__WEBPACK_IMPORTED_MODULE_3__[/* viewportPixelsForSize */ "b"])(assetSize);
309
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](StyledSVG, _extends({}, sharedProps, {
307
+ } = Object(_util_icon_util_js__WEBPACK_IMPORTED_MODULE_4__[/* getPathForIcon */ "a"])(icon, size);
308
+ const pixelSize = Object(_util_icon_util_js__WEBPACK_IMPORTED_MODULE_4__[/* viewportPixelsForSize */ "b"])(size);
309
+ const viewboxPixelSize = Object(_util_icon_util_js__WEBPACK_IMPORTED_MODULE_4__[/* viewportPixelsForSize */ "b"])(assetSize);
310
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](StyledSVG, _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, sharedProps, {
310
311
  style: [styles.svg, style],
311
312
  width: pixelSize,
312
313
  height: pixelSize,
313
314
  viewBox: `0 0 ${viewboxPixelSize} ${viewboxPixelSize}`,
314
315
  "data-test-id": testId
315
- }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("path", {
316
+ }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("path", {
316
317
  fill: color,
317
318
  d: path
318
319
  }));
@@ -323,7 +324,7 @@ Icon.defaultProps = {
323
324
  color: "currentColor",
324
325
  size: "small"
325
326
  };
326
- const styles = aphrodite__WEBPACK_IMPORTED_MODULE_1__["StyleSheet"].create({
327
+ const styles = aphrodite__WEBPACK_IMPORTED_MODULE_2__["StyleSheet"].create({
327
328
  svg: {
328
329
  display: "inline-block",
329
330
  verticalAlign: "text-bottom",
@@ -336,16 +337,39 @@ const styles = aphrodite__WEBPACK_IMPORTED_MODULE_1__["StyleSheet"].create({
336
337
  /* 4 */
337
338
  /***/ (function(module, exports) {
338
339
 
339
- module.exports = require("aphrodite");
340
+ function _extends() {
341
+ module.exports = _extends = Object.assign ? Object.assign.bind() : function (target) {
342
+ for (var i = 1; i < arguments.length; i++) {
343
+ var source = arguments[i];
344
+
345
+ for (var key in source) {
346
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
347
+ target[key] = source[key];
348
+ }
349
+ }
350
+ }
351
+
352
+ return target;
353
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports;
354
+ return _extends.apply(this, arguments);
355
+ }
356
+
357
+ module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports;
340
358
 
341
359
  /***/ }),
342
360
  /* 5 */
343
361
  /***/ (function(module, exports) {
344
362
 
345
- module.exports = require("@khanacademy/wonder-blocks-core");
363
+ module.exports = require("aphrodite");
346
364
 
347
365
  /***/ }),
348
366
  /* 6 */
367
+ /***/ (function(module, exports) {
368
+
369
+ module.exports = require("@khanacademy/wonder-blocks-core");
370
+
371
+ /***/ }),
372
+ /* 7 */
349
373
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
350
374
 
351
375
  "use strict";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-icon",
3
- "version": "1.2.29",
3
+ "version": "1.2.30",
4
4
  "design": "v1",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -15,8 +15,8 @@
15
15
  "author": "",
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "@babel/runtime": "^7.16.3",
19
- "@khanacademy/wonder-blocks-core": "^4.3.2"
18
+ "@babel/runtime": "^7.18.6",
19
+ "@khanacademy/wonder-blocks-core": "^4.4.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "wb-dev-build-settings": "^0.4.0"
@@ -4,7 +4,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
4
4
  <table
5
5
  className=""
6
6
  style={
7
- Object {
7
+ {
8
8
  "borderCollapse": "collapse",
9
9
  }
10
10
  }
@@ -43,7 +43,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
43
43
  className=""
44
44
  height={24}
45
45
  style={
46
- Object {
46
+ {
47
47
  "display": "inline-block",
48
48
  "flexGrow": 0,
49
49
  "flexShrink": 0,
@@ -73,7 +73,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
73
73
  className=""
74
74
  height={16}
75
75
  style={
76
- Object {
76
+ {
77
77
  "display": "inline-block",
78
78
  "flexGrow": 0,
79
79
  "flexShrink": 0,
@@ -96,7 +96,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
96
96
  className=""
97
97
  height={24}
98
98
  style={
99
- Object {
99
+ {
100
100
  "display": "inline-block",
101
101
  "flexGrow": 0,
102
102
  "flexShrink": 0,
@@ -126,7 +126,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
126
126
  className=""
127
127
  height={16}
128
128
  style={
129
- Object {
129
+ {
130
130
  "display": "inline-block",
131
131
  "flexGrow": 0,
132
132
  "flexShrink": 0,
@@ -149,7 +149,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
149
149
  className=""
150
150
  height={24}
151
151
  style={
152
- Object {
152
+ {
153
153
  "display": "inline-block",
154
154
  "flexGrow": 0,
155
155
  "flexShrink": 0,
@@ -179,7 +179,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
179
179
  className=""
180
180
  height={16}
181
181
  style={
182
- Object {
182
+ {
183
183
  "display": "inline-block",
184
184
  "flexGrow": 0,
185
185
  "flexShrink": 0,
@@ -202,7 +202,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
202
202
  className=""
203
203
  height={24}
204
204
  style={
205
- Object {
205
+ {
206
206
  "display": "inline-block",
207
207
  "flexGrow": 0,
208
208
  "flexShrink": 0,
@@ -232,7 +232,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
232
232
  className=""
233
233
  height={16}
234
234
  style={
235
- Object {
235
+ {
236
236
  "display": "inline-block",
237
237
  "flexGrow": 0,
238
238
  "flexShrink": 0,
@@ -255,7 +255,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
255
255
  className=""
256
256
  height={24}
257
257
  style={
258
- Object {
258
+ {
259
259
  "display": "inline-block",
260
260
  "flexGrow": 0,
261
261
  "flexShrink": 0,
@@ -285,7 +285,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
285
285
  className=""
286
286
  height={16}
287
287
  style={
288
- Object {
288
+ {
289
289
  "display": "inline-block",
290
290
  "flexGrow": 0,
291
291
  "flexShrink": 0,
@@ -318,7 +318,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
318
318
  className=""
319
319
  height={16}
320
320
  style={
321
- Object {
321
+ {
322
322
  "display": "inline-block",
323
323
  "flexGrow": 0,
324
324
  "flexShrink": 0,
@@ -341,7 +341,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
341
341
  className=""
342
342
  height={24}
343
343
  style={
344
- Object {
344
+ {
345
345
  "display": "inline-block",
346
346
  "flexGrow": 0,
347
347
  "flexShrink": 0,
@@ -371,7 +371,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
371
371
  className=""
372
372
  height={16}
373
373
  style={
374
- Object {
374
+ {
375
375
  "display": "inline-block",
376
376
  "flexGrow": 0,
377
377
  "flexShrink": 0,
@@ -394,7 +394,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
394
394
  className=""
395
395
  height={24}
396
396
  style={
397
- Object {
397
+ {
398
398
  "display": "inline-block",
399
399
  "flexGrow": 0,
400
400
  "flexShrink": 0,
@@ -424,7 +424,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
424
424
  className=""
425
425
  height={16}
426
426
  style={
427
- Object {
427
+ {
428
428
  "display": "inline-block",
429
429
  "flexGrow": 0,
430
430
  "flexShrink": 0,
@@ -447,7 +447,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
447
447
  className=""
448
448
  height={24}
449
449
  style={
450
- Object {
450
+ {
451
451
  "display": "inline-block",
452
452
  "flexGrow": 0,
453
453
  "flexShrink": 0,
@@ -480,7 +480,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
480
480
  className=""
481
481
  height={24}
482
482
  style={
483
- Object {
483
+ {
484
484
  "display": "inline-block",
485
485
  "flexGrow": 0,
486
486
  "flexShrink": 0,
@@ -513,7 +513,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
513
513
  className=""
514
514
  height={24}
515
515
  style={
516
- Object {
516
+ {
517
517
  "display": "inline-block",
518
518
  "flexGrow": 0,
519
519
  "flexShrink": 0,
@@ -543,7 +543,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
543
543
  className=""
544
544
  height={16}
545
545
  style={
546
- Object {
546
+ {
547
547
  "display": "inline-block",
548
548
  "flexGrow": 0,
549
549
  "flexShrink": 0,
@@ -566,7 +566,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
566
566
  className=""
567
567
  height={24}
568
568
  style={
569
- Object {
569
+ {
570
570
  "display": "inline-block",
571
571
  "flexGrow": 0,
572
572
  "flexShrink": 0,
@@ -599,7 +599,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
599
599
  className=""
600
600
  height={24}
601
601
  style={
602
- Object {
602
+ {
603
603
  "display": "inline-block",
604
604
  "flexGrow": 0,
605
605
  "flexShrink": 0,
@@ -632,7 +632,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
632
632
  className=""
633
633
  height={24}
634
634
  style={
635
- Object {
635
+ {
636
636
  "display": "inline-block",
637
637
  "flexGrow": 0,
638
638
  "flexShrink": 0,
@@ -662,7 +662,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
662
662
  className=""
663
663
  height={16}
664
664
  style={
665
- Object {
665
+ {
666
666
  "display": "inline-block",
667
667
  "flexGrow": 0,
668
668
  "flexShrink": 0,
@@ -695,7 +695,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
695
695
  className=""
696
696
  height={16}
697
697
  style={
698
- Object {
698
+ {
699
699
  "display": "inline-block",
700
700
  "flexGrow": 0,
701
701
  "flexShrink": 0,
@@ -718,7 +718,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
718
718
  className=""
719
719
  height={24}
720
720
  style={
721
- Object {
721
+ {
722
722
  "display": "inline-block",
723
723
  "flexGrow": 0,
724
724
  "flexShrink": 0,
@@ -748,7 +748,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
748
748
  className=""
749
749
  height={16}
750
750
  style={
751
- Object {
751
+ {
752
752
  "display": "inline-block",
753
753
  "flexGrow": 0,
754
754
  "flexShrink": 0,
@@ -781,7 +781,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
781
781
  className=""
782
782
  height={16}
783
783
  style={
784
- Object {
784
+ {
785
785
  "display": "inline-block",
786
786
  "flexGrow": 0,
787
787
  "flexShrink": 0,
@@ -817,7 +817,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
817
817
  className=""
818
818
  height={24}
819
819
  style={
820
- Object {
820
+ {
821
821
  "display": "inline-block",
822
822
  "flexGrow": 0,
823
823
  "flexShrink": 0,
@@ -850,7 +850,7 @@ exports[`wonder-blocks-icon example 1 1`] = `
850
850
  className=""
851
851
  height={24}
852
852
  style={
853
- Object {
853
+ {
854
854
  "display": "inline-block",
855
855
  "flexGrow": 0,
856
856
  "flexShrink": 0,
@@ -876,7 +876,7 @@ exports[`wonder-blocks-icon example 2 1`] = `
876
876
  className=""
877
877
  height={16}
878
878
  style={
879
- Object {
879
+ {
880
880
  "display": "inline-block",
881
881
  "flexGrow": 0,
882
882
  "flexShrink": 0,
@@ -897,7 +897,7 @@ exports[`wonder-blocks-icon example 3 1`] = `
897
897
  <div
898
898
  className=""
899
899
  style={
900
- Object {
900
+ {
901
901
  "alignItems": "stretch",
902
902
  "borderStyle": "solid",
903
903
  "borderWidth": 0,
@@ -917,7 +917,7 @@ exports[`wonder-blocks-icon example 3 1`] = `
917
917
  className=""
918
918
  height={16}
919
919
  style={
920
- Object {
920
+ {
921
921
  "display": "inline-block",
922
922
  "flexGrow": 0,
923
923
  "flexShrink": 0,
@@ -936,7 +936,7 @@ exports[`wonder-blocks-icon example 3 1`] = `
936
936
  className=""
937
937
  height={24}
938
938
  style={
939
- Object {
939
+ {
940
940
  "display": "inline-block",
941
941
  "flexGrow": 0,
942
942
  "flexShrink": 0,
@@ -955,7 +955,7 @@ exports[`wonder-blocks-icon example 3 1`] = `
955
955
  className=""
956
956
  height={48}
957
957
  style={
958
- Object {
958
+ {
959
959
  "display": "inline-block",
960
960
  "flexGrow": 0,
961
961
  "flexShrink": 0,
@@ -974,7 +974,7 @@ exports[`wonder-blocks-icon example 3 1`] = `
974
974
  className=""
975
975
  height={96}
976
976
  style={
977
- Object {
977
+ {
978
978
  "display": "inline-block",
979
979
  "flexGrow": 0,
980
980
  "flexShrink": 0,
@@ -996,7 +996,7 @@ exports[`wonder-blocks-icon example 4 1`] = `
996
996
  <div
997
997
  className=""
998
998
  style={
999
- Object {
999
+ {
1000
1000
  "alignItems": "stretch",
1001
1001
  "borderStyle": "solid",
1002
1002
  "borderWidth": 0,
@@ -1017,7 +1017,7 @@ exports[`wonder-blocks-icon example 4 1`] = `
1017
1017
  className=""
1018
1018
  height={16}
1019
1019
  style={
1020
- Object {
1020
+ {
1021
1021
  "display": "inline-block",
1022
1022
  "flexGrow": 0,
1023
1023
  "flexShrink": 0,
@@ -0,0 +1,148 @@
1
+ // @flow
2
+ import * as React from "react";
3
+ import type {StoryComponentType} from "@storybook/react";
4
+
5
+ import Color from "@khanacademy/wonder-blocks-color";
6
+ import {View} from "@khanacademy/wonder-blocks-core";
7
+ import Icon, {icons} from "@khanacademy/wonder-blocks-icon";
8
+ import {LabelMedium} from "@khanacademy/wonder-blocks-typography";
9
+
10
+ import ComponentInfo from "../../../../../.storybook/components/component-info.js";
11
+ import {name, version} from "../../../package.json";
12
+
13
+ export default {
14
+ title: "Icon / Icon",
15
+ component: Icon,
16
+ parameters: {
17
+ componentSubtitle: ((
18
+ <ComponentInfo name={name} version={version} />
19
+ ): any),
20
+ },
21
+ argTypes: {
22
+ icon: {
23
+ options: icons,
24
+ },
25
+ size: {
26
+ options: ["small", "medium", "large", "xlarge"],
27
+ },
28
+ },
29
+ };
30
+
31
+ export const Default: StoryComponentType = (args) => {
32
+ return <Icon {...args} />;
33
+ };
34
+
35
+ Default.args = {icon: icons.search, size: "small"};
36
+
37
+ export const Basic: StoryComponentType = () => {
38
+ return <Icon icon={icons.search} />;
39
+ };
40
+
41
+ Basic.parameters = {
42
+ docs: {
43
+ storyDescription: `Minimal icon usage. This is a search icon.
44
+ Icons are size \`"small"\` by default.`,
45
+ },
46
+ };
47
+
48
+ export const Sizes: StoryComponentType = () => {
49
+ return (
50
+ <table>
51
+ <tr>
52
+ <td>
53
+ <LabelMedium>{"small"}</LabelMedium>
54
+ </td>
55
+ <td>
56
+ <Icon icon={icons.search} size="small" />
57
+ </td>
58
+ </tr>
59
+ <tr>
60
+ <td>
61
+ <LabelMedium>{"medium"}</LabelMedium>
62
+ </td>
63
+ <td>
64
+ <Icon icon={icons.search} size="medium" />
65
+ </td>
66
+ </tr>
67
+ <tr>
68
+ <td>
69
+ <LabelMedium>{"large"}</LabelMedium>
70
+ </td>
71
+ <td>
72
+ <Icon icon={icons.search} size="large" />
73
+ </td>
74
+ </tr>
75
+ <tr>
76
+ <td>
77
+ <LabelMedium>{"xlarge"}</LabelMedium>
78
+ </td>
79
+ <td>
80
+ <Icon icon={icons.search} size="xlarge" />
81
+ </td>
82
+ </tr>
83
+ </table>
84
+ );
85
+ };
86
+
87
+ Sizes.parameters = {
88
+ docs: {
89
+ storyDescription: `The size of an icon is determined by the \`Icon\`'s
90
+ \`size\` prop. While we don't currently have assets for sizes
91
+ larger than medium, we can still render any icon at any size
92
+ in a pinch. The available sizes are \`"small"\`, \`"medium"\`,
93
+ \`"large"\`, and \`"xlarge"\`. `,
94
+ },
95
+ };
96
+
97
+ export const Variants: StoryComponentType = () => {
98
+ const iconsWithLabels = Object.entries(icons).map(([iconName, _]) => {
99
+ return (
100
+ <tr>
101
+ <td>
102
+ <Icon icon={icons[iconName]} />
103
+ </td>
104
+ <td>
105
+ <LabelMedium>{iconName}</LabelMedium>
106
+ </td>
107
+ </tr>
108
+ );
109
+ });
110
+
111
+ return <table>{iconsWithLabels}</table>;
112
+ };
113
+
114
+ Variants.parameters = {
115
+ docs: {
116
+ storyDescription: `The actual icon is determined by the \`Icon\`'s
117
+ \`icon\` prop. Here are the icons that are already defined in
118
+ Wonder Blocks and ready to use. Just import \`{icons}\` from
119
+ \`"@khanacademy/wonder-blocks-icon"\`.`,
120
+ },
121
+ };
122
+
123
+ export const WithColor: StoryComponentType = () => {
124
+ return <Icon size="small" icon={icons.info} color={Color.red} />;
125
+ };
126
+
127
+ WithColor.parameters = {
128
+ docs: {
129
+ storyDescription:
130
+ "The color of an icon can be specified through its `color` prop.",
131
+ },
132
+ };
133
+
134
+ export const Inline: StoryComponentType = () => {
135
+ return (
136
+ <View>
137
+ Here is an icon
138
+ <Icon size="small" icon={icons.info} style={{margin: 2}} />
139
+ when it is inline.
140
+ </View>
141
+ );
142
+ };
143
+
144
+ Inline.parameters = {
145
+ docs: {
146
+ storyDescription: "Icons have `display: inline-block` by default.",
147
+ },
148
+ };