Skip to content
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

Adding Alura's Immersion project to the showcase #319

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
build
  • Loading branch information
bentoco committed Jan 28, 2021
commit cf975969aebcf232b52ab10dcd22c836a410ffd0
25 changes: 0 additions & 25 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = {
<<<<<<< HEAD
env: {
browser: true,
es2021: true,
Expand All @@ -17,27 +16,3 @@ module.exports = {
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
},
}
=======
env: {
browser: true,
es2021: true,
},
extends: [
'plugin:react/recommended',
'airbnb',
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: 'module',
},
plugins: [
'react',
],
rules: {
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
},
};
>>>>>>> e72dad3391c47cc8604eba44f6dbe99d56a1d2cd
29 changes: 0 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
<<<<<<< HEAD
"name": "tibia-quizz",
"version": "1.0.1",
"scripts": {
Expand All @@ -24,32 +23,4 @@
"eslint-plugin-react-hooks": "^4.2.0"
},
"license": "MIT"
=======
"name": "aluraquiz-base",
"version": "1.0.1",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"eslint:init": "eslint --init",
"lint": "eslint ./ --fix"
},
"dependencies": {
"next": "latest",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react-is": "^16.8.0",
"styled-components": "^5.0.0"
},
"devDependencies": {
"babel-plugin-styled-components": "^1.8.0",
"eslint": "^7.16.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0"
},
"license": "MIT"
>>>>>>> e72dad3391c47cc8604eba44f6dbe99d56a1d2cd
}
11 changes: 5 additions & 6 deletions pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import { createGlobalStyle, ThemeProvider } from 'styled-components';
import Head from 'next/head';
import db from '../db.json';
import React from 'react'
import { createGlobalStyle, ThemeProvider } from 'styled-components'
import db from '../db.json'

const GlobalStyle = createGlobalStyle`
* {
Expand All @@ -25,9 +24,9 @@ const GlobalStyle = createGlobalStyle`
display: flex;
flex-direction: column;
}
`;
`

const { theme } = db;
const { theme } = db

