Skip to content

Commit

Permalink
correcao na barra de progresso form, animacao oppening
Browse files Browse the repository at this point in the history
  • Loading branch information
omattaeus committed Jan 10, 2025
1 parent 05b7478 commit 4b36db0
Show file tree
Hide file tree
Showing 19 changed files with 417 additions and 286 deletions.
17 changes: 16 additions & 1 deletion .deco/blocks/Abertura%20Home.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,20 @@
"__resolveType": "site/sections/Final/Headers/Openning.tsx",
"title": "Gestão inteligente para sonhar mais",
"highlight": "sonhar mais",
"subtitleDescription": "A Linked entende as dores do seu negócio e pode te ajudar a economizar e lucrar"
"subtitleDescription": "A Linked entende as dores do seu negócio e pode te ajudar a economizar e lucrar",
"open": [
{
"title": "Gestão inteligente para sonhar mais",
"highlight": "sonhar mais",
"subtitleDescription": "A Linked entende as dores do seu negócio e pode te ajudar a economizar e lucrar"
},
{
"title": "Gestão inteligente para sonhar mais",
"highlight": "sonhar mais"
},
{
"title": "Gestão inteligente para sonhar mais",
"highlight": "sonhar mais"
}
]
}
2 changes: 1 addition & 1 deletion .deco/blocks/pages-My%2520New%2520Page-461078.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
}
],
"text": "Teste",
"name": "Teste"
"name": "radio"
},
"title": "Teste",
"text": "Teste",
Expand Down
6 changes: 0 additions & 6 deletions components/ui/Content/BigNumber/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ function setClass(value: string) {
}
}

/* Descrição do component
*asdasd
*asd
*asd
*/

