off topic plugins, and examples

This commit is contained in:
Belen Curcio
2017-04-11 11:23:23 -03:00
parent aef0f433c9
commit e888161fe4
18 changed files with 221 additions and 2 deletions
+2
View File
@@ -18,3 +18,5 @@ plugins.json
plugins/*
!plugins/coral-plugin-facebook-auth
!plugins/coral-plugin-respect
!plugins/coral-plugin-*
+1 -1
View File
@@ -158,7 +158,7 @@ class Comment extends React.Component {
? <TagLabel><BestIndicator /></TagLabel>
: null }
<PubDate created_at={comment.created_at} />
<Slot fill="commentInfoBar" commentId={comment.id} inline/>
<Slot fill="commentInfoBar" comment={comment} commentId={comment.id} inline/>
<Content body={comment.body} />
<div className="commentActionsLeft comment__action-container">
+1 -1
View File
@@ -104,7 +104,7 @@ class CommentBox extends Component {
`${charCount - length} ${lang.t('characters-remaining')}`
}
</div>
<Slot fill="commentBoxDetail" inline/>
<Slot fill="commentBoxDetail" inline />
<div className={`${name}-button-container`}>
{
isReply && (
@@ -0,0 +1,14 @@
{
"presets": [
"es2015"
],
"plugins": [
"add-module-exports",
"transform-class-properties",
"transform-decorators-legacy",
"transform-object-assign",
"transform-object-rest-spread",
"transform-async-to-generator",
"transform-react-jsx"
]
}
@@ -0,0 +1,23 @@
{
"env": {
"browser": true,
"es6": true,
"mocha": true
},
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
}
},
"parser": "babel-eslint",
"plugins": [
"react"
],
"rules": {
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"no-console": ["warn", { "allow": ["warn", "error"] }]
}
}
@@ -0,0 +1,22 @@
import React from 'react';
import styles from './styles.css';
class OffTopicCheckbox extends React.Component {
handleChange = () => {
console.log('handle Change');
}
render() {
return (
<div className={`wapo-styles-offtopic ${styles.offTopic}`}>
<label>
<input type="checkbox" onChange={this.handleChange}/>
Off-Topic
</label>
</div>
)
}
}
export default OffTopicCheckbox;
@@ -0,0 +1,9 @@
import React from 'react';
import styles from './styles.css';
export default (props) => (
<span className={styles.tag}>
{console.log('Offtopic tag', props.offtopic)}
Off-topic
</span>
);
@@ -0,0 +1,13 @@
.offTopic {
label {
padding: 10px 20px;
}
}
.tag {
padding: 0 12px;
background: coral;
border-radius: 3px;
}
@@ -0,0 +1,9 @@
import OffTopicCheckbox from './components/OffTopicCheckbox';
import OffTopicTag from './components/OffTopicTag';
export default {
slots: {
commentBoxDetail: [OffTopicCheckbox],
commentInfoBar: [OffTopicTag]
}
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
};
+14
View File
@@ -0,0 +1,14 @@
{
"presets": [
"es2015"
],
"plugins": [
"add-module-exports",
"transform-class-properties",
"transform-decorators-legacy",
"transform-object-assign",
"transform-object-rest-spread",
"transform-async-to-generator",
"transform-react-jsx"
]
}
@@ -0,0 +1,23 @@
{
"env": {
"browser": true,
"es6": true,
"mocha": true
},
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
}
},
"parser": "babel-eslint",
"plugins": [
"react"
],
"rules": {
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"no-console": ["warn", { "allow": ["warn", "error"] }]
}
}
@@ -0,0 +1,15 @@
import React, {Component} from 'react';
import styles from './style.css';
class OffTopicBadge extends Component {
render() {
return (
<span className={styles.badge}>
OffTopicCheckbox
</span>
);
}
}
export default OffTopicBadge;
@@ -0,0 +1,21 @@
import React, {Component} from 'react';
import styles from './style.css';
class OffTopicCheckbox extends Component {
constructor () {
this.state = {
checked: false;
}
}
render() {
return (
<div className={styles.respect}>
OffTopicCheckbox
<input type
</div>
);
}
}
export default OffTopicCheckbox;
@@ -0,0 +1,30 @@
.respect {
display: inline-block;
}
.button {
color: #2a2a2a;
margin: 5px 10px 5px 0px;
background: none;
padding: 0px;
border: none;
font-size: inherit;
&:hover {
color: #767676;
cursor: pointer;
}
&.respected {
color: #c98211;
&:hover {
color: #e59614;
cursor: pointer;
}
}
}
.icon {
padding: 0 5px;
}
+9
View File
@@ -0,0 +1,9 @@
import OffTopicCheckbox from './components/OffTopicCheckbox';
import OffTopicBadge from './components/OffTopicBadge';
export default {
slots: {
commentBoxDetail: [OffTopicCheckbox],
commentInfoBar: [OffTopicBadge]
}
};
@@ -0,0 +1,10 @@
{
"en": {
"respect": "Respect",
"respected": "Respected"
},
"es": {
"respect": "Respeto",
"respected": "Respetado"
}
}
+2
View File
@@ -0,0 +1,2 @@
module.exports = {
}