File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
src/pages/Insights/Collection Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 55 IconButton ,
66 Label ,
77 SM ,
8+ Span ,
89 SpecialCard ,
910 Tag ,
1011} from '@appquality/unguess-design-system' ;
@@ -67,6 +68,7 @@ export const ObservationCard = ({
6768 const { t } = useTranslation ( ) ;
6869 const [ isLightboxOpen , setIsLightboxOpen ] = useState ( false ) ;
6970 const { values, setFieldValue } = useFormikContext < InsightFormValues > ( ) ;
71+ const quotesMaxChars = 50 ;
7072
7173 const severity = observation . tags . find (
7274 ( tag ) => tag . group . name === 'severity'
@@ -110,6 +112,13 @@ export const ObservationCard = ({
110112 }
111113 } ;
112114
115+ const getQuotesWithEllipsis = ( quotes : string , maxChars : number = 50 ) => {
116+ if ( quotes . length > maxChars ) {
117+ return `${ quotes . slice ( 0 , maxChars ) } ...` ;
118+ }
119+ return quotes ;
120+ } ;
121+
113122 return (
114123 < FieldArray name = "observations" >
115124 { ( arrayHelpers ) => (
@@ -168,7 +177,19 @@ export const ObservationCard = ({
168177 } }
169178 >
170179 < Quotes isChecked = { isChecked } >
171- "{ observation . quotes } "
180+ "
181+ { observation . quotes &&
182+ observation . quotes . length > quotesMaxChars ? (
183+ < Span title = { observation . quotes } >
184+ { getQuotesWithEllipsis (
185+ observation . quotes ,
186+ quotesMaxChars
187+ ) }
188+ </ Span >
189+ ) : (
190+ observation . quotes
191+ ) }
192+ "
172193 </ Quotes >
173194 </ SpecialCard . Header . Title >
174195 < SpecialCard . Header . Text style = { { marginTop : 'auto' } } >
You can’t perform that action at this time.
0 commit comments