-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from temnov98/Ilya/animation-delete-button
Animation delete button
- Loading branch information
Showing
10 changed files
with
71 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
examples/tapme/js/pages/tracker/components/preset/preset.delete-button.component.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletions
32
examples/tapme/js/pages/tracker/components/task/task.delete-button.component.js
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
examples/tapme/js/shared/components/delete-button.component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
class DeleteButtonComponent extends Component { | ||
/** | ||
* @param {() => void} onDelete | ||
*/ | ||
constructor(onDelete) { | ||
super(); | ||
this.onDelete = onDelete; | ||
|
||
this.activeted = false; | ||
this.cssClass = new CssClass(this.cssClassNames); | ||
} | ||
|
||
get cssClassNames() { | ||
const base = 'icon-button icon-button--red icon-button--trash-bin'; | ||
|
||
return this.activeted ? `${base} icon-button--trash-bin--open` : base; | ||
} | ||
|
||
onClick() { | ||
if (this.activeted) { | ||
this.onDelete(); | ||
} else { | ||
this.activeted = true; | ||
this.cssClass.className = this.cssClassNames; | ||
} | ||
} | ||
|
||
onMouseLeave() { | ||
this.activeted = false; | ||
this.cssClass.className = this.cssClassNames; | ||
} | ||
|
||
toHtml() { | ||
return t` | ||
<button | ||
class="${this.cssClass}" | ||
onmouseleave="${() => this.onMouseLeave()}" | ||
onclick="${() => this.onClick()}"> | ||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 6V8H22V6H17V2H7V6H2ZM9 4V6H15V4H9Z" /> | ||
<path d="M18 8H20V20C20 20.6667 19.6 22 18 22H6C4.4 22 4 20.6667 4 20V8H6V20H18V8Z" /> | ||
</svg> | ||
</button> | ||
`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters