Skip to content

Commit

Permalink
dataUrl helper function implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
nklhtv committed Jun 26, 2018
1 parent e9855dd commit 7919123
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dom/dataUrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import icons from './icons';

const dataUrl = ({ icon, width, height, fill = 'white' } = {}) => `data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="${icons[icon].viewBox}" width="${width}" height="${height}" fill="${fill}">${icons[icon].paths.map(path => `<path d="${path}" />`).join('')}</svg>`;

export default dataUrl;
2 changes: 2 additions & 0 deletions dom/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Icon from './icon';
import dataUrl from './dataUrl';
import icons from './icons';

export default Icon;
export {
dataUrl,
icons
};

0 comments on commit 7919123

Please sign in to comment.