Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2895 | Rev 2897 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 2895 Rev 2896
Línea 1... Línea 1...
1
import React, { useState, useCallback, useMemo } from 'react'
1
import React, { useState, useCallback } from 'react'
2
import { Typography } from '@mui/material'
2
import { Typography } from '@mui/material'
Línea 3... Línea 3...
3
 
3
 
Línea 4... Línea 4...
4
import { parse } from '@utils'
4
import { parse } from '@utils'
5
 
5
 
6
export default function FeedDescription({ description = '' }) {
-
 
Línea 7... Línea 6...
7
  const [showMore, setShowMore] = useState(false)
6
export default function FeedDescription({ description = '' }) {
-
 
7
  const [showMore, setShowMore] = useState(false)
8
  const maxLength = 300
8
 
9
 
9
  const stripText = description.replace(/<p>|<\/p>/g, '')
Línea 10... Línea 10...
10
  const parsedText = useMemo(parse(description ?? ''), [description])
10
  const maxLength = 300
11
  const truncatedText = parsedText.slice(0, maxLength)
11
  const truncatedText = stripText.slice(0, maxLength)
12
  const isTruncated = parsedText.length > maxLength
12
  const isTruncated = stripText.length > maxLength
13
 
13
 
Línea 14... Línea 14...
14
  const toggleShowMore = useCallback(
14
  const toggleShowMore = useCallback(
15
    () => setShowMore((prevState) => !prevState),
15
    () => setShowMore((prevState) => !prevState),
16
    []
16
    []
Línea 17... Línea 17...
17
  )
17
  )
18
 
18
 
19
  return (
19
  return (
20
    <Typography onClick={toggleShowMore}>
20
    <Typography onClick={toggleShowMore}>