1
0
mirror of https://github.com/flarum/core.git synced 2025-08-18 14:22:02 +02:00

Use a positive setting name to avoid double negatives

This commit is contained in:
Franz Liedke
2019-07-01 21:15:00 +02:00
parent e48b392122
commit cca3486a68
3 changed files with 4 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
export default function tagIcon(tag, attrs = {}, settings = {}) { export default function tagIcon(tag, attrs = {}, settings = {}) {
const hasIcon = tag && tag.icon(); const hasIcon = tag && tag.icon();
const useColor = settings.useColor || true;
attrs.className = hasIcon ? 'icon ' + tag.icon() + ' ' + (attrs.className || '') : 'icon TagIcon ' + (attrs.className || ''); attrs.className = hasIcon ? 'icon ' + tag.icon() + ' ' + (attrs.className || '') : 'icon TagIcon ' + (attrs.className || '');
@@ -7,7 +8,7 @@ export default function tagIcon(tag, attrs = {}, settings = {}) {
attrs.style = attrs.style || {}; attrs.style = attrs.style || {};
if (hasIcon) { if (hasIcon) {
attrs.style.color = settings.disableColors ? '' : tag.color(); attrs.style.color = useColor ? tag.color() : '';
} else { } else {
attrs.style.backgroundColor = tag.color(); attrs.style.backgroundColor = tag.color();
} }

View File

@@ -26,7 +26,7 @@ export default function tagLabel(tag, attrs = {}) {
return ( return (
m((link ? 'a' : 'span'), attrs, m((link ? 'a' : 'span'), attrs,
<span className="TagLabel-text"> <span className="TagLabel-text">
{tag.icon() && tagIcon(tag, {}, {disableColors: true})} {tagText} {tag.icon() && tagIcon(tag, {}, {useColor: false})} {tagText}
</span> </span>
) )
); );

View File

@@ -11,7 +11,7 @@ export default class TagHero extends Component {
style={color ? {color: '#fff', backgroundColor: color} : ''}> style={color ? {color: '#fff', backgroundColor: color} : ''}>
<div className="container"> <div className="container">
<div className="containerNarrow"> <div className="containerNarrow">
<h2 className="Hero-title">{tag.icon() && tagIcon(tag, {}, { disableColors: true })} {tag.name()}</h2> <h2 className="Hero-title">{tag.icon() && tagIcon(tag, {}, { useColor: false })} {tag.name()}</h2>
<div className="Hero-subtitle">{tag.description()}</div> <div className="Hero-subtitle">{tag.description()}</div>
</div> </div>
</div> </div>