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

Week 10 - Zoe & Kelly #86

Open
wants to merge 64 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
0f1ea33
initial commit
zoe-lindqvist Oct 15, 2024
55aa0eb
initial commit
zoe-lindqvist Oct 15, 2024
66f8112
initial commit
zoe-lindqvist Oct 15, 2024
bd126fd
components
zoe-lindqvist Oct 15, 2024
3f24b5f
App
zoe-lindqvist Oct 15, 2024
d4d8398
Add photos
jacquelinekellyhunt Oct 15, 2024
b71d636
preliminary logic
zoe-lindqvist Oct 16, 2024
7de5646
Merge branch 'main' of https://github.com/zoe-lindqvist/project-surve…
zoe-lindqvist Oct 16, 2024
d509a3d
Merged zoeBranch into main
zoe-lindqvist Oct 16, 2024
c64358b
Add a star
jacquelinekellyhunt Oct 16, 2024
b2dd5f8
Add confirmation page
jacquelinekellyhunt Oct 16, 2024
310be4e
Add organising of folder
jacquelinekellyhunt Oct 16, 2024
5dca520
Edit welcome page
jacquelinekellyhunt Oct 16, 2024
a7ca32d
Merge pull request #1 from zoe-lindqvist/addStar
zoe-lindqvist Oct 16, 2024
bad1ef1
Add nice welcome page
jacquelinekellyhunt Oct 16, 2024
39dce0d
Resize the text
jacquelinekellyhunt Oct 16, 2024
843bbc0
Merge pull request #2 from zoe-lindqvist/heroimage
jacquelinekellyhunt Oct 16, 2024
45c0e82
questionsHeader
zoe-lindqvist Oct 16, 2024
f69fd50
Merge pull request #3 from zoe-lindqvist/questionHeader
jacquelinekellyhunt Oct 16, 2024
f42b16e
Add first question
jacquelinekellyhunt Oct 16, 2024
4710826
Merge branch 'main' into question
jacquelinekellyhunt Oct 16, 2024
1b8c3b5
Merge pull request #4 from zoe-lindqvist/question
zoe-lindqvist Oct 16, 2024
3bc113e
Clean
jacquelinekellyhunt Oct 16, 2024
14d33b5
Merge pull request #5 from zoe-lindqvist/clean
zoe-lindqvist Oct 16, 2024
d65ab62
confirmation HTML
zoe-lindqvist Oct 16, 2024
82ddbb7
Merge pull request #6 from zoe-lindqvist/semanticHTML
zoe-lindqvist Oct 16, 2024
328ebab
color contrast - accessibility
zoe-lindqvist Oct 16, 2024
0e471a6
semantic structure + aria labels
zoe-lindqvist Oct 16, 2024
d0515aa
centered container to be responsive on small screens
zoe-lindqvist Oct 16, 2024
a7e389a
Merge pull request #7 from zoe-lindqvist/colorContrast
jacquelinekellyhunt Oct 16, 2024
53f5f79
Merge pull request #9 from zoe-lindqvist/responsiveDesign
jacquelinekellyhunt Oct 16, 2024
885d738
Merge pull request #8 from zoe-lindqvist/semanticHTML
jacquelinekellyhunt Oct 16, 2024
fa9a7e7
Resolve errors
jacquelinekellyhunt Oct 16, 2024
5443ae9
Rebasing
jacquelinekellyhunt Oct 16, 2024
018136e
Add a second question
jacquelinekellyhunt Oct 17, 2024
fdd512c
Merge pull request #10 from zoe-lindqvist/restructure
zoe-lindqvist Oct 17, 2024
12a2e23
QuestionThree
zoe-lindqvist Oct 17, 2024
57e0ad3
question3
zoe-lindqvist Oct 17, 2024
88a649f
test
zoe-lindqvist Oct 18, 2024
929bbb8
Question 2
jacquelinekellyhunt Oct 18, 2024
277015d
Merge pull request #12 from zoe-lindqvist/restructure
jacquelinekellyhunt Oct 18, 2024
bc29986
Change color
jacquelinekellyhunt Oct 18, 2024
b435814
Merge pull request #11 from zoe-lindqvist/zoeQuestions
jacquelinekellyhunt Oct 18, 2024
487a358
change color
zoe-lindqvist Oct 18, 2024
ae30a0e
question 4
zoe-lindqvist Oct 18, 2024
570a99c
Merge pull request #13 from zoe-lindqvist/questionThreeFour
jacquelinekellyhunt Oct 18, 2024
3e8b2d3
question 5
zoe-lindqvist Oct 18, 2024
2345e87
Merge pull request #14 from zoe-lindqvist/questionThreeFour
jacquelinekellyhunt Oct 18, 2024
f26f0a8
question 6
zoe-lindqvist Oct 18, 2024
e4ec9f1
Merge pull request #15 from zoe-lindqvist/questionThreeFour
zoe-lindqvist Oct 18, 2024
0760148
question 7
zoe-lindqvist Oct 18, 2024
95276be
Merge pull request #16 from zoe-lindqvist/questionThreeFour
jacquelinekellyhunt Oct 20, 2024
78998d4
Question eight
jacquelinekellyhunt Oct 20, 2024
f708e74
Final push
jacquelinekellyhunt Oct 20, 2024
e375256
Progress bar bug
jacquelinekellyhunt Oct 20, 2024
c6673b9
Merge pull request #17 from zoe-lindqvist/progress_bar
zoe-lindqvist Oct 20, 2024
e184137
Update Header.jsx
zoe-lindqvist Oct 20, 2024
ea69bf8
Update Header.jsx
zoe-lindqvist Oct 20, 2024
cd9754f
header
zoe-lindqvist Oct 20, 2024
f95fd74
header
zoe-lindqvist Oct 20, 2024
68d5bf6
responsive
zoe-lindqvist Oct 20, 2024
7591a4c
Merge pull request #18 from zoe-lindqvist/Z
jacquelinekellyhunt Oct 21, 2024
b5fa7ac
Fix media queries
jacquelinekellyhunt Oct 22, 2024
10a9cc2
Merge pull request #19 from zoe-lindqvist/media
zoe-lindqvist Oct 22, 2024
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
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Survey - Project - Week 6</title>
<title>Survey - Project</title>
</head>
<body>
<div id="root"></div>
Expand Down
11 changes: 9 additions & 2 deletions instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ You don't have to use a lot of components to start with when doing this project.
How you design your page is up to you, but take accessibility into account when you are styling your form elements - so inputs should have labels and should be easily readable and usable. We STRONGLY recommend having some kind of design or sketch before starting to code.

