Skip to content

Commit 25eb7d3

Browse files
adding smaller yaml button
1 parent 1b62db8 commit 25eb7d3

File tree

4 files changed

+38
-8
lines changed

4 files changed

+38
-8
lines changed

src/components/Graphs/CustomNode.module.css

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,21 @@
2727
white-space: nowrap;
2828
overflow: hidden;
2929
text-overflow: ellipsis;
30-
max-width: 120px;
30+
max-width: 180px;
31+
}
32+
33+
.nodeType {
34+
font-size: 12px;
35+
color: #888;
36+
margin-top: 2px;
37+
}
38+
39+
.yamlButtonWrapper {
40+
margin-left: 0px;
41+
display: flex;
42+
align-items: center;
43+
}
44+
45+
.statusIcon {
46+
margin-right: 6px;
3147
}

src/components/Graphs/CustomNode.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@ const CustomNode: React.FC<CustomNodeProps> = ({ data }) => (
1111
<Handle type="target" position={Position.Top} style={{ visibility: 'hidden' }} />
1212
<Handle type="source" position={Position.Bottom} style={{ visibility: 'hidden' }} />
1313
<div className={styles.nodeContent}>
14-
<StatusIcon status={data.status} />
14+
<div className={styles.statusIcon}>
15+
<StatusIcon status={data.status} />
16+
</div>
1517
<div className={styles.nodeTextContainer}>
1618
<div className={styles.nodeLabel} title={data.label}>
1719
{data.label}
1820
</div>
19-
{data.type && <div>{data.type}</div>}
21+
{data.type && <div className={styles.nodeType}>{data.type}</div>}
2022
</div>
2123
</div>
2224
<div className={styles.yamlButtonWrapper}>
23-
<YamlViewButton resourceObject={data.item} />
25+
<YamlViewButton resourceObject={data.item} smallerIcon={true} />
2426
</div>
2527
</div>
2628
);

src/components/Yaml/YamlViewButton.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Button } from '@ui5/webcomponents-react';
1+
import { Button, Icon } from '@ui5/webcomponents-react';
22
import { FC, useMemo, useState } from 'react';
33
import styles from './YamlViewer.module.css';
44
import { useTranslation } from 'react-i18next';
@@ -10,9 +10,10 @@ import { YamlViewDialog } from './YamlViewDialog.tsx';
1010

1111
export type YamlViewButtonProps = {
1212
resourceObject: unknown;
13+
smallerIcon?: boolean;
1314
};
1415

15-
export const YamlViewButton: FC<YamlViewButtonProps> = ({ resourceObject }) => {
16+
export const YamlViewButton: FC<YamlViewButtonProps> = ({ resourceObject, smallerIcon }) => {
1617
const [isOpen, setIsOpen] = useState(false);
1718
const { t } = useTranslation();
1819
const resource = resourceObject as Resource;
@@ -33,15 +34,15 @@ export const YamlViewButton: FC<YamlViewButtonProps> = ({ resourceObject }) => {
3334
/>
3435

3536
<Button
36-
className={styles.button}
37+
className={smallerIcon ? styles.smallerIconButton : styles.button}
3738
design={'Transparent'}
3839
aria-label={t('buttons.viewResource')}
3940
title={t('buttons.viewResource')}
4041
onClick={() => {
4142
setIsOpen(true);
4243
}}
4344
>
44-
<YamlIcon />
45+
{smallerIcon ? <Icon name="document" className={styles.smallIcon} /> : <YamlIcon />}
4546
</Button>
4647
</span>
4748
);

src/components/Yaml/YamlViewer.module.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99
z-index: 1;
1010
}
1111

12+
.smallIcon {
13+
color: #004CA3;
14+
}
15+
16+
.smallerIconButton {
17+
width: 2rem;
18+
display: flex;
19+
align-items: center;
20+
justify-content: center;
21+
}
22+
1223
.button {
1324
width: 4rem;
1425
display: flex;

0 commit comments

Comments
 (0)