Ensure ending newline is displayed

This commit is contained in:
David Corbitt
2023-08-17 03:37:32 -07:00
parent edac8da4a8
commit acf74909c9

View File

@@ -10,6 +10,7 @@ const CopiableCode = ({ code, ...rest }: { code: string } & StackProps) => {
await navigator.clipboard.writeText(code);
setCopied(true);
}, [code]);
return (
<HStack
backgroundColor="blackAlpha.800"
@@ -29,6 +30,8 @@ const CopiableCode = ({ code, ...rest }: { code: string } & StackProps) => {
whiteSpace="pre-wrap"
>
{code}
{/* Necessary for trailing newline to actually be displayed */}
{code.endsWith("\n") ? "\n" : ""}
</Text>
<Tooltip closeOnClick={false} label={copied ? "Copied!" : "Copy to clipboard"}>
<IconButton