## How to get started

1. **Person A** forks the repo
2. **Person A** invites person B as a collaborator to the repo (Settings -> Collaborators and teams -> Add people)
3. **Person A** clones the repo
Expand All @@ -24,6 +25,7 @@ How you design your page is up to you, but take accessibility into account when
7. When you're done with a feature, it's time to merge! You choose if you want to work with PRs and code reviews or if you want to do this more verbally before you merge.

## Requirements:

- Your app should consist of at least 3 questions.
- At least one question should use radio buttons.
- At least one question should use a select dropdown.
Expand All @@ -37,31 +39,35 @@ How you design your page is up to you, but take accessibility into account when
- Make your app responsive (it should look good on devices from 320px width up to 1600px)

## Stretch goals

So you’ve completed the requirements? Great job! Ensure you've committed and pushed a version of your project before starting on the stretch goals. Remember that the stretch goals are optional.

### Intermediate Stretch Goals

- Use a form element you haven't tried before (such as a [range slider](https://www.w3schools.com/howto/howto_js_rangeslider.asp)) and connect it to React state. You can find a list of input types [here](https://www.w3schools.com/html/html_form_input_types.asp).
- Add validation to your survey! Use either HTML input validation attributes (such as `required`) or implement custom logic when the user clicks the submit button to make the form fields have validations. If you choose to implement your own validation, you should also make sure to show error messages in a nice way.
- Create a button that, when clicked, will scroll down to the top of the next question in the survey (if possible)

### Advanced Stretch Goals

- Visualize to the user how far through the survey they are and how much is left by creating a progress bar
- Use Regex validation for some input on your survey
- Show different questions depending on the answer to a specific question
- Create a multi-step form. Example 👇
Show each question on its own 'page' with a continue button to progress to the next question (like how typeform does it). If you decide to split your form into sections, then one approach you could take is to try to think of these sections as a single `useState` hook which you can use to conditionally render different groups of inputs. For example, you could have some state like `const [section, setSection] = useState('firstQuestion')` and then when the user presses a button to progress, you'd use the `setSection()` function to progress them to the second question, etc. Then, in your JSX, you could conditionally render, like this:

