feat: Ability to Hyperlink text in Checkbox on Additional Questions (#15194)
* feat: Ability to Hyperlink text in Checkbox on Additional Questions * update * fix and update * fix type error * fix and update * dpdate * fix type error * fix unit test * Update * fix tests * revert test * remove yarn.lock * remove schema.prisma * update * remove log * revert --------- Co-authored-by: Keith Williams <[email protected]> Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: Amit Sharma <[email protected]>
This commit is contained in:
9 files changed
+118
-38
No files matched your search
@@ -9,18 +9,34 @@ export const Info = (props: {
|
||||
withSpacer?: boolean;
|
||||
lineThrough?: boolean;
|
||||
formatted?: boolean;
|
||||
isLabelHTML?: boolean;
|
||||
}) => {
|
||||
if (!props.description || props.description === "") return null;
|
||||
|
||||
const descriptionCSS = "color: '#101010'; font-weight: 400; line-height: 24px; margin: 0;";
|
||||
|
||||
const safeDescription = markdownToSafeHTML(props.description.toString()) || "";
|
||||
const safeLabel = markdownToSafeHTML(props.label.toString());
|
||||
|
||||
const StyledHtmlContent = ({ htmlContent }: { htmlContent: string }) => {
|
||||
const css = "color: '#101010'; font-weight: 400; line-height: 24px; margin: 0;";
|
||||
return (
|
||||
<p
|
||||
className="dark:text-darkgray-600 mt-2 text-sm text-gray-500 [&_a]:text-blue-500 [&_a]:underline [&_a]:hover:text-blue-600"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: htmlContent
|
||||
.replaceAll("<p>", `<p style="${css}">`)
|
||||
.replaceAll("<li>", `<li style="${css}">`),
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{props.withSpacer && <Spacer />}
|
||||
<div>
|
||||
<p style={{ color: "#101010" }}>{props.label}</p>
|
||||
<p style={{ color: "#101010" }}>
|
||||
{props.isLabelHTML ? <StyledHtmlContent htmlContent={safeLabel} /> : props.label}
|
||||
</p>
|
||||
<p
|
||||
style={{
|
||||
color: "#101010",
|
||||
@@ -29,18 +45,7 @@ export const Info = (props: {
|
||||
whiteSpace: "pre-wrap",
|
||||
textDecoration: props.lineThrough ? "line-through" : undefined,
|
||||
}}>
|
||||
{props.formatted ? (
|
||||
<p
|
||||
className="dark:text-darkgray-600 mt-2 text-sm text-gray-500 [&_a]:text-blue-500 [&_a]:underline [&_a]:hover:text-blue-600"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: safeDescription
|
||||
.replaceAll("<p>", `<p style="${descriptionCSS}">`)
|
||||
.replaceAll("<li>", `<li style="${descriptionCSS}">`),
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
props.description
|
||||
)}
|
||||
{props.formatted ? <StyledHtmlContent htmlContent={safeDescription} /> : props.description}
|
||||
</p>
|
||||
{props.extraInfo}
|
||||
</div>
|
||||
|
||||
@@ -25,6 +25,7 @@ export function UserFieldsResponses(props: { calEvent: CalendarEvent; t: TFuncti
|
||||
: `${labelValueMap[key] ? labelValueMap[key] : ""}`
|
||||
}
|
||||
withSpacer
|
||||
isLabelHTML
|
||||
/>
|
||||
) : null
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user