This repository was archived by the owner on Nov 8, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 10 files changed +184
-6
lines changed Expand file tree Collapse file tree 10 files changed +184
-6
lines changed Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import { Button } from 'antd'
3
+
4
+ import { ICON_CMD } from '../../config'
5
+
6
+ import SectionLabel from '../SectionLabel'
7
+ import { Wrapper , Divider } from './styles/content'
8
+
9
+ const Content = ( ) => (
10
+ < Wrapper >
11
+ < Divider />
12
+ < SectionLabel
13
+ title = "侵权举报"
14
+ iconSrc = { `${ ICON_CMD } /police1.svg` }
15
+ desc = "该内容侵犯了我的版权, 或包含盗版 / 违规转载等。"
16
+ addonNode = {
17
+ < Button size = "small" type = "primary" ghost >
18
+ 是的, 去举报
19
+ </ Button >
20
+ }
21
+ />
22
+ < Divider />
23
+ < SectionLabel
24
+ title = "违法信息举报"
25
+ iconSrc = { `${ ICON_CMD } /police2.svg` }
26
+ desc = "该内容涉及政治,色情,暴力,民族宗教, 地域攻击等违法信息。"
27
+ addonNode = {
28
+ < Button size = "small" type = "primary" ghost >
29
+ 是的, 去举报
30
+ </ Button >
31
+ }
32
+ />
33
+ </ Wrapper >
34
+ )
35
+
36
+ export default Content
Original file line number Diff line number Diff line change
1
+ /*
2
+ *
3
+ * BadContentRepot
4
+ *
5
+ */
6
+
7
+ import React from 'react'
8
+ import PropTypes from 'prop-types'
9
+
10
+ import { ICON_CMD } from '../../config'
11
+
12
+ import Modal from '../Modal'
13
+ import { Wrapper , Title , Icon } from './styles'
14
+ import Content from './Content'
15
+
16
+ import { makeDebugger } from '../../utils'
17
+
18
+ /* eslint-disable no-unused-vars */
19
+ const debug = makeDebugger ( 'c:BadContentRepot:index' )
20
+ /* eslint-enable no-unused-vars */
21
+
22
+ class BadContentRepot extends React . Component {
23
+ state = {
24
+ show : false ,
25
+ }
26
+
27
+ componentDidMount ( ) { }
28
+
29
+ componentWillUnmount ( ) { }
30
+
31
+ toggleModal ( ) {
32
+ const { show } = this . state
33
+ this . setState ( { show : ! show } )
34
+ }
35
+
36
+ render ( ) {
37
+ const { title } = this . props
38
+ const { show } = this . state
39
+
40
+ return (
41
+ < React . Fragment >
42
+ < Modal
43
+ width = "500px"
44
+ show = { show }
45
+ showCloseBtn
46
+ onClose = { this . toggleModal . bind ( this ) }
47
+ >
48
+ < Content />
49
+ </ Modal >
50
+ < Wrapper onClick = { this . toggleModal . bind ( this ) } >
51
+ < Icon src = { `${ ICON_CMD } /flag.svg` } />
52
+ < Title > { title } </ Title >
53
+ </ Wrapper >
54
+ </ React . Fragment >
55
+ )
56
+ }
57
+ }
58
+
59
+ BadContentRepot . propTypes = {
60
+ // https://www.npmjs.com/package/prop-types
61
+ title : PropTypes . string ,
62
+ }
63
+
64
+ BadContentRepot . defaultProps = {
65
+ title : '举报内容' ,
66
+ }
67
+
68
+ export default BadContentRepot
Original file line number Diff line number Diff line change
1
+ import styled from 'styled-components'
2
+
3
+ // import { Img } from '../../../components'
4
+ // import { theme } from '../../../utils'
5
+
6
+ export const Wrapper = styled . div `
7
+ display: flex;
8
+ flex-direction: column;
9
+ padding: 20px;
10
+ `
11
+ export const Divider = styled . div `
12
+ margin-top: 30px;
13
+ `
Original file line number Diff line number Diff line change
1
+ import styled from 'styled-components'
2
+
3
+ import Img from '../../Img'
4
+ import { theme } from '../../../utils'
5
+
6
+ export const Wrapper = styled . div `
7
+ display: flex;
8
+ align-items: center;
9
+ `
10
+ export const Title = styled . div `
11
+ color: ${ theme ( 'thread.articleDigest' ) } ;
12
+ ${ Wrapper } :hover & {
13
+ color: ${ theme ( 'thread.articleTitle' ) } ;
14
+ }
15
+ &:hover {
16
+ cursor: pointer;
17
+ }
18
+ `
19
+ export const Icon = styled ( Img ) `
20
+ fill: ${ theme ( 'thread.articleDigest' ) } ;
21
+ width: 16px;
22
+ height: 16px;
23
+ display: block;
24
+ margin-right: 3px;
25
+ ${ Wrapper } :hover & {
26
+ color: ${ theme ( 'thread.articleTitle' ) } ;
27
+ }
28
+ &:hover {
29
+ cursor: pointer;
30
+ }
31
+ `
Original file line number Diff line number Diff line change
1
+ // import React from 'react'
2
+ // import { shallow } from 'enzyme'
3
+
4
+ // import BadContentRepot from '../index'
5
+
6
+ describe ( 'TODO <BadContentRepot />' , ( ) => {
7
+ it ( 'Expect to have unit tests specified' , ( ) => {
8
+ expect ( true ) . toEqual ( true )
9
+ } )
10
+ } )
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ export { default as ThreadSelector } from './ThreadSelector'
56
56
export { default as CommunityList } from './CommunityList'
57
57
export { default as AuthorCard } from './AuthorCard'
58
58
export { default as ContentSourceCard } from './ContentSourceCard'
59
+ export { default as BadContentRepot } from './BadContentRepot'
59
60
60
61
// loading component
61
62
export {
Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
2
3
- import { AuthorCard , ContentSourceCard } from '../../components'
4
- import { Wrapper } from './styles/side_cards'
3
+ import {
4
+ AuthorCard ,
5
+ ContentSourceCard ,
6
+ BadContentRepot ,
7
+ } from '../../components'
8
+
9
+ import { Wrapper , ReportWrapper } from './styles/side_cards'
5
10
6
11
const SideCards = ( { data } ) => (
7
12
< Wrapper >
8
13
< AuthorCard user = { data . author } />
9
14
< ContentSourceCard data = { data } />
15
+ < ReportWrapper >
16
+ < BadContentRepot />
17
+ </ ReportWrapper >
10
18
</ Wrapper >
11
19
)
12
20
Original file line number Diff line number Diff line change @@ -7,4 +7,6 @@ export const Wrapper = styled.div`
7
7
flex-direction: column;
8
8
width: 22%;
9
9
`
10
- export const holder = 1
10
+ export const ReportWrapper = styled . div `
11
+ padding: 0 10px;
12
+ `
Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
2
3
- import { AuthorCard , ContentSourceCard } from '../../components'
4
- import { Wrapper } from './styles/side_cards'
3
+ import {
4
+ AuthorCard ,
5
+ ContentSourceCard ,
6
+ BadContentRepot ,
7
+ } from '../../components'
8
+ import { Wrapper , ReportWrapper } from './styles/side_cards'
5
9
6
10
const SideCards = ( { data } ) => (
7
11
< Wrapper >
8
12
< AuthorCard user = { data . author } />
9
13
< ContentSourceCard data = { data } />
14
+ < ReportWrapper >
15
+ < BadContentRepot />
16
+ </ ReportWrapper >
10
17
</ Wrapper >
11
18
)
12
19
Original file line number Diff line number Diff line change @@ -7,4 +7,6 @@ export const Wrapper = styled.div`
7
7
flex-direction: column;
8
8
width: 22%;
9
9
`
10
- export const holder = 1
10
+ export const ReportWrapper = styled . div `
11
+ padding: 0 10px;
12
+ `
You can’t perform that action at this time.
0 commit comments