in with the new
This commit is contained in:
24
src/core/components/highlight-code.jsx
Normal file
24
src/core/components/highlight-code.jsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import React, { Component, PropTypes } from "react"
|
||||
import { highlight } from "core/utils"
|
||||
|
||||
export default class HighlightCode extends Component {
|
||||
static propTypes = {
|
||||
value: PropTypes.string.isRequired,
|
||||
className: PropTypes.string
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
highlight(this.refs.el)
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
highlight(this.refs.el)
|
||||
}
|
||||
|
||||
render () {
|
||||
let { value, className } = this.props
|
||||
className = className || ""
|
||||
|
||||
return <pre ref="el" className={className + " microlight"}>{ value }</pre>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user