Skip to content
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
6 changes: 2 additions & 4 deletions README.md
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.
So this is an unfinished project. I still need to style it and make it more accesible. i focused on getting the react code and components to work.

Choose a reason for hiding this comment

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

I still think you made a good job by making it work in such a nice way!


## 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?

## 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://willowy-paletas-c102cf.netlify.app/
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>Adopt a dog survey</title>

Choose a reason for hiding this comment

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

Happy to see that you changed the title, many people miss this one :)

</head>

<body>
Expand Down
38 changes: 35 additions & 3 deletions code/src/App.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,41 @@
import React from 'react';
import React, { useState } from 'react';
import { Name } from './components/Name';
import { Experience } from './components/Experience';
import { Size } from './components/Size';
import { Summary } from './components/Summary';
import './index.css';

export const App = () => {
const [step, setStep] = useState(1);
const [name, setName] = useState('');
const [experience, setExperience] = useState('');
const [size, setSize] = useState('');

function handleStepIncrease() {
setStep(step + 1);
}
return (
<div>
Find me in src/app.js!
<div className="content-container">
{step === 1 && (
<div className="name-container">
<Name name={name} setName={setName} />
</div>
)}
{step === 2 && (
<Experience experience={experience} setExperience={setExperience} />
)}
{step === 3 && (
<>
<Size size={size} setSize={setSize} />
<button type="button" onClick={handleStepIncrease}>Submit</button>
</>
)}
{step >= 4 && (
<Summary name={name} experience={experience} size={size} />
)}
{step < 3 && (
<button type="button" onClick={handleStepIncrease}>Next</button>
)}
</div>
);
}
27 changes: 27 additions & 0 deletions code/src/components/Experience.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.dropdown {
display: flex;
margin-top: 5%;
align-items: center;
justify-content: center;
flex-direction: column;
width: 100%;
height: auto;
}

.dropdown form {
display: block;
background-color: antiquewhite;
}

.dropdown select {
border-top-style: hidden;
border-right-style: hidden;
border-left-style: hidden;
border-bottom-style: groove;
outline: none;
font-weight: 200;
font-size: 1.2em;
width: 100%;
padding: 0.5em 1em;
text-align: center;
}
21 changes: 21 additions & 0 deletions code/src/components/Experience.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import './Experience.css';

export const Experience = ({ experience, setExperience }) => {
const handleExpChange = (event) => {
setExperience(event.target.value);
};

return (
<div className="dropdown">
<span className="experience-title">Do you have previous dog owner experience?</span>
<form>
<select value={experience} onChange={handleExpChange}>
<option value="none" selected>Select an Option</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</form>
</div>
);
};
22 changes: 22 additions & 0 deletions code/src/components/Name.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.name-text {
display: flex;
width:100%;
margin: 10% 5% 5% 5%;
align-items: center;
justify-content: center;
flex-direction: column;

}

#name {
border-top-style: hidden;
border-right-style: hidden;
border-left-style: hidden;
border-bottom-style: groove;
outline: none;
width: 100%;
height: auto;
font-weight: 200;
font-size: 1.2em;
text-align: center;
}
15 changes: 15 additions & 0 deletions code/src/components/Name.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import './Name.css';

export const Name = ({ name, setName }) => {
const handleNameChange = (event) => {
setName(event.target.value);
}
return (
<div className="name-text">
<h1>Welcome</h1>
<p>Please fill out this form to adopt a dog</p>
<input type="text" id="name" value={name} placeholder="What is your name?" onChange={handleNameChange} />
</div>
);
}
21 changes: 21 additions & 0 deletions code/src/components/Size.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react'

const sizes = ['XS', 'S', 'M', 'L', 'XL']

Choose a reason for hiding this comment

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

Good job with adding the different sizes in an array.


export const Size = ({ size, setSize }) => {
const handleSizeChange = (event) => {
setSize(event.target.value)
}
return (
<div className="size-container">
<p>What dog size would you prefer to adopt?</p>
<form>
{sizes.map((singleSize) => (
<label htmlFor="size" key={singleSize}>
<input type="radio" className="size-input" value={singleSize} checked={singleSize === size} onChange={handleSizeChange} />{singleSize}
</label>
))}
</form>
</div>
);
}
11 changes: 11 additions & 0 deletions code/src/components/Summary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'

export const Summary = ({ name, experience, size }) => {
return (
<div>
<p>Your name: {name}</p>
<p>Previous dog experience: {experience}</p>
<p>Prefered size to adopt: {size}</p>
</div>
)
}
22 changes: 22 additions & 0 deletions code/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,31 @@ body {
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-color: bisque;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace;
}

.content-container {
display: flex;
flex-direction: column;
align-items: center;
justify-items: center;
margin: 5%;
overflow: hidden;
padding: 5%;
background-color: rgba(255, 255, 255, 1);
}

button {
border-radius: 20px;
background-color: bisque;
text-align: center;
padding: 1em;
margin: 20px;
border: none;
width: 100px;
}