1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/examples/with-antd-mobile/pages/icon.js
Colder Xihk b86bbb65a6 update with-antd-mobile example (#2403)
add support custom svg

remove expire tricks
2017-06-29 22:04:16 +02:00

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>
)
}
}