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

Oscar's Project Survey #448

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions code/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Technigo React App</title>
<title>Oscar's Technigo React App</title>
</head>

<body>
Expand Down
49 changes: 44 additions & 5 deletions code/src/App.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,48 @@
import React from 'react';
/* eslint-disable linebreak-style */
/* eslint-disable global-require */
/* eslint-disable react-hooks/rules-of-hooks */
import React, { useState } from 'react';
import { Movie } from 'components/Movie';
import { Show } from 'components/Show';
import { Name } from './components/Name'
import { Results } from './components/Results';
import { Genre } from './components/Genre';

export const App = () => {
const [step, setStep] = useState(1)
const [name, setName] = useState('')
const [genre, setGenre] = useState('')
const [movie, setMovie] = useState('')
const [show, setShow] = useState('')

const handleStepIncrease = () => {
setStep(step + 1)
}

return (
<div>
Find me in src/app.js!
</div>
);
<form className="surveyForm">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you made a form instead of a div here, how come?
Also, if you want to style it so that it's not as wide you can specify that with the max-width or width in the CSS.

{step === 1 && (
<Name name={name} setName={setName} />
)}
{step === 2 && (
<Genre genre={genre} setGenre={setGenre} />
)}
{step === 3 && (
<Movie movie={movie} setMovie={setMovie} />
)}
{step === 4 && (
<Show show={show} setShow={setShow} />
)}
{step >= 5 && (
<Results name={name} genre={genre} movie={movie} show={show} />
)}

{step < 5 && (
<>
<p>Current page: {step} </p>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a nice feature that you the user could see which step they were on.

<button type="button" onClick={handleStepIncrease}>Next</button>
</>
)}
</form>
)
}
Binary file added code/src/components/Assets/aot.jpg

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I LOVE ATTACK ON TITAN! I was so happy to see it among the options! Hahah!

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/src/components/Assets/arrival.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/src/components/Assets/game-night.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/src/components/Assets/love-actually.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/src/components/Assets/mad-men.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/src/components/Assets/movies-background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/src/components/Assets/new-girl.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/src/components/Assets/normal-people.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions code/src/components/Genre.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.genreDropdown {
display: flex;
justify-content: center;
}
55 changes: 55 additions & 0 deletions code/src/components/Genre.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* eslint-disable linebreak-style */
import React from 'react'
import './Genre.css'

export const Genre = ({ genre, setGenre }) => {
const handleGenreChange = (event) => {
setGenre(event.target.value)
}
return (
<>
<div className="genrePrompt">
<h3>What is your favorite genre of movie/tv show?</h3>
</div>
<div className="genreDropdown">
<select
value={genre}
onChange={handleGenreChange}>
<option disabled value="">Select your fav!</option>
<option value="Action">Action</option>
<option value="Drama">Drama</option>
<option value="Comedy">Comedy</option>
<option value="Romance">Romance</option>
</select>

</div>
</>
)
}

/*

const options = [
{ value: 'action', label: 'Action' },
{ value: 'drama', label: 'Drama' },
{ value: 'comedy', label: 'Comedy' },
{ value: 'romance', label: 'Romance' }
]

export const Genre = ({ genre, setGenre }) => {
const handleGenreChange = (event) => {
setGenre(event.target.value)
}
return (
<div className="genreDropdown">
<select
value={genre}
onChange={handleGenreChange}>
{options.map((option) => (
value={option.value}
label={option.label}
))}
</select>
</div>
)
} */
30 changes: 30 additions & 0 deletions code/src/components/Movie.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.movieFav {
display: flex;
justify-content: space-around;
flex-direction: column;
margin: 1rem;
gap: 1rem;
padding: 1rem;
object-fit: contain;
}

.arrival img {
display: flex;
width: 200px;
height: 250px;
}
.loveActually img {
display: flex;
width: 200px;
height: 250px;
}
.eeaao img {
display: flex;
width: 200px;
height: 250px;
}
.gameNight img {
display: flex;
width: 200px;
height: 250px;
}
40 changes: 40 additions & 0 deletions code/src/components/Movie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* eslint-disable linebreak-style */
/* eslint-disable global-require */
import React from 'react'
import './Movie.css'

