Skip to content

Commit c022778

Browse files
committed
initial commit
0 parents  commit c022778

File tree

5 files changed

+121
-0
lines changed

5 files changed

+121
-0
lines changed

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Form: Flag Msg
2+
3+
Flag messages (modal form).
4+
5+
![screenshot.png](screenshot.png)
6+
7+
```jsx
8+
import ModalBtn from 'patchkit-modal/btn'
9+
import FormFlagMsg from 'patchkit-form-flag-msg'
10+
11+
const onSubmit = (reason, cb) => { console.log('submit', reason); cb() }
12+
<ModalBtn className="center-block" Form={FormFlagMsg} formProps={{onSubmit: onSubmit}}>
13+
<a className="btn highlighted">Click to open</a>
14+
</ModalBtn>
15+
```

demo.jsx

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react'
2+
import ModalBtn from 'patchkit-modal/btn'
3+
import FormFlagMsg from './index'
4+
5+
export default class FlagMsgFormDemo extends React.Component {
6+
render() {
7+
const onSubmit = (reason, cb) => { console.log('submit', reason); cb() }
8+
return <div>
9+
<h1>patchkit-form-flag-msg</h1>
10+
<section className="form-flag-msg">
11+
<header>&lt;FormFlagMsg&gt;</header>
12+
<div className="content">
13+
<ModalBtn className="center-block" Form={FormFlagMsg} formProps={{onSubmit: onSubmit}}><a className="btn highlighted">Click to open</a></ModalBtn>
14+
</div>
15+
</section>
16+
</div>
17+
}
18+
}

index.jsx

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React from 'react'
2+
import Radios from 'patchkit-radios'
3+
4+
export default class FlagMsgForm extends React.Component {
5+
constructor(props) {
6+
super(props)
7+
this.state = { reason: 'spam' }
8+
}
9+
10+
componentDidMount() {
11+
this.props.setIsValid(true)
12+
}
13+
14+
onChange(reason) {
15+
this.setState({ reason: reason })
16+
}
17+
18+
submit(cb) {
19+
this.props.onSubmit(this.state.reason, cb)
20+
}
21+
22+
render() {
23+
return <div>
24+
<form className="inline" onSubmit={e=>e.preventDefault()}>
25+
<fieldset>
26+
<h1><i className="fa fa-flag" /> Flag this Message</h1>
27+
<div>{"Flagging hides unwanted/negative content. What's your reason for flagging this message?"}</div>
28+
<Radios group="reason" options={[{ label: 'Spam', value: 'spam', defaultChecked: true }, { label: 'Abusive', value: 'abuse' }]} onChange={this.onChange.bind(this)} />
29+
</fieldset>
30+
</form>
31+
</div>
32+
}
33+
}

package.json

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"name": "patchkit-form-flag-msg",
3+
"version": "1.0.0",
4+
"description": "Flag messages (modal form)",
5+
"main": "index.jsx",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/patchkit/patchkit-form-flag-msg.git"
12+
},
13+
"keywords": [
14+
"react"
15+
],
16+
"author": "Paul Frazee <[email protected]>",
17+
"license": "GPL-3.0",
18+
"bugs": {
19+
"url": "https://github.com/patchkit/patchkit-form-flag-msg/issues"
20+
},
21+
"homepage": "https://github.com/patchkit/patchkit-form-flag-msg#readme",
22+
"dependencies": {
23+
"patchkit-radios": "^1.0.2",
24+
"react": "^0.14.6"
25+
},
26+
"devDependencies": {
27+
"babel": "^6.3.26",
28+
"babel-preset-es2015": "^6.3.13",
29+
"babel-preset-react": "^6.3.13",
30+
"babel-preset-stage-0": "^6.3.13",
31+
"babelify": "^7.2.0",
32+
"browserify": "^13.0.0",
33+
"patchkit-modal": "^1.0.3"
34+
},
35+
"browserify": {
36+
"transform": [
37+
[
38+
"envify",
39+
{
40+
"global": true
41+
}
42+
],
43+
[
44+
"babelify",
45+
{
46+
"presets": [
47+
"es2015",
48+
"stage-0",
49+
"react"
50+
]
51+
}
52+
]
53+
]
54+
}
55+
}

screenshot.png

31.6 KB
Loading

0 commit comments

Comments
 (0)