Skip to content

Commit 2d5d9f6

Browse files
committed
fix
1 parent 0e1fe63 commit 2d5d9f6

File tree

7 files changed

+44
-40
lines changed

7 files changed

+44
-40
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.container {
2+
position: relative;
3+
4+
width: 100%;
5+
height: 100%;
6+
max-height: 100%;
7+
max-width: 100%;
8+
overflow: hidden;
9+
}

src/components/Yaml/YamlDiff.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import { FC } from 'react';
22

33
import { YamlDiffEditor } from '../YamlEditor/YamlDiffEditor.tsx';
4-
4+
import styles from './YamlDiff.module.css';
55
type YamlDiffProps = {
66
originalYaml: string;
77
modifiedYaml: string;
88
};
99

1010
export const YamlDiff: FC<YamlDiffProps> = ({ originalYaml, modifiedYaml }) => {
11-
return <YamlDiffEditor original={originalYaml} modified={modifiedYaml} />;
11+
return (
12+
<div className={styles.container}>
13+
<YamlDiffEditor original={originalYaml} modified={modifiedYaml} />
14+
</div>
15+
);
1216
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.wrapper {
2+
width: 100%;
3+
height: 100%;
4+
max-height: 100%;
5+
max-width: 100%;
6+
}

src/components/Yaml/YamlViewDialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Bar, Button, CheckBox, Dialog } from '@ui5/webcomponents-react';
22

33
import { FC, ReactNode } from 'react';
44
import { useTranslation } from 'react-i18next';
5-
5+
import styles from './YamlViewDialog.module.css';
66
export type YamlViewDialogProps = {
77
isOpen: boolean;
88
setIsOpen: (isOpen: boolean) => void;
@@ -51,7 +51,7 @@ export const YamlViewDialog: FC<YamlViewDialogProps> = ({
5151
setIsOpen(false);
5252
}}
5353
>
54-
{isOpen && dialogContent}
54+
<div className={styles.wrapper}>{isOpen && dialogContent}</div>
5555
</Dialog>
5656
);
5757
};

src/components/Yaml/YamlViewer.module.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
.container {
22
position: relative;
3+
width: 100%;
4+
height: 100%;
5+
max-height: 100%;
6+
max-width: 100%;
7+
overflow: hidden;
38
}
49

510
.buttons {
@@ -19,4 +24,4 @@
1924
width: 32px;
2025
transform: translateY(1px);
2126
}
22-
}
27+
}

src/components/Yaml/YamlViewer.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const SHOW_DOWNLOAD_BUTTON = false;
1919

