Compare commits

..

4 Commits

Author SHA1 Message Date
a42d18f63e feat: aula 7.7 treinando vtex io 2023-01-19 23:24:43 -03:00
060e02956e feat: aulas 7.5 e 7.6 treinando 2023-01-19 16:20:05 -03:00
86667eb6ff feat: aula 7.4 2023-01-17 22:56:23 -03:00
3cb9ce1def feat: aula 7.3 2023-01-17 18:26:53 -03:00
12 changed files with 42104 additions and 7655 deletions

View File

@ -22,6 +22,7 @@
},
"dependencies": {
"husky": "^5.2.0",
"react": "^17.0.2"
"react": "^17.0.2",
"scss": "^0.2.4"
}
}

View File

@ -0,0 +1,3 @@
/* eslint-disable linebreak-style */
import Countdown from "./components/Countdown";
export default Countdown;

View File

@ -0,0 +1,92 @@
import React, { useEffect, useState } from "react";
import styles from "./styles.css";
interface CountdownProps {
// Fortmato: dd/mm/aaaa/hr:min
endDate:string
}
interface time {
hour: number,
minute: number,
second : number
}
const Countdown = ({endDate}:CountdownProps) => {
const [time, setTime] = useState <time> ({
hour:0,
minute:0,
second:0
});
const [day, month, year, hourMinute] = endDate.split("/");
const [hour, minute] = hourMinute.split(":");
const updateTimer = () =>{
const finalDate = new Date(
parseInt(year),
parseInt(month) - 1,
parseInt(day),
parseInt(hour),
parseInt(minute)
).getTime();
const atualDate = new Date().getTime();
let difference = finalDate -atualDate;
const hours = Math.floor(difference / (1000 * 60 * 60));
difference = difference - (hours * 60 * 60 * 1000);
const minutes = Math.floor(difference / (1000 * 60));
difference = difference - (minutes * 60 * 1000);
const seconds = Math.floor(difference / 1000);
if(hours <= 0 ){
setTime({
hour: 0,
minute: 0,
second: 0,
});
} else{
setTime({
hour: hours,
minute: minutes,
second: seconds
});
}
};
useEffect(()=>{
setInterval(updateTimer,1000);
},[]);
return (
<div className={styles.CountdownWrapper}>
<div className={styles.CountdownTitle}>
<h1 className={styles.texth1}>TEXTO H1</h1>
<h3 className={styles.texth3}>TEXTO H3</h3>
<h2 className={styles.texth2}>TEXTO H2</h2>
</div>
<div className={styles.hora}>
{`
${time.hour.toString().padStart(2, "0")}:
${time.minute.toString().padStart(2, "0")}:
${time.second.toString().padStart(2, "0")}
`}
</div>
</div>
);
};
export default Countdown;

View File

@ -0,0 +1,43 @@
.CountdownWrapper{
border-radius: 5px;
background-color: black;
color: white;
width: 414px ;
position: relative;
height: 463px;
margin-top: 30px;
margin-left: 15px;
}
.CountdownTitle{
color: white;
text-align: center;
padding-top: 15px;
}
.texth1{
font-size: 40px;
line-height: 48px;
}
.texth3{
font-size: 18px;
line-height: 20px;
}
.texth2{
font-size: 26px;
line-height: 26px;
}
.hora{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 24px;
font-weight: 200;
letter-spacing: 0.1em;
color: white;
width: 170px;
height: 170px;
border-radius: 50%;
border: 2px solid #ffffff10;
display: grid;
place-items: center;
}

View File

@ -23,5 +23,8 @@
"content": {
"$ref": "app:agenciamagma.m3-custom#/definitions/DynamicMenu"
}
},
"Countdown-academy":{
"component": "Countdown"
}
}

33903
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -12,13 +12,13 @@
"postreleasy": "vtex publish --verbose"
},
"dependencies": {
"vtex.store-components": "3.x",
"vtex.search-graphql": "0.x",
"vtex.challenge-tp-condition": "0.x",
"vtex.store": "2.x",
"vtex.store-header": "2.x",
"vtex.product-summary": "2.x",
"vtex.store-footer": "2.x",
"vtex.store-components": "3.x",
"vtex.styleguide": "9.x",
"vtex.slider": "0.x",
"vtex.carousel": "2.x",

View File

@ -4,6 +4,8 @@
"list-context.image-list#demo",
"flex-layout.row#deals",
"__fold__",
"flex-layout.row#faixa-de-imagens",
"Countdown-academy",
"rich-text#m3-shelf-title",
"flex-layout.row#m3-shelf",
"info-card#m3-middle-card",
@ -15,6 +17,84 @@
// "challenge": "challenge.trade-policy-condition"
// }
},
"Countdown-academy":{
"props":{
"endDate": "20/01/2023/16:00"
}
},
"flex-layout.row#faixa-de-imagens":{
"props":{
"blockClass":"faixa-de-imagens"
},
"children": [
"image#imagem-1",
"flex-layout.col#imagem-meio",
"image#imagem-3"
]
},
"flex-layout.col#imagem-meio":{
"props":{
"blockClass":"faixa-de-imagens"
},
"children":[
"image#imagem-2",
"flex-layout.col#conteudo-meio"
]
},
"flex-layout.col#conteudo-meio":{
"props":{
"blockClass":"conteudo-meio",
"preventVerticalStretch":"auto"
},
"children":[
"rich-text#texto-meio",
"link#link-meio"
]
},
"rich-text#texto-meio": {
"props": {
"blockClass":"text-meio",
"text": "***Sub Titulo*** \n **Titulo** \n Descrição"
}
},
"link#link-meio": {
"props": {
"blockClass":"link-meio",
"href": "/",
"label": "link"
}
},
"image#imagem-1": {
"props": {
"blockClass": "imagem",
"src": "https://picsum.photos/seed/picsum/200/300"
}
},
"image#imagem-2": {
"props": {
"blockClass": "imagem",
"src": "https://picsum.photos/seed/picsum/200/300"
}
},
"image#imagem-3": {
"props": {
"blockClass": "imagem",
"src": "https://picsum.photos/seed/picsum/200/300"
}
},
"challenge.trade-policy-condition": {
"props": {
"redirectPath": "/registration",

View File

@ -0,0 +1,23 @@
.flexRow--faixa-de-imagens{
margin-top: 25px;
width: 100%;
:global(.vtex-store-components-3-x-imageElement--imagem){
height: 100%;
width: 100%;
}
.stretchChildrenWidth{
margin: 0px 8px;
}
}
.flexCol--faixa-de-imagens{
position: relative;
.flexCol--conteudo-meio {
position: absolute;
inset: 0;
}
.flexCol--conteudo-meio{
justify-content: center;
text-align: center;
}
}

View File

@ -0,0 +1,13 @@
.container--text-meio{
justify-content: center;
.paragraph--text-meio{
color:black;
font-size: 15px;
.strong--text-meio{
font-size: 25px;
}
.italic--text-meio{
font-size: 20px;
}
}
}

View File

@ -0,0 +1,9 @@
.link--link-meio{
font-size: 25px;
color: black;
text-decoration: line-through;
padding: 15px;
border-radius: 25%;
background-color: white;
margin-top: 5px;
}

15585
yarn.lock

File diff suppressed because it is too large Load Diff