From 0fe635d32ca10fde2933252a78eb68cd065abfec Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Sat, 8 Aug 2020 13:41:50 -0400 Subject: [PATCH] update: common/components/Badge --- js/src/common/components/Badge.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/src/common/components/Badge.js b/js/src/common/components/Badge.js index 58c5e9697..d9267fdf3 100644 --- a/js/src/common/components/Badge.js +++ b/js/src/common/components/Badge.js @@ -6,18 +6,18 @@ import extract from '../utils/extract'; * The `Badge` component represents a user/discussion badge, indicating some * status (e.g. a discussion is stickied, a user is an admin). * - * A badge may have the following special props: + * A badge may have the following special attrs: * * - `type` The type of badge this is. This will be used to give the badge a * class name of `Badge--{type}`. * - `icon` The name of an icon to show inside the badge. * - `label` * - * All other props will be assigned as attributes on the badge element. + * All other attrs will be assigned as attributes on the badge element. */ export default class Badge extends Component { view() { - const attrs = Object.assign({}, this.props); + const attrs = Object.assign({}, this.attrs); const type = extract(attrs, 'type'); const iconName = extract(attrs, 'icon'); @@ -27,9 +27,9 @@ export default class Badge extends Component { return {iconName ? icon(iconName, { className: 'Badge-icon' }) : m.trust(' ')}; } - config(isInitialized) { - if (isInitialized) return; + oncreate(vnode) { + super.oncreate(vnode); - if (this.props.label) this.$().tooltip(); + if (this.attrs.label) this.$().tooltip(); } }