From f8c03db5cb0aaf6f788c204a37f4134afe3b4dc9 Mon Sep 17 00:00:00 2001 From: Manuel Puyol Date: Fri, 16 Dec 2022 20:47:01 +0000 Subject: [PATCH 1/5] Use parameter defaults instead of defaultProps --- lib/octicons_react/src/createIconComponent.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/octicons_react/src/createIconComponent.js b/lib/octicons_react/src/createIconComponent.js index 75849f0c3..0ce3c2ef0 100644 --- a/lib/octicons_react/src/createIconComponent.js +++ b/lib/octicons_react/src/createIconComponent.js @@ -10,7 +10,7 @@ export function createIconComponent(name, defaultClassName, getSVGData) { const svgDataByHeight = getSVGData() const heights = Object.keys(svgDataByHeight) - function Icon({'aria-label': ariaLabel, tabIndex, className, fill = 'currentColor', size, verticalAlign}) { + function Icon({'aria-label': ariaLabel, tabIndex, className = defaultClassName, fill = 'currentColor', size = 16, verticalAlign = 'text-bottom'}) { const height = sizeMap[size] || size const naturalHeight = closestNaturalHeight(heights, height) const naturalWidth = svgDataByHeight[naturalHeight].width @@ -42,11 +42,6 @@ export function createIconComponent(name, defaultClassName, getSVGData) { } Icon.displayName = name - Icon.defaultProps = { - className: defaultClassName, - size: 16, - verticalAlign: 'text-bottom' - } return Icon } From 868603751325c7e09e10b47d0ca113811d376e5e Mon Sep 17 00:00:00 2001 From: Manuel Puyol Date: Fri, 16 Dec 2022 20:49:21 +0000 Subject: [PATCH 2/5] changeset --- .changeset/lazy-guests-call.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/lazy-guests-call.md diff --git a/.changeset/lazy-guests-call.md b/.changeset/lazy-guests-call.md new file mode 100644 index 000000000..d72388903 --- /dev/null +++ b/.changeset/lazy-guests-call.md @@ -0,0 +1,5 @@ +--- +'@primer/octicons': patch +--- + +Use parameter defaults instead of defaultProps From d83444353b09bc3546fbe8b4717ae42cd1552940 Mon Sep 17 00:00:00 2001 From: Manuel Puyol Date: Fri, 16 Dec 2022 20:54:08 +0000 Subject: [PATCH 3/5] lint --- lib/octicons_react/src/createIconComponent.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/octicons_react/src/createIconComponent.js b/lib/octicons_react/src/createIconComponent.js index 0ce3c2ef0..38b13da70 100644 --- a/lib/octicons_react/src/createIconComponent.js +++ b/lib/octicons_react/src/createIconComponent.js @@ -10,7 +10,14 @@ export function createIconComponent(name, defaultClassName, getSVGData) { const svgDataByHeight = getSVGData() const heights = Object.keys(svgDataByHeight) - function Icon({'aria-label': ariaLabel, tabIndex, className = defaultClassName, fill = 'currentColor', size = 16, verticalAlign = 'text-bottom'}) { + function Icon({ + 'aria-label': ariaLabel, + tabIndex, + className = defaultClassName, + fill = 'currentColor', + size = 16, + verticalAlign = 'text-bottom' + }) { const height = sizeMap[size] || size const naturalHeight = closestNaturalHeight(heights, height) const naturalWidth = svgDataByHeight[naturalHeight].width From 9916842487ca3983cbf579207a974e08c3c88895 Mon Sep 17 00:00:00 2001 From: Manuel Puyol Date: Fri, 16 Dec 2022 21:39:53 +0000 Subject: [PATCH 4/5] update bundle size in test --- lib/octicons_react/__tests__/tree-shaking.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/octicons_react/__tests__/tree-shaking.test.js b/lib/octicons_react/__tests__/tree-shaking.test.js index b4c2bdec3..9a86d9f40 100644 --- a/lib/octicons_react/__tests__/tree-shaking.test.js +++ b/lib/octicons_react/__tests__/tree-shaking.test.js @@ -50,5 +50,5 @@ test('tree shaking single export', async () => { }) const bundleSize = Buffer.byteLength(output[0].code.trim()) / 1000 - expect(`${bundleSize}kB`).toMatchInlineSnapshot(`"2.595kB"`) + expect(`${bundleSize}kB`).toMatchInlineSnapshot(`"2.73kB"`) }) From 9ebb8763482f8f7ff8ed45cd145d667d716d8c70 Mon Sep 17 00:00:00 2001 From: Manuel Puyol Date: Wed, 21 Dec 2022 19:19:24 +0000 Subject: [PATCH 5/5] update bundle size in test --- lib/octicons_react/__tests__/tree-shaking.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/octicons_react/__tests__/tree-shaking.test.js b/lib/octicons_react/__tests__/tree-shaking.test.js index 9a86d9f40..6d0950bbe 100644 --- a/lib/octicons_react/__tests__/tree-shaking.test.js +++ b/lib/octicons_react/__tests__/tree-shaking.test.js @@ -50,5 +50,5 @@ test('tree shaking single export', async () => { }) const bundleSize = Buffer.byteLength(output[0].code.trim()) / 1000 - expect(`${bundleSize}kB`).toMatchInlineSnapshot(`"2.73kB"`) + expect(`${bundleSize}kB`).toMatchInlineSnapshot(`"2.826kB"`) })