| 1 |
import React from 'react'; |
| 2 |
|
| 3 |
const decodeEntities = (str) => { |
| 4 |
if (typeof window === 'undefined') return str; |
| 5 |
const txt = document.createElement('textarea'); |
| 6 |
txt.innerHTML = str; |
| 7 |
return txt.value; |
| 8 |
}; |
| 9 |
|
| 10 |
const Title = ({ title, titleTag = 'h2' }) => { |
| 11 |
const decodedTitle = decodeEntities(title); |
| 12 |
|
| 13 |
return React.createElement( |
| 14 |
titleTag, |
| 15 |
{ className: 'betterdocs-category-title' }, |
| 16 |
decodedTitle |
| 17 |
); |
| 18 |
}; |
| 19 |
|
| 20 |
export default Title; |
| 21 |
|