-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #270 from alura-challenges/aula05
final aula 05
- Loading branch information
Showing
11 changed files
with
2,287 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,61 @@ | ||
{ | ||
"bg": "https://i2.wp.com/css-tricks.com/wp-content/uploads/2017/06/css-is-awesome-scaled.jpg?resize=1536%2C1208&ssl=1", | ||
"title": "Quiz CSS da Alura", | ||
"description": "Teste os seus conhecimentos sobre CSS e vamos ver quantos layouts você vai deixar de quebrar", | ||
"bg": "https://www.hitalent.co/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBMmJDQXc9PSIsImV4cCI6bnVsbCwicHVyIjoiYmxvYl9pZCJ9fQ==--1452099b706ad7d079f7a3a4dd5d702ebeeae45f/HiTalent.png", | ||
"title": "Quiz JavaScript #AluraQuiz", | ||
"description": "Um quiz rápido sobre o mundo do JavaScript", | ||
"questions": [ | ||
{ | ||
"image": "https://media.giphy.com/media/xUOxf3yDKCuwpOlT3i/giphy.gif", | ||
"title": "Como fazer um seletor por id via CSS?", | ||
"description": "Essa é pra aquecer", | ||
"answer": 2, | ||
"image": "https://media.giphy.com/media/j5P0DQIOf4PonLi55G/giphy.gif", | ||
"title": "Qual a diferença entre = , == e === ?", | ||
"description": "Pergunta fácil em!", | ||
"answer": 1, | ||
"alternatives": [ | ||
".elemento", | ||
"*elemento", | ||
"#elemento", | ||
"%elemento" | ||
"São a mesma coisa", | ||
"O = significa atribuição de valor. Já == verifica a igualdade do valor, enquanto === verifica valor e tipo de variável." | ||
] | ||
}, | ||
{ | ||
"image": "https://media.giphy.com/media/13FrpeVH09Zrb2/giphy.gif", | ||
"title": "Como fazer um background gradiente com css?", | ||
"description": "Faz tempo em haha", | ||
"image": "https://media.giphy.com/media/Ie2Hs3A0uJRtK/giphy.gif", | ||
"title": "Que tipos de dados são suportados em JavaScript?", | ||
"description": "E agora? Você sabe?", | ||
"answer": 0, | ||
"alternatives": [ | ||
"background: linear-gradient(#e66465, #9198e5);", | ||
"background: gradient(#e66465, #9198e5);" | ||
"Number, String, Undefined, Null e Bool.", | ||
"Int, String, Undefined, Null e Bool." | ||
] | ||
}, | ||
{ | ||
"image": "https://media.giphy.com/media/iI4vhciiVh2b3j9sgo/giphy.gif", | ||
"title": "Qual a diferença de window e global?", | ||
"answer": 1, | ||
"alternatives": [ | ||
"São a mesma coisa", | ||
"window é o escopo global no browser, e global no node" | ||
] | ||
}, | ||
{ | ||
"image": "https://media.giphy.com/media/iI4vhciiVh2b3j9sgo/giphy.gif", | ||
"title": "Qual a forma antiga de trabalhar com AJAX na Web?", | ||
"answer": 1, | ||
"alternatives": [ | ||
"JSONHttpRequest", | ||
"XMLHttpRequest", | ||
"fetch" | ||
] | ||
} | ||
], | ||
"external": [ | ||
"" | ||
"https://aluraquiz-css.omariosouto.vercel.app/", | ||
"https://aluraquiz-devsoutinho.omariosouto.vercel.app/" | ||
], | ||
"theme": { | ||
"colors": { | ||
"primary": "#0d47a1", | ||
"secondary": "#29b6f6", | ||
"mainBg": "#171B35", | ||
"primary": "#222222", | ||
"secondary": "#e89c3f", | ||
"mainBg": "#213f4e", | ||
"contrastText": "#FFFFFF", | ||
"wrong": "#FF5722", | ||
"success": "#4CAF50" | ||
}, | ||
"borderRadius": "4px" | ||
} | ||
} | ||
} |
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,9 +1,50 @@ | ||
/* eslint-disable react/prop-types */ | ||
/* eslint-disable no-unused-vars */ | ||
import React from 'react'; | ||
import { ThemeProvider } from 'styled-components'; | ||
import QuizScreen from '../../src/screens/Quiz'; | ||
|
||
export default function QuizDaGaleraPage() { | ||
export default function QuizDaGaleraPage({ dbExterno }) { | ||
// const [db, setDb] React.useState({}) | ||
// React.useEffect(() => { | ||
// }); | ||
return ( | ||
<div> | ||
Desafio da próxima aula junto com as animações | ||
</div> | ||
<ThemeProvider theme={dbExterno.theme}> | ||
<QuizScreen | ||
externalQuestions={dbExterno.questions} | ||
externalBg={dbExterno.bg} | ||
/> | ||
</ThemeProvider> | ||
// {/* <pre style={{ color: 'black' }}> | ||
// {JSON.stringify(dbExterno.questions, null, 4)} | ||
// </pre> */} | ||
); | ||
} | ||
|
||
export async function getServerSideProps(context) { | ||
const [projectName, githubUser] = context.query.id.split('___'); | ||
|
||
try { | ||
const dbExterno = await fetch(`https://${projectName}.${githubUser}.vercel.app/api/db`) | ||
.then((respostaDoServer) => { | ||
if (respostaDoServer.ok) { | ||
return respostaDoServer.json(); | ||
} | ||
throw new Error('Falha em pegar os dados'); | ||
}) | ||
.then((respostaConvertidaEmObjeto) => respostaConvertidaEmObjeto) | ||
// .catch((err) => { | ||
// // console.error(err); | ||
// }); | ||
|
||
// console.log('dbExterno', dbExterno); | ||
// console.log('Infos que o Next da para nós', context.query.id); | ||
return { | ||
props: { | ||
dbExterno, | ||
}, | ||
}; | ||
} catch(err) { | ||
throw new Error(err); | ||
} | ||
} |
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,16 @@ | ||
/* eslint-disable react/prop-types */ | ||
import React from 'react'; | ||
import { ThemeProvider } from 'styled-components'; | ||
import QuizScreen from '../../src/screens/Quiz'; | ||
import db from '../../db.json'; | ||
|
||
export default function QuizDaGaleraPage() { | ||
return ( | ||
<ThemeProvider theme={db.theme}> | ||
<QuizScreen | ||
externalQuestions={db.questions} | ||
externalBg={db.bg} | ||
/> | ||
</ThemeProvider> | ||
); | ||
} |
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,29 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import PropTypes from 'prop-types'; | ||
import Link from '../Link'; | ||
|
||
const StyledLink = styled(Link)` | ||
transition: .3s; | ||
&:hover { | ||
opacity: .5; | ||
} | ||
`; | ||
|
||
const SVG = styled.svg` | ||
vertical-align: middle; | ||
`; | ||
|
||
export default function BackLinkArrow({ href }) { | ||
return ( | ||
<StyledLink href={href} style={{ width: '24px', height: '24px', display: 'inline-block' }}> | ||
<SVG xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"> | ||
<path fillRule="evenodd" clipRule="evenodd" d="M15.41 7.41L14 6L8 12L14 18L15.41 16.59L10.83 12L15.41 7.41Z" fill="white" fillOpacity="0.87" /> | ||
</SVG> | ||
</StyledLink> | ||
); | ||
} | ||
|
||
BackLinkArrow.propTypes = { | ||
href: PropTypes.string.isRequired, | ||
}; |
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,13 @@ | ||
import React from 'react'; | ||
import NextLink from 'next/link'; | ||
|
||
export default function Link({ children, href, ...props }) { | ||
return ( | ||
<NextLink href={href} passHref> | ||
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} | ||
<a {...props}> | ||
{children} | ||
</a> | ||
</NextLink> | ||
); | ||
} |
Oops, something went wrong.
7c4e704
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.
Successfully deployed to the following URLs: