child-chunks-item.tsx 1011 B

123456789101112131415161718192021222324252627282930
  1. 'use client'
  2. import type { FC } from 'react'
  3. import React from 'react'
  4. import { SliceContent } from '../../formatted-text/flavours/shared'
  5. import Score from './score'
  6. import type { HitTestingChildChunk } from '@/models/datasets'
  7. type Props = {
  8. payload: HitTestingChildChunk
  9. isShowAll: boolean
  10. }
  11. const ChildChunks: FC<Props> = ({
  12. payload,
  13. isShowAll,
  14. }) => {
  15. const { id, score, content, position } = payload
  16. return (
  17. <div
  18. className={!isShowAll ? 'line-clamp-2 break-all' : ''}
  19. >
  20. <div className='inline-flex items-center relative top-[-2px]'>
  21. <div className='flex items-center h-[20.5px] bg-state-accent-solid system-2xs-semibold-uppercase text-text-primary-on-surface px-1'>C-{position}</div>
  22. <Score value={score} besideChunkName />
  23. </div>
  24. <SliceContent className='py-0.5 bg-state-accent-hover group-hover:bg-state-accent-hover text-sm text-text-secondary font-normal'>{content}</SliceContent>
  25. </div>
  26. )
  27. }
  28. export default React.memo(ChildChunks)