MCPcopy Index your code
hub / github.com/harness/harness / String

Function String

web/src/framework/strings/String.tsx:56–76  ·  view source on GitHub ↗
(props: StringProps)

Source from the content-addressed store, hash-verified

54}
55
56export function String(props: StringProps): React.ReactElement | null {
57 const { stringID, vars, useRichText, tagName, ...rest } = props
58 const { getString } = useStrings()
59 const Tag = tagName as ElementType
60
61 try {
62 const text = getString(stringID, vars)
63
64 return useRichText ? (
65 <Tag {...(rest as unknown as {})} dangerouslySetInnerHTML={{ __html: text }} />
66 ) : (
67 <Tag {...(rest as unknown as {})}>{text}</Tag>
68 )
69 } catch (e) {
70 if (process.env.NODE_ENV !== 'production') {
71 return <Tag style={{ color: 'var(--red-500)' }}>{get(e, 'message', e)}</Tag>
72 }
73
74 return null
75 }
76}
77
78String.defaultProps = {
79 tagName: 'span'

Callers 15

getCommentLineInfoFunction · 0.50
usePullReqCommentsFunction · 0.50
toggleCommentsFunction · 0.50
CommentsThreadFunction · 0.50
MarkdownViewerFunction · 0.50
mapToSelectOptionsFunction · 0.50
CommitsViewFunction · 0.50
ProtectionRulesListingFunction · 0.50
ConsoleStepFunction · 0.50
ChangesInternalFunction · 0.50
CommitRangeFunction · 0.50

Calls 3

getFunction · 0.85
useStringsFunction · 0.70
getStringFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…