Files
talk/client/coral-admin/src/containers/Configure.js
T

97 lines
2.7 KiB
JavaScript

import React from 'react'
import {connect} from 'react-redux'
import {
List,
ListItem,
ListItemContent,
ListItemAction,
Textfield,
Checkbox,
Button,
Icon
} from 'react-mdl'
import Page from 'components/Page'
import styles from './Configure.css'
class Configure extends React.Component {
constructor (props) {
super(props)
this.state = {activeSection: 'comments'}
}
getCommentSettings () {
return <List>
<ListItem className={styles.configSetting}>
<ListItemAction><Checkbox /></ListItemAction>
Enable pre-moderation
</ListItem>
<ListItem className={styles.configSetting}>
<ListItemAction><Checkbox /></ListItemAction>
Include Comment Stream Description for Readers
</ListItem>
<ListItem className={styles.configSetting}>
<ListItemAction><Checkbox /></ListItemAction>
Limit Comment Length
<Textfield
pattern='-?[0-9]*(\.[0-9]+)?'
error='Input is not a number!'
label='Maximum Characters' />
</ListItem>
</List>
}
getEmbed () {
return <List>
<ListItem className={styles.configSettingEmbed}>
<p>Copy and paste code below into your CMS to embed your comment box in your articles</p>
<input type='text' className={styles.embedInput} />
<Button raised colored>Copy</Button>
</ListItem>
</List>
}
changeSection (activeSection) {
this.setState({activeSection})
}
render () {
const pageTitle = this.state.activeSection === 'comments'
? 'Comment Settings'
: 'Embed Comment Stream'
return (
<Page>
<div className={styles.container}>
<div className={styles.leftColumn}>
<List>
<ListItem className={styles.settingOption}>
<ListItemContent
onClick={this.changeSection.bind(this, 'comments')}
icon='settings'>Comment Settings</ListItemContent>
</ListItem>
<ListItem className={styles.settingOption}>
<ListItemContent
onClick={this.changeSection.bind(this, 'embed')}
icon='code'>Embed Comment Stream</ListItemContent>
</ListItem>
</List>
<Button raised colored>
<Icon name='save' /> Save Changes
</Button>
</div>
<div className={styles.mainContent}>
<h1>{pageTitle}</h1>
{
this.state.activeSection === 'comments'
? this.getCommentSettings()
: this.getEmbed()
}
</div>
</div>
</Page>
)
}
}
export default connect(x => x)(Configure)