mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
b86bbb65a6
add support custom svg remove expire tricks
82 lines
2.1 KiB
JavaScript
82 lines
2.1 KiB
JavaScript
import React, { Component } from 'react'
|
|
import { WhiteSpace, WingBlank, Card, Icon } from 'antd-mobile'
|
|
import Layout from '../components/Layout'
|
|
import MenuBar from '../components/MenuBar'
|
|
|
|
export default class Home extends Component {
|
|
static getInitialProps ({ req }) {
|
|
const language = req ? req.headers['accept-language'] : navigator.language
|
|
|
|
return {
|
|
language
|
|
}
|
|
}
|
|
|
|
render () {
|
|
const {
|
|
language,
|
|
url: { pathname }
|
|
} = this.props
|
|
|
|
return (
|
|
<Layout language={language}>
|
|
<MenuBar
|
|
pathname={pathname}
|
|
>
|
|
<WingBlank>
|
|
<WhiteSpace />
|
|
<Card>
|
|
<Card.Header
|
|
extra='Internal svg'
|
|
thumb={<Icon type='check' />}
|
|
/>
|
|
<Card.Body>
|
|
<code>
|
|
{`<Icon type='check' />`}
|
|
</code>
|
|
</Card.Body>
|
|
</Card>
|
|
<WhiteSpace />
|
|
<Card>
|
|
<Card.Header
|
|
extra='Custom svg'
|
|
thumb={<Icon type={require('../static/reload.svg')} />}
|
|
/>
|
|
<Card.Body>
|
|
<code>
|
|
{`<Icon type={require('../static/reload.svg')} />`}
|
|
</code>
|
|
</Card.Body>
|
|
</Card>
|
|
<WhiteSpace />
|
|
<Card>
|
|
<Card.Header
|
|
extra='Fill color'
|
|
thumb={
|
|
<Icon
|
|
type={require('../static/reload.svg')}
|
|
style={{ fill: '#108ee9' }}
|
|
/>
|
|
}
|
|
/>
|
|
<Card.Body>
|
|
<code>{`
|
|
<Icon
|
|
type={require('../static/reload.svg')}
|
|
style={{ fill: '#108ee9' }}
|
|
/>
|
|
`}</code>
|
|
</Card.Body>
|
|
</Card>
|
|
<style jsx>{`
|
|
code {
|
|
color: gray;
|
|
}
|
|
`}</style>
|
|
</WingBlank>
|
|
</MenuBar>
|
|
</Layout>
|
|
)
|
|
}
|
|
}
|