11import React , { Component } from 'react'
2+ import { withRouter } from 'react-router'
23import PropTypes from 'prop-types'
34import Namecard from './Namecard'
45import Line from './Line'
56import { printTime } from '../policy'
6-
7- const Popover = require ( 'antd/lib/popover' )
7+ import { Popover } from 'antd'
88
99class Noti extends Component {
10+ routeToFeed ( feedId ) {
11+ this . props . history . push ( `/feed/${ feedId } ` )
12+ }
13+
1014 render ( ) {
1115 const noti = this . props . content
12- console . log ( noti )
1316 const nickname = `${ noti . from . nTh } 기 ${ noti . from . fullname } `
1417 return (
1518 < div key = { noti . id } >
1619 < div
1720 className = "noti"
1821 // eslint-disable-next-line
19- onClick = { ( ) => console . log ( noti . id ) }
22+ onClick = { ( ) => this . routeToFeed ( noti . id ) }
2023 style = {
2124 noti . had_read
2225 ? { height : '56px' , display : 'flex' , alignItems : 'stretch' }
@@ -48,21 +51,19 @@ class Noti extends Component {
4851 placement = "leftTop"
4952 content = { < Namecard content = { noti . from } /> }
5053 >
51- < a href = "#" >
52- { ' ' }
54+ < a style = { { fontSize : '10pt' } } href = "#" >
5355 { nickname }
5456 </ a >
5557 </ Popover >
5658 </ div >
57- < div style = { { color : 'rgba(1,1,1,0.5)' } } >
58- { ' ' }
59+ < div style = { { fontSize : '9pt' , color : 'rgba(1,1,1,0.5)' } } >
5960 { printTime ( noti . createdAt ) }
60- { ' ' }
6161 </ div >
6262 </ div >
6363 < div style = { { flexGrow : '1' , display : 'flex' , marginLeft : '12px' } } >
6464 < a href = "#" >
6565 < div style = { {
66+ fontSize : '9pt' ,
6667 color : 'rgba(0,0,0, 0.8)' , wordWrap : 'break-word' , WebkitBoxOrient : 'vertical' , WebkitLineClamp : '2' , width : '232px' , textOverflow : 'ellipsis' , overflow : 'hidden' , display : '-webkit-box' ,
6768 } }
6869 >
@@ -80,6 +81,7 @@ class Noti extends Component {
8081
8182Noti . propTypes = {
8283 content : PropTypes . object . isRequired ,
84+ history : PropTypes . object . isRequired ,
8385}
8486
85- export default Noti
87+ export default withRouter ( Noti )
0 commit comments