2017-06-27 19:10:26 +00:00
|
|
|
import React, { Component } from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
|
|
|
|
import ThemeWrapper from '../components/ThemeWrapper'
|
|
|
|
import getTheme from 'react-uwp/styles/getTheme'
|
|
|
|
|
|
|
|
import {
|
|
|
|
Button,
|
|
|
|
ColorPicker,
|
|
|
|
DatePicker,
|
|
|
|
ProgressRing
|
|
|
|
} from 'react-uwp'
|
|
|
|
|
|
|
|
class Index extends Component {
|
2017-07-08 12:12:01 +00:00
|
|
|
static async getInitialProps ({ req }) {
|
2017-06-27 19:10:26 +00:00
|
|
|
let userAgent
|
|
|
|
if (process.browser) {
|
|
|
|
userAgent = navigator.userAgent
|
|
|
|
} else {
|
|
|
|
userAgent = req.headers['user-agent']
|
|
|
|
}
|
|
|
|
|
|
|
|
return { userAgent }
|
|
|
|
}
|
|
|
|
static contextTypes = { theme: PropTypes.object }
|
|
|
|
|
|
|
|
render () {
|
2017-07-08 12:12:01 +00:00
|
|
|
const { userAgent } = this.props
|
2017-06-27 19:10:26 +00:00
|
|
|
return (
|
|
|
|
<ThemeWrapper
|
|
|
|
style={{
|
|
|
|
padding: '20px 0',
|
|
|
|
minHeight: '100vh',
|
|
|
|
display: 'flex',
|
|
|
|
flexDirection: 'column',
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'space-around'
|
|
|
|
}}
|
2017-07-08 12:12:01 +00:00
|
|
|
theme={getTheme({ userAgent })}
|
2017-06-27 19:10:26 +00:00
|
|
|
>
|
|
|
|
<Button>Test Button</Button>
|
|
|
|
<DatePicker />
|
|
|
|
<ColorPicker />
|
|
|
|
<ProgressRing size={50} />
|
2017-07-08 12:12:01 +00:00
|
|
|
<p style={{ textAlign: 'center' }}>{userAgent.slice(12)}...</p>
|
2017-06-27 19:10:26 +00:00
|
|
|
</ThemeWrapper>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Index
|