function BigNumber(
{ number, description, colorTheme }: JSX.IntrinsicElements["div"] & Props,
) {
Expand Down
95 changes: 95 additions & 0 deletions components/ui/Content/Openning/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import Script, { type Props } from "./script.tsx";

export interface Open {
/**
* @title Título
* @description Escreva aqui o título da abertura
*/
title?: string;
/**
* @title Palavra ou Frase com Cor
* @description Escreva a palavra ou frase com cor
*/
highlight?: string;
/**
* @title Subtítulo
* @description Escreva aqui o subtítulo da abertura
*/
subtitleDescription?: string;
}

/**
* @title {{{title}}}
*/
export interface Props {
/**
* @title Título do Bloco
* @description Escreva aqui o título do bloco
*/
title?: string;
/**
* @title Títulos de Abertura
* @description Lista de títulos de abertura com suas propriedades
*/
open?: Open[];
}

export default function Section({
title = "",
open = [],
}: Props) {
const getHighlightedText = (text: string, highlight?: string) => {
if (!highlight) return text;

const parts = text.split(new RegExp(`(${highlight})`, "gi"));
return parts.map((part, index) =>
part.toLowerCase() === highlight.toLowerCase()
? (
<span key={index} className="text-accent">
{part}
</span>
)
: part
);
};

return (
<>
<div className="bg-sacramentoState h-[80vh] flex">
<div className="ml-4 md:ml-10 w-full flex flex-col items-start justify-center">
{open.map((item, index) => (
<div
key={index}
data-slide={String(index)}
className={`pt-[10px] md:pt-[21px] w-full
${
index === 0
? "block slide-in-left"
: "slide-in-left hidden"
}
transition-all duration-800 ease-out`}
>
<div className="grid gap-y-[14px]">
{item.title && (
<div className="max-w-[320px] md:max-w-[548px]">
<p className="font-sans text-white font-medium text-[32px] lg:text-[64px] leading-tight-35 lg:leading-tight-70 tracking-tight-2 fade-in-animation">
{getHighlightedText(item.title, item.highlight)}
</p>
</div>
)}
{item.subtitleDescription && (
<div className="pr-10 md:pr-0 w-full !max-w-none">
<p className="text-base md:text-lg font-sans font-normal leading-tight-18 md:leading-tight-25 text-white-80 fade-in-animation">
{item.subtitleDescription}
</p>
</div>
)}
</div>
</div>
))}
</div>
</div>
<Script />
</>
);
}
65 changes: 65 additions & 0 deletions components/ui/Content/Openning/script.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { useScript } from "@deco/deco/hooks";

export interface Props {}

const setup = () => {
let currentIndex = 0;
const slides = Array.from(document.querySelectorAll("[data-slide]"));
const totalSlides = slides.length;

console.log("TOTAL SLIDES: " + totalSlides);

const showSlide = (index: number) => {
slides.forEach((slide, idx) => {
if (idx === index) {
slide.classList.remove("translate-x-full", "opacity-0", "hidden");
slide.classList.add("translate-x-0", "opacity-100", "block");
} else {
slide.classList.remove("translate-x-0", "opacity-100", "block");
slide.classList.add("translate-x-full", "opacity-0", "hidden");
}
});
};

const nextSlide = () => {
currentIndex = (currentIndex + 1) % totalSlides;
console.log("INDEX ATUAL: " + currentIndex);
showSlide(currentIndex);
};

const prevSlide = () => {
currentIndex = (currentIndex - 1 + totalSlides) % totalSlides;
console.log("INDEX ATUAL: " + currentIndex);
showSlide(currentIndex);
};

document.addEventListener("DOMContentLoaded", () => {
if (slides.length === 0) return;

showSlide(currentIndex);

document.addEventListener("keydown", (event) => {
if (event.key === "ArrowRight") {
nextSlide();
}
if (event.key === "ArrowLeft") {
prevSlide();
}
});

setInterval(nextSlide, 5000);
});
};

function Open({}: Props) {
return (
<script
type="module"
dangerouslySetInnerHTML={{
__html: useScript(setup, {}),
}}
/>
);
}

export default Open;
64 changes: 2 additions & 62 deletions components/ui/Form/FixedSectionForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ export type Link = {
* @description Insira a URL ou o caminho de destino
*/
url: string;
/**
* @title Nome
* @description Nome visível para clique
*/
name: string;
/**
* @title Destino
* @description Insira a URL ou o caminho de destino
*/
url: string;
};

export interface Props {
Expand All @@ -38,22 +28,7 @@ export interface Props {
highlight?: string;
/**
* @title Ícone do Botão
* @description Insisra o Ícone do Botão
*/
ImageWidget: ImageWidget;
/**
* @title Descrição
* @description Insira a descrição
*/
description?: string;
/**
* @title Palavra ou Frase com Cor
* @description Escreva a palavra ou frase com cor
*/
highlight?: string;
/**
* @title Ícone do Botão
* @description Insisra o Ícone do Botão
* @description Insira o Ícone do Botão
*/
ImageWidget: ImageWidget;
}
Expand All @@ -62,19 +37,11 @@ function FixedSectionForm({
description = "",
highlight = "",
ImageWidget = "",
description = "",
highlight = "",
ImageWidget = "",
}: Props) {
const getHighlightedText = (text: string, highlight: string) => {
if (!highlight) return text;
const getHighlightedText = (text: string, highlight: string) => {
if (!highlight) return text;

const regex = new RegExp(`(${highlight})`, "giu");
const regex = new RegExp(`(${highlight})`, "giu");

const parts = text.split(regex);
const parts = text.split(regex);

return parts.map((part, index) => {
Expand All @@ -91,20 +58,6 @@ function FixedSectionForm({
return part;
});
};
return parts.map((part, index) => {
if (part.toLowerCase() === highlight.toLowerCase()) {
return (
<span
key={index}
className="font-bold text-sacramentoState"
>
{part}
</span>
);
}
return part;
});
};

return (
<>
Expand All @@ -118,18 +71,6 @@ function FixedSectionForm({
data-next="next"
className="w-[56px] h-[56px] flex justify-center items-center rounded-full bg-sacramentoState cursor-pointer"
>
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M17.92 11.6199C17.8724 11.4972 17.801 11.385 17.71 11.2899L12.71 6.28994C12.6168 6.1967 12.5061 6.12274 12.3842 6.07228C12.2624 6.02182 12.1319 5.99585 12 5.99585C11.7337 5.99585 11.4783 6.10164 11.29 6.28994C11.1968 6.38318 11.1228 6.49387 11.0723 6.61569C11.0219 6.73751 10.9959 6.86808 10.9959 6.99994C10.9959 7.26624 11.1017 7.52164 11.29 7.70994L14.59 10.9999H7C6.73478 10.9999 6.48043 11.1053 6.29289 11.2928C6.10536 11.4804 6 11.7347 6 11.9999C6 12.2652 6.10536 12.5195 6.29289 12.707C6.48043 12.8946 6.73478 12.9999 7 12.9999H14.59L11.29 16.2899C11.1963 16.3829 11.1219 16.4935 11.0711 16.6154C11.0203 16.7372 10.9942 16.8679 10.9942 16.9999C10.9942 17.132 11.0203 17.2627 11.0711 17.3845C11.1219 17.5064 11.1963 17.617 11.29 17.7099C11.383 17.8037 11.4936 17.8781 11.6154 17.9288C11.7373 17.9796 11.868 18.0057 12 18.0057C12.132 18.0057 12.2627 17.9796 12.3846 17.9288C12.5064 17.8781 12.617 17.8037 12.71 17.7099L17.71 12.7099C17.801 12.6148 17.8724 12.5027 17.92 12.3799C18.02 12.1365 18.02 11.8634 17.92 11.6199Z"
fill="#3BEDB2"
/>
</svg>
</button>
</div>
<div className="px-4 pt-[14px] pb-5 w-full flex justify-between items-center gap-x-4 shadow-top">
Expand Down Expand Up @@ -159,5 +100,4 @@ function FixedSectionForm({
);
}

export default FixedSectionForm;

export default FixedSectionForm;
12 changes: 2 additions & 10 deletions components/ui/Form/Input/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
interface InputComponentProps {
name?: string;
placeholder?: string;
onValidate?: (isValid: boolean) => void;
}

function InputComponent(
{ name, placeholder, onValidate }: InputComponentProps,
{ name, placeholder }: InputComponentProps,
) {
const handleChange = (e: Event) => {
const input = e.target as HTMLInputElement;
if (onValidate) {
onValidate(input.value.trim().length > 0);
}
};

return (
<>
Expand All @@ -23,12 +16,11 @@ function InputComponent(
type="text"
placeholder={placeholder}
className="focus:outline-none w-full pb-2 border-b-2 border-sacramentoState text-sacramentoState placeholder:sacramentoState-80 rounded-none"
onInput={handleChange}
/>
</div>
</div>
</>
);
}

export default InputComponent;
export default InputComponent;
Loading

0 comments on commit 4b36db0

Please sign in to comment.