parent
746a2f571e
commit
2b4b41fc93
@ -0,0 +1,10 @@
|
||||
const jsxElement = <h1>I am a JSX Element!</h1>;
|
||||
const header = (
|
||||
<header>
|
||||
<h1>Welcome to 30 Days Of React</h1>
|
||||
<h2>Getting Started React</h2>
|
||||
<h3>JavaScript Library</h3>
|
||||
<p>Asabeneh Yetayeh</p>
|
||||
<small>Oct 2, 2020</small>
|
||||
</header>
|
||||
);
|
@ -0,0 +1,198 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css?family=Montserrat:300,400,500|Roboto:300,400,500&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
|
||||
<title>30 Days Of React Challenge</title>
|
||||
<style>
|
||||
/* == General style === */
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
line-height: 1.5;
|
||||
font-family: 'Montserrat';
|
||||
font-weight: 300;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.root {
|
||||
min-height: 100%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.header-wrapper,
|
||||
.main-wrapper,
|
||||
.footer-wrapper {
|
||||
width: 85%;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.header-wrapper,
|
||||
.main-wrapper {
|
||||
padding: 10px;
|
||||
margin: 2px auto;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 70px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
h2,
|
||||
h3 {
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
header {
|
||||
background-color: #61dbfb;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
main {
|
||||
padding: 10px;
|
||||
padding-bottom: 60px;
|
||||
/* Height of the footer */
|
||||
}
|
||||
|
||||
ul {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
ul li {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
/* Height of the footer */
|
||||
background: #6cf;
|
||||
}
|
||||
|
||||
.footer-wrapper {
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
line-height: 60px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="root"></div>
|
||||
|
||||
<script
|
||||
crossorigin
|
||||
src="https://unpkg.com/react@16/umd/react.development.js"
|
||||
></script>
|
||||
<script
|
||||
crossorigin
|
||||
src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"
|
||||
></script>
|
||||
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
||||
<script type="text/babel">
|
||||
// To get the root element from the HTML document
|
||||
const rootElement = document.querySelector('.root');
|
||||
// JSX element, header
|
||||
const welcome = 'Welcome to 30 Days Of React Challenge';
|
||||
const title = 'Getting Started React';
|
||||
const subtitle = 'JavaScript Library';
|
||||
const author = {
|
||||
firstName: 'Asabeneh',
|
||||
lastName: 'Yetayeh',
|
||||
};
|
||||
const date = 'Oct 2, 2020';
|
||||
|
||||
// JSX element, header
|
||||
const header = (
|
||||
<header>
|
||||
<div className="header-wrapper">
|
||||
<h1>{welcome}</h1>
|
||||
<h2>{title}</h2>
|
||||
<h3>{subtitle}</h3>
|
||||
<p>
|
||||
Instructor: {author.firstName} {author.lastName}
|
||||
</p>
|
||||
<small>Date: {date}</small>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
|
||||
const numOne = 3;
|
||||
const numTwo = 2;
|
||||
|
||||
const result = (
|
||||
<p>
|
||||
{numOne} + {numTwo} = {numOne + numTwo}
|
||||
</p>
|
||||
);
|
||||
|
||||
const yearBorn = 1820;
|
||||
const currentYear = 2020;
|
||||
const age = currentYear - yearBorn;
|
||||
const personAge = (
|
||||
<p>
|
||||
{' '}
|
||||
{author.firstName} {author.lastName} is {age} years old
|
||||
</p>
|
||||
);
|
||||
|
||||
// JSX element, main
|
||||
const techs = ['HTML', 'CSS', 'JavaScript'];
|
||||
const techsFormatted = techs.map((tech) => <li key={tech}>{tech}</li>);
|
||||
|
||||
// JSX element, main
|
||||
const main = (
|
||||
<main>
|
||||
<div className="main-wrapper">
|
||||
<p>
|
||||
Prerequisite to get started{' '}
|
||||
<strong>
|
||||
<em>react.js</em>
|
||||
</strong>
|
||||
:
|
||||
</p>
|
||||
<ul>{techsFormatted}</ul>
|
||||
{result}
|
||||
{personAge}
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
|
||||
const copyRight = 'Copyright 2020';
|
||||
|
||||
// JSX element, footer
|
||||
const footer = (
|
||||
<footer>
|
||||
<div className="footer-wrapper">
|
||||
<p>{copyRight}</p>
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
|
||||
// JSX element, app
|
||||
const app = (
|
||||
<div className="app">
|
||||
{header}
|
||||
{main}
|
||||
{footer}
|
||||
</div>
|
||||
);
|
||||
|
||||
// we render the JSX element using the ReactDOM package
|
||||
ReactDOM.render(app, rootElement);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in new issue