Created
March 6, 2018 11:13
-
-
Save anonymous/6aee9297c700aff71438e4942bd6ce89 to your computer and use it in GitHub Desktop.
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
import React, { Component } from 'react' | |
import styled, { keyframes, ThemeProvider } from 'styled-components' | |
import logo from './logo.svg' | |
import { theme1, theme2 } from './theme/globalStyle' | |
import ThemeSelect from './components/ThemeSelect' | |
// our lovely styled-components here | |
class App extends Component { | |
state = { | |
theme: theme1 | |
} | |
handleThemeChange = e => { | |
let theme = e.target.value | |
theme === 'theme1' ? (theme = theme1) : (theme = theme2) | |
this.setState({ theme }) | |
} | |
render() { | |
return ( | |
<ThemeProvider theme={this.state.theme}> | |
<AppWrapper> | |
<AppHeader> | |
<AppLogo src={logo} alt="logo" /> | |
<AppTitle>Welcome to React</AppTitle> | |
</AppHeader> | |
<AppIntro> | |
Bootstrapped with <code>create-react-app</code>. | |
</AppIntro> | |
<AppIntro> | |
Components styled with <code>styled-components</code>{' '} | |
<EmojiWrapper aria-label="nail polish">💅</EmojiWrapper> | |
</AppIntro> | |
<ThemeSelect handleThemeChange={this.handleThemeChange} /> | |
</AppWrapper> | |
</ThemeProvider> | |
) | |
} | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment