You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
2.3 KiB
111 lines
2.3 KiB
8 years ago
|
const inherits = require('util').inherits
|
||
|
const Component = require('react').Component
|
||
|
const h = require('react-hyperscript')
|
||
|
const ReactMarkdown = require('react-markdown')
|
||
|
const linker = require('extension-link-enabler')
|
||
|
const findDOMNode = require('react-dom').findDOMNode
|
||
|
|
||
8 years ago
|
module.exports = Notice
|
||
8 years ago
|
|
||
|
inherits(Notice, Component)
|
||
|
function Notice () {
|
||
|
Component.call(this)
|
||
|
}
|
||
|
|
||
|
Notice.prototype.render = function () {
|
||
8 years ago
|
const { notice, onConfirm } = this.props
|
||
|
const { title, date, body } = notice
|
||
8 years ago
|
|
||
|
return (
|
||
|
h('.flex-column.flex-center.flex-grow', [
|
||
|
h('h3.flex-center.text-transform-uppercacse.terms-header', {
|
||
|
style: {
|
||
|
background: '#EBEBEB',
|
||
|
color: '#AEAEAE',
|
||
|
width: '100%',
|
||
|
fontSize: '20px',
|
||
|
textAlign: 'center',
|
||
|
padding: 6,
|
||
|
},
|
||
|
}, [
|
||
|
title,
|
||
|
]),
|
||
|
|
||
8 years ago
|
h('h5.flex-center.text-transform-uppercacse.terms-header', {
|
||
|
style: {
|
||
|
background: '#EBEBEB',
|
||
|
color: '#AEAEAE',
|
||
|
marginBottom: 24,
|
||
|
width: '100%',
|
||
|
fontSize: '20px',
|
||
|
textAlign: 'center',
|
||
|
padding: 6,
|
||
|
},
|
||
|
}, [
|
||
|
date,
|
||
|
]),
|
||
|
|
||
8 years ago
|
h('style', `
|
||
|
|
||
|
.markdown {
|
||
|
overflow-x: hidden;
|
||
|
}
|
||
8 years ago
|
|
||
8 years ago
|
.markdown h1, .markdown h2, .markdown h3 {
|
||
|
margin: 10px 0;
|
||
|
font-weight: bold;
|
||
|
}
|
||
|
|
||
|
.markdown strong {
|
||
|
font-weight: bold;
|
||
|
}
|
||
|
.markdown em {
|
||
|
font-style: italic;
|
||
|
}
|
||
|
|
||
|
.markdown p {
|
||
|
margin: 10px 0;
|
||
|
}
|
||
|
|
||
|
.markdown a {
|
||
8 years ago
|
color: #df6b0e;
|
||
8 years ago
|
}
|
||
|
|
||
|
`),
|
||
|
|
||
|
h('div.markdown', {
|
||
|
style: {
|
||
|
background: 'rgb(235, 235, 235)',
|
||
|
height: '310px',
|
||
|
padding: '6px',
|
||
|
width: '90%',
|
||
|
overflowY: 'scroll',
|
||
|
scroll: 'auto',
|
||
|
},
|
||
|
}, [
|
||
|
h(ReactMarkdown, {
|
||
8 years ago
|
source: body,
|
||
8 years ago
|
skipHtml: true,
|
||
|
}),
|
||
|
]),
|
||
|
|
||
|
h('button', {
|
||
8 years ago
|
onClick: onConfirm,
|
||
8 years ago
|
style: {
|
||
|
marginTop: '18px',
|
||
|
},
|
||
|
}, 'Continue'),
|
||
|
])
|
||
|
)
|
||
|
}
|
||
|
|
||
|
Notice.prototype.componentDidMount = function () {
|
||
|
var node = findDOMNode(this)
|
||
|
linker.setupListener(node)
|
||
|
}
|
||
|
|
||
|
Notice.prototype.componentWillUnmount = function () {
|
||
|
var node = findDOMNode(this)
|
||
|
linker.teardownListener(node)
|
||
|
}
|