Skip to content

Commit 14d86c8

Browse files
committed
fix: tap icon from tap icon button
1 parent e904a37 commit 14d86c8

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

src/icon-button/icon-button.ts

+1-29
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,3 @@
1-
import { queryAssignedElements } from 'lit/decorators.js';
21
import { BaseButton } from '../base-button';
3-
import { PropertyValues } from 'lit';
4-
import { TapIcon } from '../icon';
52

6-
export class IconButton extends BaseButton {
7-
@queryAssignedElements() private icon!: TapIcon[];
8-
9-
protected updated(_changedProperties: PropertyValues) {
10-
super.updated(_changedProperties);
11-
const isSizeChanged = !!_changedProperties.get('size');
12-
if (isSizeChanged) this.updateIconSize();
13-
}
14-
15-
private updateIconSize = () => {
16-
if (this.icon[0]) {
17-
this.icon[0].width = this.getIconSize();
18-
this.icon[0].height = this.getIconSize();
19-
}
20-
};
21-
22-
private getIconSize = () => {
23-
switch (this.size) {
24-
case 'small':
25-
return 20;
26-
case 'medium':
27-
case 'large':
28-
return 24;
29-
}
30-
};
31-
}
3+
export class IconButton extends BaseButton {}

0 commit comments

Comments
 (0)