pull/242/head
Monty Carlo Pineda 3 years ago
parent d0c066fcb9
commit 3bd150df21

File diff suppressed because it is too large Load Diff

@ -2,6 +2,7 @@
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
import asabenehImage from './images/asabeneh.jpg' import asabenehImage from './images/asabeneh.jpg'
import { countriesData } from './data/countries'
// Fuction to show month date year // Fuction to show month date year
@ -74,7 +75,7 @@ class Header extends React.Component {
} = this.props.data } = this.props.data
return ( return (
<header style={this.props.styles}> <header style={this.props.data.styles}>
<div className='header-wrapper'> <div className='header-wrapper'>
<h1>{welcome}</h1> <h1>{welcome}</h1>
<h2>{title}</h2> <h2>{title}</h2>
@ -130,7 +131,7 @@ class Main extends React.Component {
minusOne, minusOne,
} = this.props } = this.props
return ( return (
<main> <main style={this.props.styles}>
<div className='main-wrapper'> <div className='main-wrapper'>
<p>Prerequisite to get started react.js:</p> <p>Prerequisite to get started react.js:</p>
<ul> <ul>
@ -163,7 +164,7 @@ class Footer extends React.Component {
} }
render() { render() {
return ( return (
<footer> <footer style={this.props.styles}>
<div className='footer-wrapper'> <div className='footer-wrapper'>
<p>Copyright {this.props.date.getFullYear()}</p> <p>Copyright {this.props.date.getFullYear()}</p>
</div> </div>
@ -179,6 +180,11 @@ class App extends React.Component {
backgroundColor: '', backgroundColor: '',
color: '', color: '',
}, },
headerFooterStyles: {
backgroundColor: '',
color: '',
},
isDarkMode: false
} }
showDate = (time) => { showDate = (time) => {
const months = [ const months = [
@ -215,7 +221,35 @@ class App extends React.Component {
greetPeople = () => { greetPeople = () => {
alert('Welcome to 30 Days Of React Challenge, 2020') alert('Welcome to 30 Days Of React Challenge, 2020')
} }
changeBackground = () => {} changeBackground = () => {
if (this.state.isDarkMode) {
// set to light mode
this.setState({
styles: {
backgroundColor: '#FFFFFF',
color: '#000000',
},
headerFooterStyles: {
backgroundColor: '#61dbfb',
color: '#000000',
},
isDarkMode: false
});
} else {
// set to dark mode
this.setState({
styles: {
backgroundColor: '#121212',
color: '#FFFFFF',
},
headerFooterStyles: {
backgroundColor: '#121212',
color: '#FFFFFF',
},
isDarkMode: true
});
}
}
render() { render() {
const data = { const data = {
welcome: 'Welcome to 30 Days Of React', welcome: 'Welcome to 30 Days Of React',
@ -226,6 +260,7 @@ class App extends React.Component {
lastName: 'Yetayeh', lastName: 'Yetayeh',
}, },
date: 'Oct 7, 2020', date: 'Oct 7, 2020',
styles: this.state.headerFooterStyles
} }
const techs = ['HTML', 'CSS', 'JavaScript'] const techs = ['HTML', 'CSS', 'JavaScript']
const date = new Date() const date = new Date()
@ -245,8 +280,9 @@ class App extends React.Component {
addOne={this.addOne} addOne={this.addOne}
minusOne={this.minusOne} minusOne={this.minusOne}
count={this.state.count} count={this.state.count}
styles={this.state.styles}
/> />
<Footer date={new Date()} /> <Footer date={new Date()} styles={this.state.headerFooterStyles} />
</div> </div>
) )
} }

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save