Skip to content

Commit 97ff0b4

Browse files
author
Cathy Siller
committed
chore(pr-review): changes per pr review
1 parent a5a92bb commit 97ff0b4

File tree

4 files changed

+10
-16
lines changed

4 files changed

+10
-16
lines changed

docs/components/pills/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ <h2 id="basic-pill">Basic Pill</h2>
3636
<hx-pill
3737
:persist="isPersistent"
3838
v-text="content"
39-
@dismiss="onEvent">
40-
</hx-pill>
39+
@dismiss="onEvent"
40+
></hx-pill>
4141
</div>
4242

4343
<footer>

docs/elements/hx-pill/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@ <h2 id="methods">Methods</h2>
5151

5252
{% block attributes %}
5353
<dl>
54-
<dt>dismissable {Boolean [false]} <i>(optional)</i></dt>
54+
<dt>persist {Boolean}</dt>
5555
<dd>
56-
When present, pill will be dismissable.
56+
When present, pill will not be dismissable.
5757
</dd>
5858
</dl>
5959
{% endblock %}
6060

6161
{% block properties %}
6262
<dl>
63-
<dt>dismissable {Boolean [false]}</dt>
63+
<dt>persist {Boolean [false]}</dt>
6464
<dd>
65-
When <code>true</code>, pill will be dismissable.
65+
When <code>true</code>, pill will not be dismissable.
6666
</dd>
6767
</dl>
6868
{% endblock %}

src/helix-ui/elements/HXPillElement.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ export class HXPillElement extends HXElement {
3939
this._btnDismiss.removeEventListener('click', this._onDismiss);
4040
}
4141

42-
static get $observedAttributes () {
43-
return [ 'persist' ];
44-
}
45-
4642
/**
4743
* Property reflecting the `persist` HTML attribute, indicating whether the
4844
* pill may be dismissed. If true, the dismiss button will not be shown.
@@ -55,7 +51,7 @@ export class HXPillElement extends HXElement {
5551
}
5652
set persist (value) {
5753
if (value) {
58-
this.setAttribute('persist', ''); // boolean
54+
this.setAttribute('persist', '');
5955
} else {
6056
this.removeAttribute('persist');
6157
}
@@ -65,7 +61,7 @@ export class HXPillElement extends HXElement {
6561
* Dismiss the pill (removes element from the DOM)
6662
*/
6763
dismiss () {
68-
if (this.$emit('dismiss')) {
64+
if (!this.persist && this.$emit('dismiss')) {
6965
// only if event was not canceled by consumer
7066
this.remove();
7167
}

src/helix-ui/elements/HXPillElement.less

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434
}
3535

3636
:host([persist]) {
37-
#hxPill {
38-
#hxDismiss {
39-
display: none;
40-
}
37+
#hxDismiss {
38+
display: none;
4139
}
4240
}

0 commit comments

Comments
 (0)