```
const Example = () => {
const [section, setSection] = useState('firstQuestion')

return (
<div>
{section === 'firstQuestion' && (
<div>
First question...
</div>
)}

{section === 'secondQuestion' && (
<div>
Second question...
Expand All @@ -71,4 +77,5 @@ So you’ve completed the requirements? Great job! Ensure you've committed and p
)
}
```

As always, there are many ways to approach this! This is just one suggestion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand All @@ -21,6 +22,6 @@
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"vite": "^4.4.5"
"vite": "^4.5.5"
}
}
13 changes: 13 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
html,
body {
margin: 0;
padding: 0;
height: 100%;
overflow-y: auto;
}

body {
width: 100vw;
height: 100vh;
overflow-y: auto;
}
71 changes: 69 additions & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,70 @@
export const App = () => {
return <div>Find me in src/app.jsx!</div>;
/* eslint-disable no-unused-vars */
import React, { useState } from "react";
import WelcomePage from "./components/WelcomeFolder/WelcomePage.jsx";
import QuestionOne from "./components/QuestionOne/QuestionOne";
import QuestionTwo from "./components/QuestionTwo/QuestionTwo.jsx";
import QuestionThree from "./components/QuestionThree/QuestionThree.jsx";
import QuestionFour from "./components/QuestionFour/QuestionFour.jsx";
import QuestionFive from "./components/QuestionFive/QuestionFive.jsx";
import QuestionSix from "./components/QuestionSix/QuestionSix.jsx";
import QuestionSeven from "./components/QuestionSeven/QuestionSeven.jsx";
import QuestionEight from "./components/QuestionEight/QuestionEight.jsx";
import ConfirmationPage from "./components/ConfirmationFolder/ConfirmationPage.jsx";

import "./App.css";

const App = () => {
const [startQuiz, setStartQuiz] = useState(false);
const [currentQuestion, setCurrentQuestion] = useState(0);
const [score, setScore] = useState(160);

const handleStartQuiz = () => {
setStartQuiz(true);
};

const handleNextQuestion = () => {
setCurrentQuestion(currentQuestion + 1);
};

const handleScoreChange = (pointsToDeduct) => {
setScore(score - pointsToDeduct); // This is for the passing down the function to handle the end score
};

return (
<div className="App">
{!startQuiz ? (
<WelcomePage onStartQuiz={handleStartQuiz} />
) : (
<>
{currentQuestion === 0 && (
<QuestionOne onNext={handleNextQuestion} onScoreChange={handleScoreChange} />
)}
{currentQuestion === 1 && (
<QuestionTwo onNext={handleNextQuestion} onScoreChange={handleScoreChange} />
)}
{currentQuestion === 2 && (
<QuestionThree onNext={handleNextQuestion} onScoreChange={handleScoreChange} />
)}
{currentQuestion === 3 && (
<QuestionFour onNext={handleNextQuestion} onScoreChange={handleScoreChange} />
)}
{currentQuestion === 4 && (
<QuestionFive onNext={handleNextQuestion} onScoreChange={handleScoreChange} />
)}
{currentQuestion === 5 && (
<QuestionSix onNext={handleNextQuestion} onScoreChange={handleScoreChange} />
)}
{currentQuestion === 6 && (
<QuestionSeven onNext={handleNextQuestion} onScoreChange={handleScoreChange} />
)}
{currentQuestion === 7 && (
<QuestionEight onNext={handleNextQuestion} onScoreChange={handleScoreChange} />
)}
{currentQuestion === 8 && <ConfirmationPage score={score} />}
</>
)}
</div>
);
};

export default App;
Binary file added src/assets/background.jpeg
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 src/assets/bird.jpeg
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 src/assets/dolphin.png
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 src/assets/fox.jpeg
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 src/assets/frog.png
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 src/assets/koala.jpeg
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 src/assets/lightning.png
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 src/assets/lion.jpeg
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 src/assets/logo.png
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 src/assets/negative.png
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 src/assets/otter.jpeg
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 src/assets/panda.jpeg
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 src/assets/positive.png
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 src/assets/search.png
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 src/assets/star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 84 additions & 0 deletions src/components/ConfirmationFolder/ConfirmationPage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
.confirmation-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh; /* Allow the container to grow */
background-color: #ffffff;
text-align: center;
overflow-y: auto; /* Enable vertical scrolling */
padding: 20px; /* Add padding for small screens */
}

