Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import React from "react";
import { RevealStr } from "../RevealStr/RevealStr";
import {
renderWithHighlightedVariables,
renderedTemplate,
renderedStrTemplate,
} from "@/util/string";
export interface TemplateStrInterface {
template: string;
args: Record<string, string>;
}
export const TemplateStr: React.FC<TemplateStrInterface> = (props) => {
if (props.template === renderedStrTemplate(props.template, props.args)) {
return <p>"{props.template}"</p>;
}
const template = renderWithHighlightedVariables(props.template);
const reveal = renderedTemplate(props.template, props.args);
return <RevealStr template={template} reveal={reveal} />;
};
|