Skip to content

Instantly share code, notes, and snippets.

Created March 6, 2018 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/6aee9297c700aff71438e4942bd6ce89 to your computer and use it in GitHub Desktop.
Save anonymous/6aee9297c700aff71438e4942bd6ce89 to your computer and use it in GitHub Desktop.
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