.confirmation-logo {
width: 120px;
margin-bottom: 20px;
}

.confirmation-star {
width: 400px;
height: auto;
margin-bottom: 20px;
}

.confirmation-title {
font-size: 36px;
font-weight: bold;
color: #2c2c2c;
margin-bottom: 10px;
}

.confirmation-subtitle {
font-size: 18px;
color: #7f7f7f;
margin-bottom: 30px;
}

.score-box {
background-color: #f9f4e7;
border-radius: 20px;
padding: 10px 30px;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
color: #2c2c2c;
}

.score {
display: flex;
align-items: center;
}

/* Media queries for smaller screens */
@media (max-width: 768px) {

Choose a reason for hiding this comment

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

Consider mobile first design maybe it is good to do oppisite by setting min-width?

.confirmation-container {
padding: 15px; /* Adjust padding for medium screens */
}

.confirmation-star {
width: 300px; /* Reduce star size for medium screens */
}

.confirmation-title {
font-size: 30px; /* Adjust title size */
}
}

@media (max-width: 480px) {
.confirmation-container {
padding: 10px; /* Reduce padding for small screens */
}

.confirmation-star {
width: 250px; /* Further reduce star size for small screens */
}

.confirmation-title {
font-size: 24px; /* Further reduce title size */
}

.confirmation-subtitle {
font-size: 16px; /* Adjust subtitle size */
}
}
38 changes: 38 additions & 0 deletions src/components/ConfirmationFolder/ConfirmationPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React from 'react';
import './ConfirmationPage.css';
import starImage from '../../assets/star.png';
import logoImage from '../../assets/logo.png';

const ConfirmationPage = ({ score }) => {
let title = "";
let subtitle = "";

// Determine the title and subtitle based on the score
if (score < 40) {
title = "Good Effort!";
subtitle = "Maybe next time is the charm!";
} else if (score >= 40 && score < 80) {
title = "Nice job!";
subtitle = "Good to have an animal lover among us!";
} else if (score >= 80 && score < 120) {
title = "Good job!";
subtitle = "Almost a perfect score, what an expert!";
} else {
title = "Perfect Scorer!";
subtitle = "Your flawless quiz performance sets a new standard of excellence!";
}
Comment on lines +11 to +23

Choose a reason for hiding this comment

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

Cool! I'm curious about what the full score is. 👍


return (
<div className="confirmation-container">
<img src={logoImage} alt="Quiz Logo" className="confirmation-logo" />
<img src={starImage} alt="Star" className="confirmation-star" />
<h1 className="confirmation-title">{title}</h1>
<p className="confirmation-subtitle">{subtitle}</p>
<div className="score-box">
<span className="score">{score} points</span>
</div>
</div>
);
};

export default ConfirmationPage;
28 changes: 28 additions & 0 deletions src/components/HeaderFolder/Header.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.Header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 30px;
background-color: rgba(255, 255, 255, 0.7);
height: 50px;
border-radius: 50px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
width: 80vw;
margin: 20px auto;
}

.logo {
height: 50px;
}

.search-icon {
height: 20px;
cursor: pointer;
}

.search-button {
background: none;
border: none;
padding: 0;
cursor: pointer;
}
19 changes: 19 additions & 0 deletions src/components/HeaderFolder/Header.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// eslint-disable-next-line no-unused-vars
import React from "react";
import logo from "../../assets/logo.png";
import searchIcon from "../../assets/search.png";
import "./Header.css";

const Header = () => {
return (
<header className="Header" aria-label="Main header">
<img src={logo} alt="Paw Pops Logo" className="logo" />

<button className="search-button" aria-label="Search">
<img src={searchIcon} alt="" className="search-icon" />
Comment on lines +12 to +13

Choose a reason for hiding this comment

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

It seems that the search function is not active. Would like to see how it works!

</button>
</header>
);
};

export default Header;
Loading