parent
432fe74355
commit
b89a59c234
@ -0,0 +1,31 @@
|
||||
// What is a module?
|
||||
// - function(s) that can be exported and imported when needed
|
||||
|
||||
// What is a package?
|
||||
// - Its a module or collection of modules
|
||||
|
||||
// what is the difference between a module and a package?
|
||||
// - modules are libraries
|
||||
// - package is a collection of modules grouped together
|
||||
|
||||
// What is NPM?
|
||||
// - NPM stands for Node Package Manager. it allows users to consume and distribute JS modules
|
||||
|
||||
// What is a Webpack?
|
||||
// - takes all the code of an app and makes it usable in a web browser
|
||||
|
||||
// How do you create a new React project?
|
||||
// - npx create-react-app in the terminal of VS Code
|
||||
|
||||
// What are the files and folders inside a project folder(package.json, package-lock.json or yarn.lock, .gitignore,node_modules and public)?
|
||||
// - package.json: is a list of all the packages the application uses
|
||||
// - package-lock.json or yarn.lock: locks the versions of the package
|
||||
// - .gitignore: ingnore files/folders pushed to GitHub
|
||||
// - node_modules: stores all node packages of the application
|
||||
// - public: holdes index.html, favicon.ico, manifest.json, other images, robot.txt
|
||||
|
||||
// What is your favorite code editor (I believe that it is Visual Studio Code)?
|
||||
// - So far VS code is my favorite.
|
||||
|
||||
// Add different Visual Studio Code extensions to improve your productivity(eg. prettier, ESLint etc).
|
||||
// - I've already added the extensions I want.
|
@ -0,0 +1,23 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
@ -0,0 +1,70 @@
|
||||
# Getting Started with Create React App
|
||||
|
||||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `npm start`
|
||||
|
||||
Runs the app in the development mode.\
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
|
||||
|
||||
The page will reload when you make changes.\
|
||||
You may also see any lint errors in the console.
|
||||
|
||||
### `npm test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.\
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `npm run build`
|
||||
|
||||
Builds the app for production to the `build` folder.\
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.\
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `npm run eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
||||
|
||||
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
||||
|
||||
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
|
||||
### Code Splitting
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
||||
|
||||
### Analyzing the Bundle Size
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
||||
|
||||
### Making a Progressive Web App
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
||||
|
||||
### Deployment
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
||||
|
||||
### `npm run build` fails to minify
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "exercise2",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@testing-library/user-event": "^13.5.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-scripts": "5.0.1",
|
||||
"web-vitals": "^2.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css?family=Montserrat:300,400,500|Roboto:300,400,500&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<title>Exercise 2</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 29 KiB |
@ -0,0 +1,101 @@
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* change font */
|
||||
body {
|
||||
height: 100%;
|
||||
line-height: 1.5;
|
||||
font-family: 'Montserrat';
|
||||
font-weight: 300;
|
||||
color: black;
|
||||
}
|
||||
|
||||
|
||||
/* make all images flex items and center them */
|
||||
.logos{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* change image size */
|
||||
.logos img{
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
/* center title */
|
||||
.title h1{
|
||||
text-align: center;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
|
||||
/* main wrapper */
|
||||
.main-wrapper{
|
||||
background-color: lightblue;
|
||||
max-width: 80%;
|
||||
margin: 0 auto;
|
||||
border-radius: 10px;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
/* main h1 tag */
|
||||
.main-wrapper h1{
|
||||
text-align: center;
|
||||
padding: 30px 0;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* main p tag */
|
||||
.main-wrapper p{
|
||||
text-align: center;
|
||||
padding-bottom: 50px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
|
||||
/* main input wrapper */
|
||||
.dataEntry{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
|
||||
/* main input tag */
|
||||
.dataEntry input{
|
||||
margin: 0 10px;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
|
||||
/* main button */
|
||||
button{
|
||||
margin: 50px 0;
|
||||
padding: 10px 120px;
|
||||
text-align: center;
|
||||
border-radius: 10px;
|
||||
border: none;
|
||||
background-color: lightcoral;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* on smaller screens change items to make responsive */
|
||||
@media screen and (max-width: 700px) {
|
||||
.logos img{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dataEntry input{
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
button{
|
||||
padding: 10px 60px;
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import './index.css'
|
||||
import HTML from './images/html5-logo.png'
|
||||
import CSS from './images/css3-logo.png'
|
||||
import JS from './images/js-logo.png'
|
||||
import ReactLogo from './images/react-logo.png'
|
||||
|
||||
|
||||
// NEW WAY TO CREATE A ROOT IN VERSION 18
|
||||
// Create React root for div in HTML
|
||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||
|
||||
|
||||
// create JSX element, header
|
||||
const header = (
|
||||
<header className='title'>
|
||||
<h1>Front End Technologies</h1>
|
||||
</header>
|
||||
)
|
||||
|
||||
// create JSX element, images
|
||||
const images = (
|
||||
<div className='logos'>
|
||||
<img src={HTML} alt='HTML5 Logo'/>
|
||||
<img src={CSS} alt='CSS3 Logo' className='cssLogo'/>
|
||||
<img src={JS} alt='JS Logo'/>
|
||||
<img src={ReactLogo} alt='React Logo'/>
|
||||
</div>
|
||||
)
|
||||
|
||||
const main = (
|
||||
<main>
|
||||
<div className='main-wrapper'>
|
||||
<h1>Subscribe</h1>
|
||||
<p>Sign up with your email address to receive news and updates.</p>
|
||||
<div className='dataEntry'>
|
||||
<input placeholder='First name' type='text'/>
|
||||
<input placeholder='Last name' type='text'/>
|
||||
<input placeholder='Email' type='text'/>
|
||||
</div>
|
||||
<center><button type='submit'>Subscribe</button></center>
|
||||
</div>
|
||||
</main>
|
||||
)
|
||||
|
||||
// create JSX element, parent
|
||||
const app = (
|
||||
<div>
|
||||
{header}
|
||||
{images}
|
||||
{main}
|
||||
</div>
|
||||
)
|
||||
|
||||
|
||||
// Render JSX element into DOM
|
||||
root.render(app);
|
@ -0,0 +1,23 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
@ -0,0 +1,70 @@
|
||||
# Getting Started with Create React App
|
||||
|
||||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `npm start`
|
||||
|
||||
Runs the app in the development mode.\
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
|
||||
|
||||
The page will reload when you make changes.\
|
||||
You may also see any lint errors in the console.
|
||||
|
||||
### `npm test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.\
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `npm run build`
|
||||
|
||||
Builds the app for production to the `build` folder.\
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.\
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `npm run eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
||||
|
||||
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
||||
|
||||
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
|
||||
### Code Splitting
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
||||
|
||||
### Analyzing the Bundle Size
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
||||
|
||||
### Making a Progressive Web App
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
||||
|
||||
### Deployment
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
||||
|
||||
### `npm run build` fails to minify
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "exercise3",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@testing-library/user-event": "^13.5.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-scripts": "5.0.1",
|
||||
"web-vitals": "^2.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<script src="https://kit.fontawesome.com/9d96f18d1b.js" crossorigin="anonymous"></script>
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
After Width: | Height: | Size: 40 KiB |
@ -0,0 +1,72 @@
|
||||
/* set border and background color of app */
|
||||
.appBorder{
|
||||
border: 10px solid lightgrey;
|
||||
background-color: lightgrey;
|
||||
border-radius: 10px;
|
||||
}
|
||||
/* set app background white*/
|
||||
.app{
|
||||
background-color: white;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.header-wrapper{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.header-wrapper img{
|
||||
border-radius: 50%;
|
||||
width: 350px;
|
||||
height: 400px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
/* add left padding to all elements */
|
||||
.header-wrapper, .main-wrapper, .footer-wrapper{
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
/* change size and color of check mark */
|
||||
span{
|
||||
margin-left: 5px;
|
||||
position: relative;
|
||||
top: -5px;
|
||||
background-color: rgb(10, 240, 220);
|
||||
border-radius: 50%;
|
||||
font-size: 15px;
|
||||
padding: 4px 7px;
|
||||
}
|
||||
|
||||
.main-wrapper button{
|
||||
font-size: 20px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
color: white;
|
||||
background-color: rgb(10, 240, 220);
|
||||
padding: 10px 27px;
|
||||
margin: 5px 5px;
|
||||
}
|
||||
|
||||
.footer-wrapper p{
|
||||
padding: 20px 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* on smaller screens change items to make responsive */
|
||||
@media screen and (max-width: 700px) {
|
||||
.header-wrapper{
|
||||
margin-left: 18px;
|
||||
}
|
||||
.header-wrapper img{
|
||||
width: 250px;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.main-wrapper{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: column;
|
||||
margin: 0 25px;
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
// index.js
|
||||
// Import React, ReactDOM, stylesheet, and image
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import './index.css';
|
||||
import profileImage from './images/profileImage.jpg'
|
||||
|
||||
// Create root
|
||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||
|
||||
// Create JSX element, header
|
||||
const userName = {
|
||||
firstName: 'Arthur',
|
||||
lastName: 'Bradshaw'
|
||||
}
|
||||
const title = 'Senior Developer';
|
||||
const location = 'Spain';
|
||||
|
||||
const header = (
|
||||
<header className='header-wrapper'>
|
||||
<img src={profileImage} alt='User Profile'/>
|
||||
<h1>{userName.firstName} {userName.lastName}<span>✓</span></h1>
|
||||
<p>{title}, {location}</p>
|
||||
</header>
|
||||
)
|
||||
|
||||
// JSX element, main
|
||||
const skills = [
|
||||
'HTML' , 'CSS', 'Sass', 'JS', 'React', 'Redux',
|
||||
'Node', 'MongoDB', 'Python', 'Flask', 'Django',
|
||||
'NumPy', 'Pandas', 'Data Analysis', 'MYSQL', 'GraphQL',
|
||||
'D3.js', 'Gatsby', 'Docker', 'Heroku', 'Git'
|
||||
];
|
||||
const skillButtons = skills.map(skill=>{return <button type='button' key={skill}>{skill}</button>})
|
||||
|
||||
const main = (
|
||||
<div className='main-wrapper'>
|
||||
<h2>Skills</h2>
|
||||
{skillButtons}
|
||||
</div>
|
||||
)
|
||||
|
||||
// JSX element, footer
|
||||
const day = new Date().getDate()
|
||||
const month = new Date().getMonth()
|
||||
const year = new Date().getFullYear()
|
||||
const monthArray = [
|
||||
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
|
||||
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
|
||||
]
|
||||
|
||||
const footer = (
|
||||
<div className='footer-wrapper'>
|
||||
<p>🕑 Joined on {monthArray[month]} {day}, {year}</p>
|
||||
</div>
|
||||
|
||||
)
|
||||
|
||||
// JSX element, parent
|
||||
const app =(
|
||||
<div className='appBorder'>
|
||||
<div className='app'>
|
||||
{header}
|
||||
{main}
|
||||
{footer}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
// render root
|
||||
root.render(app)
|
Loading…
Reference in new issue