Skip to content

Commit a937eef

Browse files
committed
fix
1 parent f8a59fd commit a937eef

File tree

2 files changed

+4
-55
lines changed

2 files changed

+4
-55
lines changed
Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,6 @@
11
.container {
2-
position: relative;
32
width: 100%;
4-
height: 100%;
3+
min-height: 100%;
54
max-height: 100%;
65
max-width: 100%;
7-
overflow: hidden;
8-
}
9-
10-
.buttons {
11-
position: sticky;
12-
top: 0;
13-
right: 0;
14-
z-index: 1;
15-
}
16-
17-
.button {
18-
width: 4rem;
19-
display: flex;
20-
align-items: center;
21-
justify-content: center;
22-
23-
svg {
24-
width: 32px;
25-
transform: translateY(1px);
26-
}
276
}

src/components/Yaml/YamlViewer.tsx

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { FC } from 'react';
2-
import { Button, FlexBox } from '@ui5/webcomponents-react';
3-
import { useCopyToClipboard } from '../../hooks/useCopyToClipboard.ts';
4-
import { useTranslation } from 'react-i18next';
2+
53
import { YamlEditor } from '../YamlEditor/YamlEditor';
64

75
import styles from './YamlViewer.module.css';
@@ -14,40 +12,12 @@ type YamlViewerProps = {
1412
setShowOnlyImportantData?: (showOnlyImportantData: boolean) => void;
1513
};
1614

17-
// Download button is hidden now due to stakeholder request
18-
const SHOW_DOWNLOAD_BUTTON = false;
19-
20-
export const YamlViewer: FC<YamlViewerProps> = ({ yamlString, filename, yamlStringToCopy }) => {
21-
const { t } = useTranslation();
22-
const { copyToClipboard } = useCopyToClipboard();
23-
const downloadYaml = () => {
24-
const blob = new Blob([yamlString], { type: 'text/yaml' });
25-
const url = window.URL.createObjectURL(blob);
26-
const link = document.createElement('a');
27-
link.href = url;
28-
link.download = `${filename}.yaml`;
29-
document.body.appendChild(link);
30-
link.click();
31-
document.body.removeChild(link);
32-
window.URL.revokeObjectURL(url);
33-
};
34-
15+
export const YamlViewer: FC<YamlViewerProps> = ({ yamlString, filename }) => {
3516
return (
3617
<div className={styles.container}>
37-
<FlexBox className={styles.buttons} direction="Row" justifyContent="End" alignItems="Baseline" gap={16}>
38-
<Button icon="copy" onClick={() => copyToClipboard(yamlStringToCopy ?? yamlString)}>
39-
{t('buttons.copy')}
40-
</Button>
41-
{SHOW_DOWNLOAD_BUTTON && (
42-
<Button icon="download" onClick={downloadYaml}>
43-
{t('buttons.download')}
44-
</Button>
45-
)}
46-
</FlexBox>
47-
4818
{/* Use controlled value with a stable model path to update content without remounting */}
19+
<div>.</div>
4920
<YamlEditor value={yamlString} path={`${filename}.yaml`} options={{ readOnly: true }} />
5021
</div>
5122
);
5223
};
53-

0 commit comments

Comments
 (0)