2020
export const YamlViewer: FC<YamlViewerProps> = ({ yamlString, filename, yamlStringToCopy }) => {
2121
const { t } = useTranslation();
22-
// const { isDarkTheme } = useTheme();
2322
const { copyToClipboard } = useCopyToClipboard();
2423
const downloadYaml = () => {
2524
const blob = new Blob([yamlString], { type: 'text/yaml' });
@@ -32,7 +31,7 @@ export const YamlViewer: FC<YamlViewerProps> = ({ yamlString, filename, yamlStri
3231
document.body.removeChild(link);
3332
window.URL.revokeObjectURL(url);
3433
};
35-
console.log(yamlString);
34+
3635
return (
3736
<div className={styles.container}>
3837
<FlexBox className={styles.buttons} direction="Row" justifyContent="End" alignItems="Baseline" gap={16}>

src/lib/monaco.ts

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,48 +13,29 @@ loader.config({ monaco });
1313
export const GITHUB_LIGHT_DEFAULT = 'github-light-default';
1414
export const GITHUB_DARK_DEFAULT = 'github-dark-default';
1515

16-
// Lightweight RGBA helper
17-
function rgba(hex: string, alpha: number) {
18-
const h = hex.replace('#', '');
19-
const v =
20-
h.length === 3
21-
? h
22-
.split('')
23-
.map((c) => c + c)
24-
.join('')
25-
: h;
26-
const n = parseInt(v, 16);
27-
// If parse fails, fallback to transparent
28-
if (Number.isNaN(n)) return `rgba(0,0,0,${alpha})`;
29-
const r = (n >> 16) & 255;
30-
const g = (n >> 8) & 255;
31-
const b = n & 255;
32-
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
33-
}
34-
3516
// Inlined GitHub Light Default editor colors (subset focused on Monaco editor UI)
3617
const GITHUB_LIGHT_EDITOR_COLORS: monaco.editor.IColors = {
3718
'editor.foreground': '#1f2328',
3819
'editor.background': '#ffffff',
3920
'editorWidget.background': '#f6f8fa',
4021
'editor.lineHighlightBackground': '#eaeef2',
4122
'editorCursor.foreground': '#0969da',
42-
'editor.selectionBackground': rgba('#0969da', 0.2),
43-
'editor.inactiveSelectionBackground': rgba('#0969da', 0.07),
44-
'editor.selectionHighlightBackground': rgba('#1a7f37', 0.25),
23+
'editor.selectionBackground': '#0969da33', // 20% opacity
24+
'editor.inactiveSelectionBackground': '#0969da12', // 7% opacity
25+
'editor.selectionHighlightBackground': '#1a7f3740', // 25% opacity
4526
'editorLineNumber.foreground': '#8c959f',
4627
'editorLineNumber.activeForeground': '#1f2328',
47-
'editorIndentGuide.background': rgba('#1f2328', 0.12),
48-
'editorIndentGuide.activeBackground': rgba('#1f2328', 0.24),
28+
'editorIndentGuide.background': '#1f23281f', // 12% opacity
29+
'editorIndentGuide.activeBackground': '#1f23283d', // 24% opacity
4930
'editorGutter.background': '#ffffff',
5031
'editorHoverWidget.background': '#f6f8fa',
5132
'editorHoverWidget.border': '#d0d7de',
5233
'editorSuggestWidget.background': '#f6f8fa',
5334
'editorSuggestWidget.border': '#d0d7de',
5435
'editorWidget.border': '#d0d7de',
5536
'editorWhitespace.foreground': '#d0d7de',
56-
'editor.wordHighlightBackground': rgba('#afb8c1', 0.5),
57-
'editor.wordHighlightStrongBackground': rgba('#afb8c1', 0.3),
37+
'editor.wordHighlightBackground': '#afb8c180', // 50% opacity
38+
'editor.wordHighlightStrongBackground': '#afb8c14d', // 30% opacity
5839
};
5940

6041
// Inlined GitHub Dark Default editor colors (subset focused on Monaco editor UI)
@@ -64,22 +45,22 @@ const GITHUB_DARK_EDITOR_COLORS: monaco.editor.IColors = {
6445
'editorWidget.background': '#161b22',
6546
'editor.lineHighlightBackground': '#161b22',
6647
'editorCursor.foreground': '#2f81f7',
67-
'editor.selectionBackground': rgba('#2f81f7', 0.2),
68-
'editor.inactiveSelectionBackground': rgba('#2f81f7', 0.07),
69-
'editor.selectionHighlightBackground': rgba('#2ea043', 0.25),
48+
'editor.selectionBackground': '#2f81f733', // 20% opacity
49+
'editor.inactiveSelectionBackground': '#2f81f712', // 7% opacity
50+
'editor.selectionHighlightBackground': '#2ea04340', // 25% opacity
7051
'editorLineNumber.foreground': '#6e7681',
7152
'editorLineNumber.activeForeground': '#e6edf3',
72-
'editorIndentGuide.background': rgba('#e6edf3', 0.12),
73-
'editorIndentGuide.activeBackground': rgba('#e6edf3', 0.24),
53+
'editorIndentGuide.background': '#e6edf31f', // 12% opacity
54+
'editorIndentGuide.activeBackground': '#e6edf33d', // 24% opacity
7455
'editorGutter.background': '#0d1117',
7556
'editorHoverWidget.background': '#161b22',
7657
'editorHoverWidget.border': '#30363d',
7758
'editorSuggestWidget.background': '#161b22',
7859
'editorSuggestWidget.border': '#30363d',
7960
'editorWidget.border': '#30363d',
8061
'editorWhitespace.foreground': '#484f58',
81-
'editor.wordHighlightBackground': rgba('#6e7681', 0.5),
82-
'editor.wordHighlightStrongBackground': rgba('#6e7681', 0.3),
62+
'editor.wordHighlightBackground': '#6e768180', // 50% opacity
63+
'editor.wordHighlightStrongBackground': '#6e76814d', // 30% opacity
8364
};
8465

8566
export const configureMonaco = () => {

0 commit comments

Comments
 (0)