-
Notifications
You must be signed in to change notification settings - Fork 435
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
project survey week 6 #441
Open
SandraMadeleine
wants to merge
26
commits into
Technigo:master
Choose a base branch
from
SandraMadeleine:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
87e2ac8
started with components
SandraMadeleine 3c81e11
fixing some ESlint-objections
SandraMadeleine 3ac8e59
minor changes
SandraMadeleine 20964d0
working on the survey in different components
SandraMadeleine ea81975
buildning the page
SandraMadeleine 00a249c
working on the survey build
SandraMadeleine 65733d5
adding to app.js
SandraMadeleine ecc1217
fixing components
SandraMadeleine b05160f
fixes
SandraMadeleine 8e1c190
fixed imports
SandraMadeleine 1d9c1e6
final fixes on survey steps
SandraMadeleine 7b38d31
working on styling
SandraMadeleine dd16219
continued styling
SandraMadeleine 3618a1f
continued styling
SandraMadeleine 5527881
css and emojis
SandraMadeleine 166c27b
media queries
SandraMadeleine 142247f
finalizing layout
SandraMadeleine d870236
last touches
SandraMadeleine 589c5c8
readme updated
SandraMadeleine f3c9ad3
switched places of imports in app.js
SandraMadeleine 9b5e7a6
fixed typo
SandraMadeleine a893e34
disable eslint in app.js in hope of being able to deploy
SandraMadeleine 2b14d3d
deleted App.js
SandraMadeleine 3627cd4
Added App.js back again
SandraMadeleine c7021d5
trying to fix case sensitivity
SandraMadeleine dcada88
add netlify link
SandraMadeleine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,13 +1,11 @@ | ||
# Survey form with React | ||
|
||
Replace this readme with your own information about your project. | ||
|
||
Start by briefly describing the assignment in a sentence or two. Keep it short and to the point. | ||
A survey made in React, using different types of forms and summarizing the answers in the final step. | ||
|
||
## The problem | ||
|
||
Describe how you approached to problem, and what tools and techniques you used to solve it. How did you plan? What technologies did you use? If you had more time, what would be next? | ||
The major hurdle while constructing this survey was to place everything correctly on the page. If I had more time I would place the buttons better and would also add some sort of counter, so that the respondent can see how many steps they have completed and how many steps are left. | ||
|
||
## View it live | ||
|
||
Every project should be deployed somewhere. Be sure to include the link to the deployed project so that the viewer can click around and see what it's all about. | ||
https://at-the-cafe-survey.netlify.app/ |
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 @@ | ||
Stack trace: | ||
Frame Function Args | ||
000FFFFCD30 00210062B0E (0021028A770, 00210275E51, 00000000001, 000FFFFB710) | ||
000FFFFCD30 0021004846A (00210000000, 00200000000, 00000000000, 00000000001) | ||
000FFFFCD30 002100484A2 (000006D0000, 000006D0101, 00000000001, CC19CA85FF21) | ||
000FFFFCD30 0021006E496 (00210045323, 00210358BC0, 00000000000, 0000000000D) | ||
000FFFFCD30 0021006E4A9 (00210045170, 0021023D7E0, 002100448F2, 000FFFFC910) | ||
000FFFFCD30 00210070DE4 (00000000013, 00000000001, 000FFFFC910, 00210278640) | ||
000FFFFCD30 0021005AB65 (000FFFFCA60, 00000000000, 000FFFFCA68, 000FFFFFFFF) | ||
000FFFFCD30 0021005B335 (00210358550, 00000000000, 000FFFFCD30, 00000100201) | ||
000FFFFCD30 0021005B847 (002100DF73E, 00000000000, 00000000000, 00000000000) | ||
000FFFFCD30 0021005BB86 (00000000000, 000FFFFCD30, FFFFFFFFFFFFFFC6, 00000000000) | ||
000FFFFCD30 00210048C0C (00000000000, 00000000000, 00000000000, 00000000000) | ||
000FFFFFFF0 00210047716 (00000000000, 00000000000, 00000000000, 00000000000) | ||
000FFFFFFF0 002100477C4 (00000000000, 00000000000, 00000000000, 00000000000) | ||
End of stack trace |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,106 @@ | ||
import React from 'react'; | ||
import React, { useState } from 'react'; | ||
import Start from './components/Start'; | ||
import Subscription from './components/Subscription'; | ||
import Purchase from './components/Purchase'; | ||
import FreeText from './components/FreeText'; | ||
import Conclusion from './components/Conclusion'; | ||
import Footer from './components/Footer'; | ||
import './index.css' | ||
|
||
export const App = () => { | ||
const [step, setStep] = useState(1) | ||
const [purchase, setPurchase] = useState('') | ||
const [subscriptionQ, setSubscriptionQ] = useState('') | ||
const [often, setOften] = useState('') | ||
const [missing, setMissing] = useState('') | ||
|
||
const handleStepIncrease = () => { | ||
setStep(step + 1) | ||
} | ||
|
||
const handleStepDecrease = () => { | ||
setStep(step - 1) | ||
} | ||
|
||
const handleStepRestart = () => { | ||
setStep(1) | ||
} | ||
|
||
return ( | ||
<div> | ||
Find me in src/app.js! | ||
</div> | ||
<> | ||
<div className="outer-part"> | ||
<div className="inner-part"> | ||
{step === 1 && ( | ||
<div> | ||
<Start /> | ||
<button className="start-btn" type="button" onClick={handleStepIncrease}>Start here</button> | ||
</div> | ||
)} | ||
|
||
{step === 2 && ( | ||
<Subscription subscriptionQ={subscriptionQ} setSubscriptionQ={setSubscriptionQ} /> | ||
)} | ||
|
||
{step === 3 && ( | ||
<Purchase purchase={purchase} setPurchase={setPurchase} /> | ||
)} | ||
|
||
{step === 4 && ( | ||
<div> | ||
<FreeText | ||
headline="Favorite purchases" | ||
input={often} | ||
setInput={setOften} | ||
inputLabel="Which drink do you purchase most often when at a cafe? 💸" | ||
id="favorite-purchase" | ||
placeholder="My favorite purchase is..." | ||
htmlFor="favorite-purchase" /> | ||
</div> | ||
)} | ||
|
||
{step === 5 && ( | ||
<div> | ||
<FreeText | ||
headline="Something missing?" | ||
input={missing} | ||
setInput={setMissing} | ||
inputLabel="Is there a drink you feel is missing at most cafes? 🤔" | ||
id="missing-drink" | ||
placeholder="I would love if all cafes offered..." | ||
htmlFor="missing-drink" /> | ||
</div> | ||
)} | ||
|
||
{step === 6 && ( | ||
<div> | ||
<Conclusion | ||
subscriptionQ={subscriptionQ} | ||
purchase={purchase} | ||
often={often} | ||
missing={missing} /> | ||
</div> | ||
)} | ||
|
||
{step > 1 && step < 6 && ( | ||
<div> | ||
<button className="next-btn" type="button" onClick={handleStepIncrease}>Submit and go to next</button> | ||
</div> | ||
)} | ||
|
||
{step > 2 && step < 6 && ( | ||
<div> | ||
<button className="prev-btn" type="button" onClick={handleStepDecrease}>Previous question</button> | ||
</div> | ||
)} | ||
|
||
{step > 1 && step <= 6 && ( | ||
<div> | ||
<button className="restart-btn" type="button" onClick={handleStepRestart}>Restart the survey</button> | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
<Footer /> | ||
</> | ||
); | ||
} | ||
} |
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,32 @@ | ||
import React from 'react' | ||
import '../index.css' | ||
import '../conclusion.css' | ||
|
||
const conclusion = ({ purchase, subscriptionQ, often, missing }) => { | ||
return ( | ||
<> | ||
<h2>Thank you for completing this short survey! 💕</h2> | ||
<h3>You answered:</h3> | ||
<section className="list"> | ||
<ul> | ||
<li><span className="summary">Weekly purchases:</span> {purchase}</li> | ||
<li><span className="summary">Active subscription:</span> {subscriptionQ}</li> | ||
<li><span className="summary">Mostly purchased:</span> {often}</li> | ||
<li><span className="summary">Missing on menu:</span> {missing}</li> | ||
</ul> | ||
</section> | ||
|
||
<section className="related-link"> | ||
<a | ||
href="https://www.hsph.harvard.edu/nutritionsource/healthy-drinks/other-healthy-beverage-options/" | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
title="Learn more about the health benefits of coffee and tea"> | ||
-Health benefits of drinking coffee and tea- | ||
</a> | ||
</section> | ||
</> | ||
) | ||
} | ||
|
||
export default conclusion |
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 Drink from './coffee-shop.png' | ||
import '../index.css' | ||
|
||
const footer = () => { | ||
return ( | ||
<footer> | ||
<img src={Drink} alt="Cup with warm beverage" /> | ||
</footer> | ||
); | ||
} | ||
|
||
export default footer |
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,30 @@ | ||
import React from 'react' | ||
import '../index.css' | ||
import '../freetext.css' | ||
|
||
const freeText = ({ headline, input, setInput, inputLabel, id, placeholder, htmlFor }) => { | ||
const handleInputChange = (event) => { | ||
setInput(event.target.value) | ||
} | ||
|
||
return ( | ||
<> | ||
<h2>{headline}</h2> | ||
<form> | ||
<label htmlFor={htmlFor}> | ||
<p>{inputLabel}</p> | ||
</label> | ||
<textarea | ||
type="text" | ||
id={id} | ||
className="text-input" | ||
placeholder={placeholder} | ||
aria-live="polite" | ||
onChange={handleInputChange} | ||
value={input} /> | ||
</form> | ||
</> | ||
) | ||
} | ||
|
||
export default freeText |
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,34 @@ | ||
/* eslint-disable jsx-a11y/label-has-associated-control */ | ||
import React from 'react' | ||
import '../index.css' | ||
import '../purchase.css' | ||
|
||
const purchases = ['1-2 times', '3-5 times', '6-10 times', '10+ times'] | ||
console.log(purchases) | ||
|
||
const purchaseQuestion = ({ purchase, setPurchase }) => { | ||
const handleNumberPurchases = (event) => { | ||
setPurchase(event.target.value) | ||
} | ||
|
||
return ( | ||
<> | ||
<h2>How often per week do you purchase something to drink in a cafe?</h2> | ||
<form className="radio-buttons" id="radio-buttons"> | ||
{purchases.map((group) => ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this, will be easier to add more options later and the radio buttons will still work |
||
<label key={group} className="times-purchase"> | ||
<input | ||
type="radio" | ||
className="radio-button" | ||
value={group} | ||
onChange={handleNumberPurchases} | ||
checked={purchase === group} /> | ||
{group} | ||
</label> | ||
))} | ||
</form> | ||
</> | ||
) | ||
} | ||
|
||
export default purchaseQuestion |
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,21 @@ | ||
import React from 'react' | ||
import '../start.css' | ||
import '../index.css' | ||
|
||
const start = () => { | ||
return ( | ||
<section> | ||
<h1>A survey on what people choose to drink when in a cafe</h1> | ||
|
||
<p>Coffee, tea, or maybe something else? This short survey aims to find | ||
out just what cafe visitors want to drink, and how often. | ||
</p> | ||
<p> | ||
We would be immensely happy if you would like to answer a few | ||
questions, the survey only takes about 2 minutes to complete. Thanks! ✨ | ||
</p> | ||
</section> | ||
); | ||
} | ||
|
||
export default start |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I like the design of the FreeText-component, good reusability