Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions src/reactComponents/CodeDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ interface CodeDisplayProps {
setAlertErrorMessage: StringFunction;
}

/** Full dimensions style for the syntax highlighter. */
const FULL_SIZE_STYLE = {
width: '100%',
height: '100%',
};

/** Success message for copy operation. */
const COPY_SUCCESS_MESSAGE = 'Copy completed successfully.';

Expand Down Expand Up @@ -86,13 +80,15 @@ export default function CodeDisplay(props: CodeDisplayProps): React.JSX.Element
/** Creates the custom style object for the syntax highlighter. */
const getSyntaxHighlighterStyle = (): React.CSSProperties => ({
backgroundColor: token.colorBgContainer,
...FULL_SIZE_STYLE,
width: '100%',
overflowX: 'hidden',
overflowY: 'auto',
});

/** Renders the header section with title and copy button. */
const renderHeader = (): React.JSX.Element => (
<Antd.Space>
<Antd.Typography.Title level={3}>{t("CODE")}</Antd.Typography.Title>
<Antd.Space align="center">
<Antd.Typography.Title level={3} style={{ margin: 0 }}>{t("CODE")}</Antd.Typography.Title>
<Antd.Tooltip title={t("COPY")}>
<Antd.Button
icon={<CopyIcon />}
Expand All @@ -115,7 +111,7 @@ export default function CodeDisplay(props: CodeDisplayProps): React.JSX.Element
);

return (
<Antd.Flex vertical gap="small">
<Antd.Flex vertical gap="small" style={{ height: '100%' }}>
{renderHeader()}
{renderCodeBlock()}
</Antd.Flex>
Expand Down