-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/register flow #4
Open
ail3ngrimaldi
wants to merge
19
commits into
main
Choose a base branch
from
feat/register-flow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
570fddc
Add steps navigation
ail3ngrimaldi d026510
change way to name tag, add animation for dialog, set custom labels f…
ail3ngrimaldi 7c44ec0
Add animation dialog in and out, just one button if necessary and it …
ail3ngrimaldi a40173c
Add images, dialog animation, opening and closing working fine
ail3ngrimaldi e6167b9
fix broken navigation through steps
ail3ngrimaldi 14765de
add checkbox and link to copy url for authentication
ail3ngrimaldi 2ec6dd3
update logo size
ail3ngrimaldi d77c09e
Fix qr position, add input-code, add elements added before on index
ail3ngrimaldi c4b502a
Fix qr size and h2
ail3ngrimaldi bda6a5f
replace last image
ail3ngrimaldi bb3c811
Update textarea
ail3ngrimaldi 73f49b8
Fix: buttons size and colors
ail3ngrimaldi 1abfbdc
Handle navigation animation going back and closing
ail3ngrimaldi 1fdefa0
delete required which where not working
ail3ngrimaldi 0a11b42
added login
ail3ngrimaldi 9e285c3
simpler approach for dialog
ail3ngrimaldi bc23e5c
simplified dialog with navigation
ail3ngrimaldi cee112d
optional one or two buttons on each dialog, update tag names
ail3ngrimaldi 9252114
virto-login is just one component and the user can add as many virto-…
ail3ngrimaldi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,68 @@ | ||
class CustomCheckbox extends HTMLElement { | ||
static TAG = 'checkbox-virto'; | ||
static css = ` | ||
:host { | ||
display: block; | ||
width: 100%; | ||
} | ||
.checkbox-container { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
cursor: pointer; | ||
} | ||
input[type="checkbox"] { | ||
appearance: none; | ||
width: 20px; | ||
height: 20px; | ||
border-radius: 4px; | ||
background-color: var(--checkbox-bg, #e0e0e0); | ||
border: 1px solid var(--checkbox-border, #ccc); | ||
display: grid; | ||
place-content: center; | ||
margin-right: 10px; | ||
} | ||
input[type="checkbox"]:checked { | ||
background-color: var(--checkbox-checked-bg, #24AF37); | ||
border-color: var(--checkbox-checked-border, #24AF37); | ||
} | ||
input[type="checkbox"]:checked::before { | ||
content: '✔'; | ||
color: var(--checkbox-check-color, white); | ||
font-size: 14px; | ||
} | ||
label { | ||
color: var(--checkbox-label-color, #333); | ||
font-size: 16px; | ||
text-align: center; | ||
} | ||
`; | ||
|
||
constructor() { | ||
super(); | ||
this.attachShadow({ mode: 'open' }); | ||
} | ||
|
||
connectedCallback() { | ||
this.render(); | ||
} | ||
|
||
render() { | ||
const style = document.createElement('style'); | ||
style.textContent = CustomCheckbox.css; | ||
|
||
const container = document.createElement('div'); | ||
container.className = 'checkbox-container'; | ||
|
||
const checkbox = document.createElement('input'); | ||
checkbox.type = 'checkbox'; | ||
|
||
const label = document.createElement('label'); | ||
label.textContent = this.getAttribute('label') || 'Checkbox Label'; | ||
|
||
container.append(checkbox, label); | ||
this.shadowRoot.append(style, container); | ||
} | ||
} | ||
|
||
customElements.define(CustomCheckbox.TAG, CustomCheckbox); |
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,74 +1,121 @@ | ||
class DialogoModal extends HTMLElement { | ||
static css = ` | ||
:host { | ||
all: initial; | ||
display: flex; | ||
flex: 1; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100dvh; | ||
overflow-x: auto; | ||
} | ||
import 'https://early.webawesome.com/[email protected]/dist/components/dialog/dialog.js'; | ||
|
||
div { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1em; | ||
font-family: Outfit, sans-serif; | ||
width: 100%; | ||
max-width: 528px; | ||
height: fit-content; | ||
background: linear-gradient(0deg, rgba(231, 247, 232, 0.5), rgba(231, 247, 232, 0.5)), | ||
radial-gradient(84.04% 109.28% at 10.3% 12.14%, rgba(86, 201, 96, 0.5) 0%, rgba(198, 235, 199, 0) 98.5%); | ||
border-radius: 12px; | ||
box-shadow: 0px 2px var(--Blurblur-3, 3px) -1px rgba(26, 26, 26, 0.08), | ||
0px 1px var(--Blurblur-0, 0px) 0px rgba(26, 26, 26, 0.08); | ||
backdrop-filter: blur(32px); | ||
padding: 1em; | ||
gap: clamp(4px, 1vw, var(--spacing7, 14px)); | ||
opacity: 1; | ||
} | ||
const tagFn = fn => (strings, ...parts) => fn(parts.reduce((tpl, value, i) => `${tpl}${strings[i]}${value}`, '').concat(strings[parts.length])); | ||
const html = tagFn(s => new DOMParser().parseFromString(`<template>${s}</template>`, 'text/html').querySelector('template')); | ||
const css = tagFn(s => s); | ||
|
||
header { | ||
display: flex; | ||
align-items: center; | ||
gap: 1em; | ||
} | ||
const dialogTp = html` | ||
<wa-dialog light-dismiss with-header with-footer> | ||
<div slot="label"> | ||
<slot name="logo"></slot> | ||
<slot name="title"></slot> | ||
</div> | ||
<hr> | ||
<slot></slot> | ||
<div slot="footer"> | ||
<button-virto data-dialog="close" label="Close"></button-virto> | ||
<button-virto class="dialog-next" data-dialog="next" label="Next"></button-virto> | ||
</div> | ||
</wa-dialog> | ||
`; | ||
|
||
header h2 { | ||
font-size: 1.4em; | ||
font-weight: 600; | ||
margin: 0; | ||
} | ||
const dialogCss = css` | ||
:host, wa-dialog { font-family: 'Outfit', sans-serif !important; } | ||
|
||
hr { | ||
border: none; | ||
border-radius: 1px; | ||
border-top: 1px solid var(--color-accent); | ||
margin: 1em 0; | ||
} | ||
`; | ||
wa-dialog::part(base) { | ||
font-family: 'Outfit', sans-serif; | ||
font-weight: 400; | ||
padding: 1em; | ||
background: var(--color-dialog-bg); | ||
border-radius: 12px; | ||
box-shadow: 0px 2px var(--Blurblur-3, 3px) -1px rgba(26, 26, 26, 0.08), | ||
0px 1px var(--Blurblur-0, 0px) 0px rgba(26, 26, 26, 0.08); | ||
} | ||
|
||
wa-dialog::part(header) { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
} | ||
|
||
wa-dialog::part(header-actions) { | ||
order: 1; | ||
} | ||
|
||
wa-dialog::part(title) { | ||
display: flex; | ||
align-items: center; | ||
gap: 1em; | ||
} | ||
|
||
wa-dialog::part(footer) { | ||
display: flex; | ||
width: 100%; | ||
justify-content: space-between; | ||
} | ||
|
||
hr { | ||
border-top: 1px solid var(--color-accent); | ||
} | ||
|
||
[slot="label"] { | ||
display: flex; | ||
align-items: center; | ||
gap: 1em; | ||
} | ||
|
||
[slot="footer"] { | ||
width: 100%; | ||
display: flex; | ||
align-items: center; | ||
gap: 1em; | ||
} | ||
`; | ||
|
||
export class DialogoModal extends HTMLElement { | ||
static TAG = 'dialog-virto'; | ||
|
||
constructor() { | ||
super(); | ||
this.attachShadow({ mode: 'open' }); | ||
const style = document.createElement("style"); | ||
const dialog = document.createElement("div"); | ||
|
||
style.innerHTML = DialogoModal.css; | ||
this.username = ""; | ||
|
||
dialog.innerHTML = ` | ||
<header> | ||
<slot name="logo"></slot> | ||
<h2>${this.getAttribute("label") || "Login to Virto"}</h2> | ||
</header> | ||
<hr> | ||
<slot name="action"></slot> | ||
`; | ||
|
||
this.shadowRoot.append(style, dialog); | ||
this.attachShadow({ mode: "open" }); | ||
this.shadowRoot.appendChild(dialogTp.content.cloneNode(true)); | ||
|
||
const style = document.createElement('style'); | ||
style.textContent = dialogCss; | ||
this.shadowRoot.appendChild(style); | ||
} | ||
|
||
connectedCallback() { | ||
this.dialog = this.shadowRoot.querySelector('wa-dialog'); | ||
this.nextButton = this.shadowRoot.querySelector("[data-dialog='next']"); | ||
this.closeButton = this.shadowRoot.querySelector("[data-dialog='close']"); | ||
|
||
this.nextButton.addEventListener("click", () => this.next()); | ||
this.closeButton.addEventListener("click", () => this.close()); | ||
|
||
customElements.whenDefined('wa-dialog').then(() => { | ||
console.log('wa-dialog is defined'); | ||
}); | ||
} | ||
|
||
async open() { | ||
await this.dialog.updateComplete; | ||
this.dialog.open = true; | ||
} | ||
|
||
async close() { | ||
await this.dialog.updateComplete; | ||
this.dialog.open = false; | ||
} | ||
|
||
async next() { | ||
const allDialogs = document.querySelectorAll("dialog-virto"); | ||
const currentIndex = Array.from(allDialogs).indexOf(this); | ||
if (currentIndex + 1 < allDialogs.length) { | ||
await this.close(); | ||
await allDialogs[currentIndex + 1].open(); | ||
} | ||
} | ||
} | ||
|
||
customElements.define('dialog-virto', DialogoModal); | ||
customElements.define(DialogoModal.TAG, DialogoModal); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about using a top level await and define our components only after the wa-dialog is defined? that way you avoid declaring the other functions async