From 7f73df5731b49f482ce7dd348971d26c876f6697 Mon Sep 17 00:00:00 2001 From: Joel Arvidsson Date: Mon, 29 May 2017 21:14:20 +0200 Subject: [PATCH] Make `name` prop optional. Closes #406 --- lib/create-icon-set.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/create-icon-set.js b/lib/create-icon-set.js index 3dc7969..818307c 100644 --- a/lib/create-icon-set.js +++ b/lib/create-icon-set.js @@ -33,7 +33,7 @@ export default function createIconSet(glyphMap, fontFamily, fontFile) { class Icon extends Component { static propTypes = { - name: IconNamePropType.isRequired, + name: IconNamePropType, size: PropTypes.number, color: PropTypes.string, children: PropTypes.node, @@ -59,7 +59,7 @@ export default function createIconSet(glyphMap, fontFamily, fontFile) { render() { const { name, size, color, style, ...props } = this.props; - let glyph = glyphMap[name] || '?'; + let glyph = name ? glyphMap[name] || '?' : ''; if (typeof glyph === 'number') { glyph = String.fromCharCode(glyph); }