Skip to content

Commit

Permalink
Add new icons.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-paterson committed Sep 13, 2021
1 parent 382844b commit 2bb04da
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 2 deletions.
6 changes: 6 additions & 0 deletions addon/components/svg-repo/icons/icon-cookie-bite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import SvgBase from 'svg-repo/components/svg-base';
import layout from '../../../templates/components/svg-repo/icons/icon-cookie-bite';

export default SvgBase.extend({
layout,
});
6 changes: 6 additions & 0 deletions addon/components/svg-repo/icons/icon-cookie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import SvgBase from 'svg-repo/components/svg-base';
import layout from '../../../templates/components/svg-repo/icons/icon-cookie';

export default SvgBase.extend({
layout,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style={{style}} class="{{class}} single-colour icon-cookie-bite" data-test-icon="icon-cookie-bite"><!-- Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M510.52 255.82c-69.97-.85-126.47-57.69-126.47-127.86-70.17 0-127-56.49-127.86-126.45-27.26-4.14-55.13.3-79.72 12.82l-69.13 35.22a132.221 132.221 0 0 0-57.79 57.81l-35.1 68.88a132.645 132.645 0 0 0-12.82 80.95l12.08 76.27a132.521 132.521 0 0 0 37.16 72.96l54.77 54.76a132.036 132.036 0 0 0 72.71 37.06l76.71 12.15c27.51 4.36 55.7-.11 80.53-12.76l69.13-35.21a132.273 132.273 0 0 0 57.79-57.81l35.1-68.88c12.56-24.64 17.01-52.58 12.91-79.91zM176 368c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32zm32-160c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32zm160 128c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32z"/></svg>
1 change: 1 addition & 0 deletions addon/templates/components/svg-repo/icons/icon-cookie.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style={{style}} class="{{class}} single-colour icon-cookie" data-test-icon="icon-cookie"><!-- Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M510.37 254.79l-12.08-76.26a132.493 132.493 0 0 0-37.16-72.95l-54.76-54.75c-19.73-19.72-45.18-32.7-72.71-37.05l-76.7-12.15c-27.51-4.36-55.69.11-80.52 12.76L107.32 49.6a132.25 132.25 0 0 0-57.79 57.8l-35.1 68.88a132.602 132.602 0 0 0-12.82 80.94l12.08 76.27a132.493 132.493 0 0 0 37.16 72.95l54.76 54.75a132.087 132.087 0 0 0 72.71 37.05l76.7 12.14c27.51 4.36 55.69-.11 80.52-12.75l69.12-35.21a132.302 132.302 0 0 0 57.79-57.8l35.1-68.87c12.71-24.96 17.2-53.3 12.82-80.96zM176 368c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32zm32-160c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32zm160 128c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32z"/></svg>
1 change: 1 addition & 0 deletions app/components/svg-repo/icons/icon-cookie-bite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'svg-repo/components/svg-repo/icons/icon-cookie-bite';
1 change: 1 addition & 0 deletions app/components/svg-repo/icons/icon-cookie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'svg-repo/components/svg-repo/icons/icon-cookie';
37 changes: 37 additions & 0 deletions make-from-svg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const path = require('path');
const fs = require('fs');
const sourcePath = process.argv[2];
const subDir = process.argv[3] || 'icons'
const subDirSingular = subDir.slice(0, -1);
const chalk = require('chalk');

if (!fs.existsSync(sourcePath)) {
console.log(chalk.red(`${sourcePath} does not exist.`))
}
const componentName = `${subDirSingular}-${path.parse(sourcePath).name}`;
const templateFileAdditions = ` style={{style}} class="{{class}} single-colour ${componentName}" data-test-icon="${componentName}"`;
const sourceFileContents = fs.readFileSync(sourcePath, 'utf8');
const sourceAttrs = sourceFileContents.match(/<svg(.*?)>(.*)/);
const templateFileContents = `<svg ${sourceAttrs[1]} ${templateFileAdditions}>${sourceAttrs[2]}`.replace(/\s+/g, ' ');
const files = [{
outPath: `./app/components/svg-repo/${subDir}/${componentName}.js`,
contents: `export { default } from 'svg-repo/components/svg-repo/${subDir}/${componentName}';`
}, {
outPath: `./addon/components/svg-repo/${subDir}/${componentName}.js`,
contents:
`import SvgBase from 'svg-repo/components/svg-base';
import layout from '../../../templates/components/svg-repo/${subDir}/${componentName}';
export default SvgBase.extend({
layout,
});`
}, {
outPath: `./addon/templates/components/svg-repo/${subDir}/${componentName}.hbs`,
contents: templateFileContents
}];

files.forEach(file => {
fs.writeFileSync(file.outPath, file.contents);
console.log(chalk.green(`${file.outPath} was created.`))
});

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svg-repo",
"version": "1.0.10",
"version": "1.0.11",
"description": "The default blueprint for ember-cli addons.",
"keywords": [
"ember-addon"
Expand Down

0 comments on commit 2bb04da

Please sign in to comment.