@nexusui/components
Version:
These are custom components specially-developed for NexusUI applications. They will make your life easier by giving you out-of-the-box implementations for various high-level UI elements that you can drop directly into your application.
2 lines (1 loc) • 1.43 kB
JavaScript
import{jsx as t,jsxs as e,Fragment as a}from"react/jsx-runtime";import{useMemo as i}from"react";import r from"@mui/material/Stack";import o from"@mui/material/Typography";import{styles as n}from"./CommentCard.styles.js";import{TextHighlighter as m}from"./components/TextHighlighter.js";import{CommentRichTextBlock as l}from"../CommentRichText/CommentRichTextBlock.js";const c=c=>{const{multiRowRef:s,expanded:d,expandable:p,onExpandClick:h,maxLines:g=3,message:x,attachments:f=[],tags:C=[],metadata:u,tagging:y=!1,onTagCancel:T,highlight:k,selected:v,replies:L=0,mode:b="plaintext",richTextConfig:w,onEditSave:S,onLayoutChange:j,t:R}=c,$=i((()=>R(d?"readLess":"readMore")),[d,R]);return t(r,{direction:"column",children:"plaintext"===b?e(a,{children:[t(o,{ref:s,variant:"caption",sx:[d?{}:n.truncate,{fontSize:12,WebkitLineClamp:g<1?void 0:`${g}`,wordWrap:"break-word"}],children:t(m,{text:x,highlight:k})}),p&&t(o,{"data-testid":"show-more-text",variant:"caption",color:"primary",sx:{mx:0,mt:3,mb:.5,alignSelf:"flex-start",cursor:"pointer"},onClick:h,children:$}),t(r,{direction:"row",children:!v&&L>0&&t(o,{variant:"caption",sx:{display:"inline-block",mt:2,color:"text.secondary"},children:`${L} ${R(L>1?"replies":"reply")}`})})]}):t(l,{data:x,replies:L,attachments:f,tags:C,metadata:u,tagging:y,onTagCancel:T,maxLines:g,highlight:k,selected:v,richTextConfig:w,onSave:S,onLayoutChange:j})})};export{c as CommentCardContent};