// eslint-disable-next-line react/prop-types
export default function App({ Component, pageProps }) {
Expand Down
28 changes: 0 additions & 28 deletions pages/_document.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<<<<<<< HEAD
import Document, {
DocumentInitialProps,
DocumentContext,
Expand Down Expand Up @@ -50,32 +49,5 @@ export default class MyDocument extends Document {
</body>
</Html>
)
=======
import Document from 'next/document';
import { ServerStyleSheet } from 'styled-components';

export default class MyDocument extends Document {
static async getInitialProps(ctx) {
const sheet = new ServerStyleSheet();
const originalRenderPage = ctx.renderPage;

try {
ctx.renderPage = () => originalRenderPage({
enhanceApp: (App) => (props) => sheet.collectStyles(<App {...props} />),
});

const initialProps = await Document.getInitialProps(ctx);
return {
...initialProps,
styles: (
<>
{initialProps.styles}
{sheet.getStyleElement()}
</>
),
};
} finally {
sheet.seal();
>>>>>>> e72dad3391c47cc8604eba44f6dbe99d56a1d2cd
}
}
65 changes: 0 additions & 65 deletions pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<<<<<<< HEAD
import Head from 'next/head'
import { useRouter } from 'next/router'

Expand All @@ -11,27 +10,11 @@ import Widget from '../src/components/Widget'
import Input from '../src/components/Input'
import Button from '../src/components/Button'
import QuizContainer from '../src/components/QuizContainer'
=======
import React from 'react';
import styled from 'styled-components';
import Head from 'next/head';
import { useRouter } from 'next/router';

import db from '../db.json';
import Widget from '../src/components/Widget';
import QuizLogo from '../src/components/QuizLogo';
import QuizBackground from '../src/components/QuizBackground';
import Footer from '../src/components/Footer';
import GitHubCorner from '../src/components/GitHubCorner';
import Input from '../src/components/Input';
import Button from '../src/components/Button';
>>>>>>> e72dad3391c47cc8604eba44f6dbe99d56a1d2cd

export default function Home() {
const router = useRouter()
const [name, setName] = React.useState('')

<<<<<<< HEAD
const handleSubmit = (e) => {
e.preventDefault()
router.push(`/quiz?name=${name}`)
Expand All @@ -41,54 +24,6 @@ export default function Home() {
e.preventDefault()
setName(e.target.value)
}
=======
const QuizContainer = styled.div`
width: 100%;
max-width: 350px;
padding-top: 45px;
margin: auto 10%;
@media screen and (max-width: 500px) {
margin: auto;
padding: 15px;
}
`;

export default function Home() {
const router = useRouter();
const [name, setName] = React.useState('');

return (
<QuizBackground backgroundImage={db.bg}>
<Head>
<title>{db.title}</title>
</Head>
<QuizContainer>
<QuizLogo />
<Widget>
<Widget.Header>
<h1>{db.title}</h1>
</Widget.Header>
<Widget.Content>
<p>{db.description}</p>
<form onSubmit={function (infosDoEvento) {
infosDoEvento.preventDefault();
router.push(`/quiz?name=${name}`);
console.log('Fazendo uma submissão por meio do react');
}}
>
<Input
name="nomeDoUsuario"
onChange={(infosDoEvento) => setName(infosDoEvento.target.value)}
placeholder="Diz ai seu nome"
value={name}
/>
<Button type="submit" disabled={name.length === 0}>
{`Jogar ${name}`}
</Button>
</form>
</Widget.Content>
</Widget>
>>>>>>> e72dad3391c47cc8604eba44f6dbe99d56a1d2cd

return (
<QuizBackground backgroundImage={db.bg}>
Expand Down
39 changes: 0 additions & 39 deletions src/components/Button/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<<<<<<< HEAD
import PropTypes from 'prop-types'
import styled from 'styled-components'

Expand Down Expand Up @@ -32,41 +31,3 @@ Button.propTypes = {
}

export default Button
=======
import PropTypes from 'prop-types';
import styled from 'styled-components';

const Button = styled.button`
background-color: ${({ theme }) => theme.colors.secondary};
color: ${({ theme }) => theme.colors.contrastText};
border-radius: ${({ theme }) => theme.borderRadius};
border: 0;

width: 100%;
padding: 10px 16px;
font-weight: bold;
font-size: 14px;
line-height: 1;
text-transform: uppercase;
outline: 0;
transition: .3s;
cursor: pointer;

&:hover,
&:focus {
opacity: .5;
}

&:disabled {
background-color: #979797;
cursor: not-allowed;
}
`;

Button.propTypes = {
type: PropTypes.oneOf(['submit', 'type', 'button']).isRequired,
children: PropTypes.node.isRequired,
};

export default Button;
>>>>>>> e72dad3391c47cc8604eba44f6dbe99d56a1d2cd
22 changes: 1 addition & 21 deletions src/components/Footer/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from 'styled-components';
import styled from 'styled-components'

// src/components/Footer/index.js
const FooterWrapper = styled.footer`
Expand Down Expand Up @@ -26,7 +26,6 @@ const FooterWrapper = styled.footer`
`

export default function Footer(props) {
<<<<<<< HEAD
return (
// eslint-disable-next-line react/jsx-props-no-spreading
<FooterWrapper {...props}>
Expand All @@ -44,23 +43,4 @@ export default function Footer(props) {
</p>
</FooterWrapper>
)
=======
return (
// eslint-disable-next-line react/jsx-props-no-spreading
<FooterWrapper {...props}>
<a href="https://www.alura.com.br/">
<img src="https://www.alura.com.br/assets/img/alura-logo-white.1570550707.svg" alt="Logo Alura" />
</a>
<p>
Orgulhosamente criado durante
{' '}
a
{' '}
<a href="https://www.alura.com.br/">
<span>Imersão React da Alura</span>
</a>
</p>
</FooterWrapper>
);
>>>>>>> e72dad3391c47cc8604eba44f6dbe99d56a1d2cd
}
17 changes: 0 additions & 17 deletions src/components/QuizContainer/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<<<<<<< HEAD
import styled from 'styled-components'

const QuizContainer = styled.div`
Expand All @@ -12,19 +11,3 @@ const QuizContainer = styled.div`
}
`
export default QuizContainer
=======
import styled from 'styled-components';

const QuizContainer = styled.div`
width: 100%;
max-width: 350px;
padding-top: 45px;
margin: auto 10%;
@media screen and (max-width: 500px) {
margin: auto;
padding: 15px;
}
`;

export default QuizContainer;
>>>>>>> e72dad3391c47cc8604eba44f6dbe99d56a1d2cd
Loading