export const Movie = ({ movie, setMovie }) => {
const handleMovieChange = (event) => (
setMovie(event.target.value)
)
return (
<>
<h3 className="moviePrompt">What is your favorite movie?</h3>
<form
className="movieFav"
value={movie}
onChange={handleMovieChange}>
<div className="arrival">
<img src={require('./Assets/arrival.jpg')} alt="Arrival Movie" />
<input type="radio" value="Arrival" />
Arrival
</div>
<div className="loveActually">
<img src={require('./Assets/love-actually.jpg')} alt="Love Actually Movie" />
<input type="radio" value="Love Actually" />
Love Actually
</div>
<div className="eeaao">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the name of this div! Hahah! Such a long movie title!

<img src={require('./Assets/everything-everywhere.jpg')} alt="Everything, Everywhere, All at Once Movie" />
<input type="radio" value="Everything, Everywhere, All At Once" />
Everything, Everywhere, All At Once
</div>
<div className="gameNight">
<img src={require('./Assets/game-night.jpg')} alt="Game Night Movie" />
<input type="radio" value="Game Night" />
Game Night
</div>
</form>
</>
)
}
Empty file added code/src/components/Name.css
Empty file.
17 changes: 17 additions & 0 deletions code/src/components/Name.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-disable linebreak-style */
import React from 'react'

export const Name = ({ name, setName }) => {
const handleNameChange = (event) => {
setName(event.target.value)
event.preventDefault()
}
return (
<>
<h3>What is your name?</h3>
<input type="text" value={name} onChange={handleNameChange} />
</>

)
}

Empty file added code/src/components/Results.css
Empty file.
14 changes: 14 additions & 0 deletions code/src/components/Results.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* eslint-disable linebreak-style */
import React from 'react'

export const Results = ({ name, genre, movie, show }) => {
return (
<>
<h3>Final Results!</h3>
<p className="textResults">Hey {name}</p>
<p className="textResults">Your favorite genre is {genre}</p>
<p className="textResults">Your favorite movie (from this selection) is {movie}</p>
<p className="textResults">Your favorite show is {show}</p>
</>
)
}
33 changes: 33 additions & 0 deletions code/src/components/Show.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.showFav {
display: flex;
justify-content: space-around;
flex-direction: column;
margin: 1rem;
gap: 1rem;
padding: 1rem;
object-fit: contain;
}

.normalPeople img {
display: flex;
width: 200px;
height: 250px;
}

.madMen img {
display: flex;
width: 200px;
height: 250px;
}

.newGirl img {
display: flex;
width: 200px;
height: 250px;
}

.attackOnTitan img {
display: flex;
width: 200px;
height: 250px;
}
40 changes: 40 additions & 0 deletions code/src/components/Show.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* eslint-disable linebreak-style */
/* eslint-disable global-require */
import React from 'react'
import './Show.css'

export const Show = ({ show, setShow }) => {
const handleShowChange = (event) => (
setShow(event.target.value)
)
return (
<>
<h3 className="showPrompt">What is your favorite show?</h3>
<form
className="showFav"
value={show}
onChange={handleShowChange}>
<div className="normalPeople">
<img src={require('./Assets/normal-people.jpg')} alt="The show Normal People" />
<input type="radio" value="Normal People" />
Normal People
</div>
<div className="newGirl">
<img src={require('./Assets/new-girl.jpg')} alt="The show New Girl" />
<input type="radio" value="New Girl" />
New Girl
</div>
<div className="madMen">
<img src={require('./Assets/mad-men.jpg')} alt="The show Mad Men" />
<input type="radio" value="Mad Men" />
Mad Men
</div>
<div className="attackOnTitan">
<img src={require('./Assets/aot.jpg')} alt="The show Attack on Titan" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "require" mean in this context? I've never seen it before!

<input type="radio" value="Attack On Titan" />
Attack on Titan
</div>
</form>
</>
)
}
Loading