-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: improve maintainers & start implementing popup
- Loading branch information
Showing
15 changed files
with
674 additions
and
176 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 |
---|---|---|
@@ -1,19 +1,46 @@ | ||
div.package-maintainers { | ||
display: flex; | ||
flex-wrap: wrap; | ||
flex-direction: column; | ||
margin: 10px 0; | ||
} | ||
|
||
div.package-maintainers>div { | ||
flex-basis: 56px; | ||
height: 56px; | ||
margin-right: 6px; | ||
display: flex; | ||
height: 40px; | ||
margin-bottom: 6px; | ||
box-sizing: border-box; | ||
border-radius: 4px; | ||
overflow: hidden; | ||
background: linear-gradient(to right, rgb(43 68 137) 0%, rgba(255, 255, 255, 0) 100%); | ||
} | ||
|
||
div.package-maintainers>div:hover { | ||
background: linear-gradient(to right, rgb(43, 87, 137) 0%, rgba(255, 255, 255, 0) 100%); | ||
cursor: pointer; | ||
color: yellow; | ||
} | ||
|
||
div.package-maintainers>div img { | ||
width: 56px; | ||
div.package-maintainers>div>img { | ||
width: 40px; | ||
margin-right: 6px; | ||
} | ||
|
||
div.package-maintainers>div>p { | ||
flex-grow: 1; | ||
display: flex; | ||
align-items: center; | ||
font-family: "mononoki"; | ||
} | ||
|
||
div.package-maintainers>div>span { | ||
margin-left: 6px; | ||
display: flex; | ||
align-items: center; | ||
font-family: "mononoki"; | ||
min-width: 76px; | ||
padding-right: 10px; | ||
justify-content: flex-end; | ||
background-color: #236f5c2e; | ||
border-radius: 20px; | ||
color: #ecf5da; | ||
} |
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,34 @@ | ||
/** TODO: ANIMATE ? **/ | ||
section#popup--background { | ||
width: 100%; | ||
height: 100%; | ||
overflow: hidden; | ||
position: fixed; | ||
left: 0; | ||
top: 0; | ||
z-index: 50; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
/* pointer-events: none; */ | ||
background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0) 0%, rgb(30 35 65) 100%); | ||
|
||
visibility: hidden; | ||
opacity: 0; | ||
transition: opacity 0.35s ease-in, visibility 0ms ease-in 0.35s; | ||
} | ||
|
||
section#popup--background.show { | ||
visibility: visible; | ||
opacity: 1; | ||
transition: opacity 0.35s ease-in, visibility 0ms ease-in 0ms; | ||
} | ||
|
||
section#popup--background>.popup { | ||
pointer-events: all !important; | ||
background: #f5f4f4; | ||
border-radius: 4px; | ||
box-shadow: 5px 5px 15px rgb(23 27 129 / 41%); | ||
border-left: 2px solid #ffffff; | ||
border-top: 2px solid #FFF; | ||
} |
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,82 @@ | ||
// Import Internal Dependencies | ||
import * as utils from "../../common/utils"; | ||
|
||
export class Popup { | ||
constructor() { | ||
this.state = "closed"; | ||
this.dom = { | ||
background: document.getElementById("popup--background"), | ||
popup: document.querySelector(".popup") | ||
}; | ||
|
||
this.listener = null; | ||
this.templateName = null; | ||
} | ||
|
||
/** | ||
* @param {!PopupTemplate} htmlElement | ||
* @returns {void} | ||
*/ | ||
open(template) { | ||
if (!(template instanceof PopupTemplate)) { | ||
throw new Error("You must provide a PopupTemplate"); | ||
} | ||
if (this.state === "open") { | ||
return; | ||
} | ||
|
||
this.templateName = template.name; | ||
this.dom.popup.appendChild(template.HTMLElement); | ||
// TODO: apply additional css customization | ||
|
||
this.dom.background.classList.add("show"); | ||
this.state = "open"; | ||
setTimeout(() => this.#closeOnClickOutside(), 1); | ||
} | ||
|
||
#closeOnClickOutside() { | ||
this.listener = utils.hideOnClickOutside( | ||
this.dom.popup, | ||
{ | ||
reverse: true, | ||
hiddenTarget: null, | ||
callback: () => { | ||
this.listener = null; | ||
this.close(); | ||
} | ||
} | ||
); | ||
} | ||
|
||
#cleanupClickOutside() { | ||
if (this.listener !== null) { | ||
document.removeEventListener("click", this.listener); | ||
} | ||
} | ||
|
||
close() { | ||
if (this.state === "closed") { | ||
return; | ||
} | ||
|
||
this.dom.popup.innerHTML = ""; | ||
this.templateName = null; | ||
this.#cleanupClickOutside(); | ||
this.dom.background.classList.remove("show"); | ||
this.state = "closed"; | ||
} | ||
} | ||
|
||
export class PopupTemplate { | ||
/** | ||
* @param {!string} name | ||
* @param {!HTMLElement} HTMLElement | ||
*/ | ||
constructor( | ||
name, | ||
HTMLElement | ||
) { | ||
this.name = name; | ||
this.HTMLElement = HTMLElement; | ||
} | ||
} |
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
Oops, something went wrong.