Skip to content

Commit ff7133a

Browse files
committed
fixes
1 parent 686b377 commit ff7133a

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/pg/menuItemIcon/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ The `PgMenuItemIcon` is the `PgMenuItem` with icon support. The `pg-menu` can us
88
import '@pictogrammers/components/pgMenuItemIcon.js';
99
```
1010

11-
```html
12-
<pg-menu-item></pg-menu-item>
11+
```typescript
12+
this.$items = [{
13+
type: PgMenuItemIcon,
14+
icon: '',
15+
label: 'Item 1'
16+
}];
1317
```
1418

1519
| Attributes | Tested | Description |

src/pg/menuItemIcon/menuItemIcon.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
[part=button]:not(:disabled):hover {
2525
background: var(--pg-menu-item-selected-background, #453C4F);
2626
color: #FFFFFF;
27+
--pg-icon-color: #FFFFFF;
2728
}
2829

2930
[part=button]:not(:disabled):active {
@@ -32,6 +33,7 @@
3233

3334
[part=button]:disabled {
3435
color: var(--pg-menu-item-disabled-color, rgb(69, 60, 79, 0.75));
36+
--pg-icon-color: var(--pg-menu-item-disabled-color, rgb(69, 60, 79, 0.75));
3537
}
3638

3739
[part=button].checked::before {

src/pg/menuItemIcon/menuItemIcon.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ export default class PgMenuItemIcon extends HTMLElement {
1616
static delegatesFocus = true;
1717

1818
@Prop() index: number;
19-
@Prop() icon: string = '';
19+
@Prop() icon: string = 'M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z';
2020
@Prop() label: string = '';
2121
@Prop() checked: boolean = false;
2222
@Prop() disabled: boolean = false;
2323

2424
@Part() $icon: PgIcon;
25-
@Part() $label: HTMLButtonElement;
25+
@Part() $button: HTMLButtonElement;
26+
@Part() $label: HTMLSpanElement;
2627

2728
render(changes) {
2829
if (changes.icon) {
@@ -32,10 +33,10 @@ export default class PgMenuItemIcon extends HTMLElement {
3233
this.$label.textContent = this.label;
3334
}
3435
if (changes.disabled) {
35-
this.$label.disabled = this.disabled;
36+
this.$button.disabled = this.disabled;
3637
}
3738
if (changes.checked) {
38-
this.$label.classList.toggle('checked', this.checked);
39+
this.$button.classList.toggle('checked', this.checked);
3940
}
4041
}
4142

0 commit comments

Comments
 (0)