Skip to content

Commit

Permalink
Use categories id in SVGs
Browse files Browse the repository at this point in the history
  • Loading branch information
EtienneLem committed Dec 15, 2017
1 parent 8f63c38 commit 1119d60
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
18 changes: 9 additions & 9 deletions src/components/anchors.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ export default class Anchors extends React.PureComponent {
this.handleClick = this.handleClick.bind(this)
}

getSVG(name) {
getSVG(id) {
this.SVGs || (this.SVGs = {})

if (this.SVGs[name]) {
return this.SVGs[name]
if (this.SVGs[id]) {
return this.SVGs[id]
} else {
let svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
${SVGs[name]}
${SVGs[id]}
</svg>`

this.SVGs[name] = svg
this.SVGs[id] = svg
return svg
}
}
Expand All @@ -45,7 +45,7 @@ export default class Anchors extends React.PureComponent {
return (
<div className="emoji-mart-anchors">
{categories.map((category, i) => {
var { name, anchor } = category,
var { id, name, anchor } = category,
isSelected = name == selected

if (anchor === false) {
Expand All @@ -54,16 +54,16 @@ export default class Anchors extends React.PureComponent {

return (
<span
key={name}
title={i18n.categories[name.toLowerCase()]}
key={id}
title={i18n.categories[id]}
data-index={i}
onClick={this.handleClick}
className={`emoji-mart-anchor ${isSelected
? 'emoji-mart-anchor-selected'
: ''}`}
style={{ color: isSelected ? color : null }}
>
<div dangerouslySetInnerHTML={{ __html: this.getSVG(name) }} />
<div dangerouslySetInnerHTML={{ __html: this.getSVG(id) }} />
<span
className="emoji-mart-anchor-bar"
style={{ backgroundColor: color }}
Expand Down
20 changes: 10 additions & 10 deletions src/svgs/index.js

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

0 comments on commit 1119d60

Please sign in to comment.