Rev 2850 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
import React, { useState } from 'react'import parse from 'html-react-parser'export default function FeedDescription({ description }) {const [showMore, setShowMore] = useState(false)const toggleShowMore = () => setShowMore(!showMore)if (description.length > 120) {const result = description.replace(/<\/?p>/g, '')const parseDescription = parse(showMore ? result : result.slice(0, 120))return (<p onClickCapture={toggleShowMore}>{parseDescription}<span>{showMore ? ' ver menos' : '... ver más'}</span></p>)}return parse(description)}