@@ -23,12 +23,12 @@ import {
2323 AddText ,
2424} from './styles'
2525
26- const TagsList = ( { tags , partId , onDelete } ) => (
26+ const TagsList = ( { source , onDelete } ) => (
2727 < CategoryWrapper >
28- { tags . map ( c => (
28+ { source . tags . map ( c => (
2929 < CategoryTag
3030 key = { shortid . generate ( ) }
31- onClick = { onDelete . bind ( this , partId , c ) }
31+ onClick = { onDelete . bind ( this , source . id , c ) }
3232 >
3333 { c . title }
3434 < DeleteCross > x</ DeleteCross >
@@ -43,19 +43,19 @@ class TagsCell extends React.Component {
4343 componentWillUnmount ( ) { }
4444
4545 render ( ) {
46- const { tags , partId , onDelete, onAdd } = this . props
46+ const { source , onDelete, onAdd } = this . props
4747
4848 return (
4949 < React . Fragment >
50- { R . isEmpty ( tags ) ? (
50+ { R . isEmpty ( source . tags ) ? (
5151 < AddWrapper >
5252 < AddIcon src = { `${ ICON_ASSETS } /cmd/plus.svg` } />
53- < AddText onClick = { onAdd . bind ( this , partId , [ ] ) } > 添加</ AddText >
53+ < AddText onClick = { onAdd . bind ( this , source ) } > 添加</ AddText >
5454 </ AddWrapper >
5555 ) : (
5656 < Wrapper >
57- < TagsList tags = { tags } partId = { partId } onDelete = { onDelete } />
58- < div onClick = { onAdd . bind ( this , partId , tags ) } >
57+ < TagsList source = { source } onDelete = { onDelete } />
58+ < div onClick = { onAdd . bind ( this , source ) } >
5959 < AddIcon src = { `${ ICON_ASSETS } /cmd/plus.svg` } />
6060 </ div >
6161 </ Wrapper >
@@ -70,18 +70,9 @@ export default TagsCell
7070TagsCell . propTypes = {
7171 // https://www.npmjs.com/package/prop-types
7272 /* communityId: PropTypes.number.isRequired, */
73- tags : PropTypes . arrayOf (
74- PropTypes . shape ( {
75- id : PropTypes . string ,
76- title : PropTypes . string ,
77- color : PropTypes . string ,
78- } )
79- ) ,
80- partId : PropTypes . string . isRequired ,
73+ source : PropTypes . object . isRequired ,
8174 onDelete : PropTypes . func . isRequired ,
8275 onAdd : PropTypes . func . isRequired ,
8376}
8477
85- TagsCell . defaultProps = {
86- tags : [ ] ,
87- }
78+ TagsCell . defaultProps = { }
0 commit comments