Skip to content

Commit 5a67fb4

Browse files
committed
Update YamlViewer.tsx
1 parent d069cc5 commit 5a67fb4

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

src/components/Yaml/YamlViewer.tsx

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { FC } from 'react';
22
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
3-
import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism'; // You can choose different styles
3+
import {
4+
materialLight,
5+
materialDark,
6+
} from 'react-syntax-highlighter/dist/esm/styles/prism'; // You can choose different styles
47
import YAML from 'yaml';
58
import { Button } from '@ui5/webcomponents-react';
69

@@ -31,7 +34,7 @@ const YamlViewer: FC<YamlViewerProps> = ({ yamlString }) => {
3134
}
3235

3336
return (
34-
<div style={{ position: 'relative', maxWidth: '800px', margin: '20px' }}>
37+
<div style={{ position: 'relative', width: '80%' }}>
3538
<Button
3639
style={{
3740
position: 'absolute',
@@ -50,26 +53,30 @@ const YamlViewer: FC<YamlViewerProps> = ({ yamlString }) => {
5053
Copy
5154
</Button>
5255
<Button
53-
style={{
54-
position: 'absolute',
55-
top: '10px',
56-
right: '90px',
57-
padding: '5px 10px',
58-
background: '#28a745',
59-
color: 'white',
60-
border: 'none',
61-
borderRadius: '4px',
62-
cursor: 'pointer',
63-
zIndex: 1,
64-
}}
56+
// style={{
57+
// position: 'absolute',
58+
// top: '10px',
59+
// right: '90px',
60+
// padding: '5px 10px',
61+
// background: '#28a745',
62+
// color: 'white',
63+
// border: 'none',
64+
// borderRadius: '4px',
65+
// cursor: 'pointer',
66+
// zIndex: 1,
67+
// }}
6568
onClick={downloadYaml}
6669
>
6770
Download
6871
</Button>
6972

7073
<SyntaxHighlighter
7174
language="yaml"
72-
style={vscDarkPlus}
75+
style={
76+
window.matchMedia('(prefers-color-scheme: dark)').matches
77+
? materialDark
78+
: materialLight
79+
}
7380
showLineNumbers={true}
7481
wrapLines={true}
7582
lineNumberStyle={{
@@ -82,8 +89,8 @@ const YamlViewer: FC<YamlViewerProps> = ({ yamlString }) => {
8289
margin: 0,
8390
padding: '20px',
8491
borderRadius: '4px',
85-
background: '#1e1e1e',
86-
fontSize: '14px',
92+
fontSize: '1rem',
93+
width: '100%',
8794
}}
8895
>
8996
{formattedYaml}

0 commit comments

Comments
 (0)