Skip to content

Commit 464800c

Browse files
authored
Merge pull request #48 from isBatak/fix/add-viewbox-to-svg
fix: fix storybook issue
2 parents 1b08b03 + e2caee1 commit 464800c

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

.changeset/ninety-ads-try.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ikona/cli": patch
3+
---
4+
5+
fix storybook issue with `image-size` lib

packages/cli/__tests__/icons/generate-icon-file.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe("generateIconFiles", () => {
4040
const spriteContent = fs.readFileSync(spritePath, "utf-8");
4141
expect(spriteContent).toMatchInlineSnapshot(`
4242
"<?xml version="1.0" encoding="UTF-8"?>
43-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0" height="0">
43+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 0 0" width="0" height="0">
4444
<defs>
4545
<symbol viewBox="0 0 24 24" id="icon1"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"></path></symbol>
4646
<symbol viewBox="0 0 24 24" id="icon2"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"></path></symbol>

packages/cli/__tests__/icons/templates/svg-sprite.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe("svgSpriteTemplate", () => {
1212

1313
expect(result).toMatchInlineSnapshot(`
1414
"<?xml version="1.0" encoding="UTF-8"?>
15-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0" height="0">
15+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 0 0" width="0" height="0">
1616
<defs>
1717
<symbol viewBox="0 0 24 24" id="heart"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"></path></symbol>
1818
</defs>

packages/cli/src/icons/templates/svg-sprite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function svgSpriteTemplate(iconsData: Array<IconData>) {
2727

2828
return [
2929
`<?xml version="1.0" encoding="UTF-8"?>`,
30-
`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0" height="0">`,
30+
`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 0 0" width="0" height="0">`,
3131
`<defs>`, // for semantics: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs
3232
...symbols,
3333
`</defs>`,

0 commit comments

Comments
 (0)