-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(presets): work on future
presets
feature
- Loading branch information
Bamdad Sabbagh
committed
Nov 18, 2021
1 parent
6b9764d
commit 96020f2
Showing
10 changed files
with
153 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
export class PresetsView { | ||
private selectors: { contentNode: string; node: string; closeButton: string; }; | ||
|
||
private node: HTMLDialogElement; | ||
|
||
private content: Element; | ||
|
||
private closeButton: HTMLButtonElement; | ||
|
||
constructor () { | ||
this.selectors = { | ||
node: '#presets', | ||
closeButton: '.close-button', | ||
contentNode: '.mdl-dialog__content', | ||
}; | ||
|
||
this.node = document.querySelector (this.selectors.node); | ||
this.content = this.node.querySelector (this.selectors.contentNode); | ||
this.closeButton = this.node.querySelector (this.selectors.closeButton); | ||
|
||
this.attachEvents (); | ||
} | ||
|
||
attachEvents (): void { | ||
// clicking close button | ||
this.closeButton.onclick = () => this.hide (); | ||
|
||
// clicking outside container | ||
this.node.onclick = (e) => { | ||
// MDL adds `open` HTML attribute to the dialog container (outside) only | ||
if (e.target.open) { | ||
this.hide (); | ||
} | ||
}; | ||
} | ||
|
||
show (): void { | ||
this.node.showModal (); | ||
} | ||
|
||
hide (): void { | ||
this.node.close (); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export function getNetworkShape (preset: number[]): number[] { | ||
const n = []; | ||
preset.forEach (() => n.push (8)); | ||
return n; | ||
} |
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 |
---|---|---|
|
@@ -33,4 +33,6 @@ interface Navigator { | |
|
||
interface HTMLDialogElement { | ||
close (): void; | ||
|
||
showModal (): void; | ||
} |
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
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