forked from gustavoquinalha/devpr24
-
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.
- Loading branch information
Showing
49 changed files
with
541 additions
and
425 deletions.
There are no files selected for viewing
Binary file not shown.
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,4 +1,4 @@ | ||
export * from './description-dialog'; | ||
export * from './dialog-container'; | ||
export * from './google-form-dialog'; | ||
export * from './dialog'; | ||
export * from "./description-dialog"; | ||
export * from "./dialog-container"; | ||
export * from "./google-form-dialog"; | ||
export * from "./dialog"; |
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,32 +1,33 @@ | ||
import {slugify} from './utils' | ||
import { slugify } from "./utils"; | ||
|
||
type Section = | ||
| 'Topo' | ||
| 'Comunidade' | ||
| 'Palestras confirmadas' | ||
| 'Contribua' | ||
| 'Faça acontecer' | ||
| 'Depoimentos' | ||
| 'Contato' | ||
| "Topo" | ||
| "Comunidade" | ||
| "Palestras confirmadas" | ||
| "Contribua" | ||
| "Faça acontecer" | ||
| "Depoimentos" | ||
| "Vídeo" | ||
| "Contato"; | ||
|
||
class Config { | ||
#elements: HTMLElement[] = [] | ||
#navigation: [string, string][] = [] | ||
#elements: HTMLElement[] = []; | ||
#navigation: [string, string][] = []; | ||
|
||
get elements() { | ||
return this.#elements | ||
return this.#elements; | ||
} | ||
|
||
get navigation() { | ||
return this.#navigation | ||
return this.#navigation; | ||
} | ||
|
||
addSection(name: Section, element: JSX.Element) { | ||
const id = slugify(name) | ||
element.id = id | ||
this.#elements.push(element) | ||
this.#navigation.push([`#${id}`, name]) | ||
const id = slugify(name); | ||
element.id = id; | ||
this.#elements.push(element); | ||
this.#navigation.push([`#${id}`, name]); | ||
} | ||
} | ||
|
||
export const config = new Config() | ||
export const config = new Config(); |
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,10 +1,10 @@ | ||
export * from './codaqui'; | ||
export * from './countdown'; | ||
export * from './dev-parana'; | ||
export * from './gtm'; | ||
export * from './icon'; | ||
export * from './link'; | ||
export * from './logo'; | ||
export * from './social-links'; | ||
export * from './symbols'; | ||
export * from './theme-toggle'; | ||
export * from "./codaqui"; | ||
export * from "./countdown"; | ||
export * from "./dev-parana"; | ||
export * from "./gtm"; | ||
export * from "./icon"; | ||
export * from "./link"; | ||
export * from "./logo"; | ||
export * from "./social-links"; | ||
export * from "./symbols"; | ||
export * from "./theme-toggle"; |
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,9 +1,10 @@ | ||
export * from './about'; | ||
export * from './banner'; | ||
export * from './get-involved'; | ||
export * from './contact'; | ||
export * from './footer'; | ||
export * from './header'; | ||
export * from './speakers'; | ||
export * from './supports'; | ||
export * from './testimonials'; | ||
export * from "./about"; | ||
export * from "./banner"; | ||
export * from "./contact"; | ||
export * from "./footer"; | ||
export * from "./get-involved"; | ||
export * from "./header"; | ||
export * from "./speakers"; | ||
export * from "./supports"; | ||
export * from "./testimonials"; | ||
export * from "./video"; |
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,39 @@ | ||
import { create } from "../utils"; | ||
|
||
export interface VideoAttrs { | ||
src: string; | ||
} | ||
|
||
export const Video = ({ src }: VideoAttrs) => { | ||
const video = create( | ||
"video", | ||
{ preload: "metadata", tabIndex: 0 }, | ||
create("source", { | ||
src, | ||
type: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"', | ||
}) | ||
); | ||
|
||
queueMicrotask(() => { | ||
const handle = (entries: IntersectionObserverEntry[]) => { | ||
entries.forEach((entry) => { | ||
if (navigator.userActivation.hasBeenActive) { | ||
if (entry.isIntersecting && video.paused) video.play(); | ||
else if (!video.paused) video.pause(); | ||
} | ||
}); | ||
}; | ||
|
||
const options = { rootMargin: "0px", threshold: 0 }; | ||
|
||
const observer = new IntersectionObserver(handle, options); | ||
video.onloadeddata = () => observer.observe(video); | ||
}); | ||
|
||
return ( | ||
<section id="video" className="video"> | ||
{video} | ||
<div></div> | ||
</section> | ||
); | ||
}; |
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,16 +1,16 @@ | ||
export function counter(date: Date) { | ||
const distance = date.getTime() - new Date().getTime() | ||
const distance = date.getTime() - new Date().getTime(); | ||
const base = { | ||
day: 1000 * 60 * 60 * 24, | ||
hour: 1000 * 60 * 60, | ||
min: 1000 * 60, | ||
sec: 1000, | ||
} | ||
}; | ||
|
||
const days = Math.floor(distance / base.day) | ||
const hours = Math.floor((distance % base.day) / base.hour) | ||
const mins = Math.floor((distance % base.hour) / base.min) | ||
const secs = Math.floor((distance % base.min) / base.sec) | ||
const days = Math.floor(distance / base.day); | ||
const hours = Math.floor((distance % base.day) / base.hour); | ||
const mins = Math.floor((distance % base.hour) / base.min); | ||
const secs = Math.floor((distance % base.min) / base.sec); | ||
|
||
return {distance, days, hours, mins, secs} | ||
return { distance, days, hours, mins, secs }; | ||
} |
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,24 +1,24 @@ | ||
type CreateParams< | ||
K extends keyof HTMLElementTagNameMap, | ||
A extends HTMLElementTagNameMap[K] | ||
> = [Partial<A>, ...(Text | Node)[]] | (Text | Node)[] | ||
A extends HTMLElementTagNameMap[K], | ||
> = [Partial<A>, ...(Text | Node)[]] | (Text | Node)[]; | ||
|
||
export function create< | ||
K extends keyof HTMLElementTagNameMap, | ||
A extends HTMLElementTagNameMap[K] | ||
A extends HTMLElementTagNameMap[K], | ||
>( | ||
name: K, | ||
...[attrs, ...children]: CreateParams<K, A> | ||
): HTMLElementTagNameMap[K] { | ||
const element = document.createElement(name) | ||
const element = document.createElement(name); | ||
|
||
if (attrs instanceof Element) { | ||
element.append(attrs, ...(children as Node[])) | ||
element.append(attrs, ...(children as Node[])); | ||
} else { | ||
element.append(...(children as Node[])) | ||
element.append(...(children as Node[])); | ||
|
||
Object.assign(element, attrs) | ||
Object.assign(element, attrs); | ||
} | ||
|
||
return element | ||
return element; | ||
} |
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,55 @@ | ||
function find<K extends keyof HTMLElementTagNameMap>(selector: K, parent?: HTMLElement | ShadowRoot): HTMLElementTagNameMap[K] | ||
function find<K extends keyof HTMLElementTagNameMap>(selector: `${K}.${string}`, parent?: HTMLElement | ShadowRoot): HTMLElementTagNameMap[K] | ||
function find<K extends keyof HTMLElementTagNameMap>(selector: `${K}#${string}`, parent?: HTMLElement | ShadowRoot): HTMLElementTagNameMap[K] | ||
function find<K extends keyof HTMLElementTagNameMap>(selector: `${K}[${string}]`, parent?: HTMLElement | ShadowRoot): HTMLElementTagNameMap[K] | ||
function find<K extends keyof HTMLElementTagNameMap>(selector: `${string}`, parent?: HTMLElement | ShadowRoot): HTMLElement | ||
function find<T extends string>(selector: T, parent: HTMLElement | ShadowRoot = document.body) { | ||
return parent.querySelector(selector) | ||
}; | ||
function find<K extends keyof HTMLElementTagNameMap>( | ||
selector: K, | ||
parent?: HTMLElement | ShadowRoot, | ||
): HTMLElementTagNameMap[K]; | ||
function find<K extends keyof HTMLElementTagNameMap>( | ||
selector: `${K}.${string}`, | ||
parent?: HTMLElement | ShadowRoot, | ||
): HTMLElementTagNameMap[K]; | ||
function find<K extends keyof HTMLElementTagNameMap>( | ||
selector: `${K}#${string}`, | ||
parent?: HTMLElement | ShadowRoot, | ||
): HTMLElementTagNameMap[K]; | ||
function find<K extends keyof HTMLElementTagNameMap>( | ||
selector: `${K}[${string}]`, | ||
parent?: HTMLElement | ShadowRoot, | ||
): HTMLElementTagNameMap[K]; | ||
function find<K extends keyof HTMLElementTagNameMap>( | ||
selector: `${string}`, | ||
parent?: HTMLElement | ShadowRoot, | ||
): HTMLElement; | ||
function find<T extends string>( | ||
selector: T, | ||
parent: HTMLElement | ShadowRoot = document.body, | ||
) { | ||
return parent.querySelector(selector); | ||
} | ||
|
||
function findAll<K extends keyof HTMLElementTagNameMap>(selector: K, parent?: HTMLElement | ShadowRoot): NodeListOf<HTMLElementTagNameMap[K]> | ||
function findAll<K extends keyof HTMLElementTagNameMap>(selector: `${K}.${string}`, parent?: HTMLElement | ShadowRoot): NodeListOf<HTMLElementTagNameMap[K]> | ||
function findAll<K extends keyof HTMLElementTagNameMap>(selector: `${K}#${string}`, parent?: HTMLElement | ShadowRoot): NodeListOf<HTMLElementTagNameMap[K]> | ||
function findAll<K extends keyof HTMLElementTagNameMap>(selector: `${K}[${string}]`, parent?: HTMLElement | ShadowRoot): NodeListOf<HTMLElementTagNameMap[K]> | ||
function findAll<K extends keyof HTMLElementTagNameMap>(selector: `${string}`, parent?: HTMLElement | ShadowRoot): NodeListOf<HTMLElement> | ||
function findAll<T extends string>(selector: T, parent: HTMLElement | ShadowRoot = document.body) { | ||
return parent.querySelectorAll(selector) | ||
}; | ||
function findAll<K extends keyof HTMLElementTagNameMap>( | ||
selector: K, | ||
parent?: HTMLElement | ShadowRoot, | ||
): NodeListOf<HTMLElementTagNameMap[K]>; | ||
function findAll<K extends keyof HTMLElementTagNameMap>( | ||
selector: `${K}.${string}`, | ||
parent?: HTMLElement | ShadowRoot, | ||
): NodeListOf<HTMLElementTagNameMap[K]>; | ||
function findAll<K extends keyof HTMLElementTagNameMap>( | ||
selector: `${K}#${string}`, | ||
parent?: HTMLElement | ShadowRoot, | ||
): NodeListOf<HTMLElementTagNameMap[K]>; | ||
function findAll<K extends keyof HTMLElementTagNameMap>( | ||
selector: `${K}[${string}]`, | ||
parent?: HTMLElement | ShadowRoot, | ||
): NodeListOf<HTMLElementTagNameMap[K]>; | ||
function findAll<K extends keyof HTMLElementTagNameMap>( | ||
selector: `${string}`, | ||
parent?: HTMLElement | ShadowRoot, | ||
): NodeListOf<HTMLElement>; | ||
function findAll<T extends string>( | ||
selector: T, | ||
parent: HTMLElement | ShadowRoot = document.body, | ||
) { | ||
return parent.querySelectorAll(selector); | ||
} | ||
|
||
export { find, findAll } | ||
export { find, findAll }; |
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,9 +1,9 @@ | ||
export * from './counter'; | ||
export * from './create'; | ||
export * from './find'; | ||
export * from './interval'; | ||
export * from './scroll-spy'; | ||
export * from './size'; | ||
export * from './slugify'; | ||
export * from './styled'; | ||
export * from './timeout'; | ||
export * from "./counter"; | ||
export * from "./create"; | ||
export * from "./find"; | ||
export * from "./interval"; | ||
export * from "./scroll-spy"; | ||
export * from "./size"; | ||
export * from "./slugify"; | ||
export * from "./styled"; | ||
export * from "./timeout"; |
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,5 +1,5 @@ | ||
export function interval(handler: TimerHandler, ms = 1000) { | ||
const ref = window.setInterval(handler, ms) | ||
const cancel = () => window.clearInterval(ref) | ||
return {cancel} | ||
const ref = window.setInterval(handler, ms); | ||
const cancel = () => window.clearInterval(ref); | ||
return { cancel }; | ||
} |
Oops, something went wrong.