Skip to content

Commit

Permalink
feat(font awesome icons): add all free available FA icons (patternfly…
Browse files Browse the repository at this point in the history
…#484)

affects: @patternfly/react-icons
  • Loading branch information
karelhala authored and dmiller9911 committed Aug 10, 2018
1 parent 3958558 commit 4a7fea9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 78 deletions.
12 changes: 6 additions & 6 deletions packages/react-icons/build/generateIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ const nodePlop = require('node-plop');

const plop = nodePlop(path.resolve(__dirname, './generatorConfig.js'));
const pascalCase = plop.getHelper('pascalCase');
const camelCase = plop.getHelper('camelCase');
const kebabCase = plop.getHelper('kebabCase');

const allIcons = icons.fontAwesome.map(getFontAwesomeIcon);
const allIcons = icons.fontAwesome.solid.map(getFontAwesomeIcon);

plop
.getGenerator('icons')
.runActions({ icons: allIcons })
.catch(console.log); // eslint-disable-line

function getFontAwesomeIcon(name) {
const faIconName = camelCase(`fa-${name}`);
const faIconDef = require(`@fortawesome/free-solid-svg-icons/${faIconName}`); // eslint-disable-line
const faIconDef = require(`@fortawesome/free-solid-svg-icons/${name}`); // eslint-disable-line
const iconName = kebabCase(name.substr(2)); // remove fa and make name kebab cased

return {
id: `${name}-icon`,
name: pascalCase(`${name}-icon`),
id: `${iconName}-icon`,
name: pascalCase(`${iconName}-icon`),
width: faIconDef.width,
height: faIconDef.height,
svgPath: faIconDef.svgPathData
Expand Down
77 changes: 5 additions & 72 deletions packages/react-icons/build/icons.js
Original file line number Diff line number Diff line change
@@ -1,74 +1,7 @@
const { fas } = require('@fortawesome/free-solid-svg-icons');

module.exports = {
fontAwesome: [
'angle-double-left',
'angle-double-right',
'angle-down',
'angle-left',
'angle-right',
'angle-up',
'arrow-circle-down',
'arrow-circle-up',
'balance-scale',
'ban',
'bell',
'bug',
'caret-down',
'caret-left',
'caret-right',
'caret-up',
'check-circle',
'check',
'clipboard-check',
'clock',
'columns',
'cube',
'cubes',
'ellipsis-v',
'exclamation-circle',
'exclamation-triangle',
'external-link-alt',
'external-link-square-alt',
'filter',
'flag',
'folder-open',
'folder',
'hdd',
'history',
'info-circle',
'key',
'list',
'lock-open',
'lock',
'map-marker',
'memory',
'minus',
'pause-circle',
'pencil-alt',
'plus-circle',
'plus-square',
'plus',
'print',
'question-circle',
'redo',
'search',
'sliders-h',
'sort-alpha-down',
'sort-alpha-up',
'sort-numeric-down',
'sort-numeric-up',
'sort',
'sync-alt',
'table',
'tachometer-alt',
'th-large',
'th',
'thumbtack',
'times-circle',
'times',
'trash',
'user-friends',
'user',
'window-restore',
'wrench'
]
fontAwesome: {
solid: Object.keys(fas)
}
};

0 comments on commit 4a7fea9

Please sign in to comment.