Skip to content

Commit 7ba4c62

Browse files
pujaganidiemol
andauthored
[grid] Align the stereotype information for each Node (UI) (#9157)
Co-authored-by: Diego Molina <[email protected]>
1 parent 0d3c330 commit 7ba4c62

File tree

2 files changed

+36
-19
lines changed

2 files changed

+36
-19
lines changed

javascript/grid-ui/src/components/Node/Node.tsx

+35-18
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ const useStyles = makeStyles({
4343
},
4444
buttonMargin: {
4545
padding: 1,
46+
},
47+
slotInfo: {
48+
marginBottom: 10,
49+
marginRight: 0,
4650
}
4751
});
4852

@@ -79,6 +83,35 @@ export default function Node(props) {
7983
// Then we need to know how many columns we will display.
8084
const columnWidth: GridSize = 12 / stereotypeColumns as any;
8185

86+
function CreateStereotypeGridItem(slotStereotype: any, index: any) {
87+
return (
88+
<Grid container item alignItems='center' spacing={1}>
89+
<Grid item key={index}>
90+
<img
91+
src={browserLogo(slotStereotype.stereotype.browserName)}
92+
className={classes.browserLogo}
93+
alt="Browser Logo"
94+
/>
95+
</Grid>
96+
<Grid item key={index}>
97+
<Typography className={classes.slotInfo}>
98+
{slotStereotype.slots}
99+
</Typography>
100+
</Grid>
101+
<Grid item key={index}>
102+
<Typography className={classes.slotInfo}>
103+
{
104+
browserVersion(
105+
slotStereotype.stereotype.browserVersion ??
106+
slotStereotype.stereotype.version
107+
)
108+
}
109+
</Typography>
110+
</Grid>
111+
</Grid>
112+
);
113+
}
114+
82115
return (
83116
<Card
84117
className={classes.root}
@@ -178,24 +211,8 @@ export default function Node(props) {
178211
nodeInfo.slotStereotypes
179212
.slice(index * 3, Math.min((index * 3) + 3, nodeInfo.slotStereotypes.length))
180213
.map((slotStereotype: any, idx) => {
181-
return (<Typography
182-
color="textPrimary"
183-
variant="h6"
184-
key={idx}
185-
>
186-
<img
187-
src={browserLogo(slotStereotype.stereotype.browserName)}
188-
className={classes.browserLogo}
189-
alt="Browser Logo"
190-
/>
191-
{slotStereotype.slots}
192-
{
193-
browserVersion(
194-
slotStereotype.stereotype.browserVersion ??
195-
slotStereotype.stereotype.version
196-
)
197-
}
198-
</Typography>
214+
return(
215+
CreateStereotypeGridItem(slotStereotype, idx)
199216
)
200217
})}
201218
</Grid>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const browserVersion = (version: string): string => {
22
const browserVersion = version ?? "";
3-
return browserVersion.length > 0 ? " - v." + browserVersion : browserVersion;
3+
return browserVersion.length > 0 ? "v." + browserVersion : browserVersion;
44
}
55

66
export default browserVersion;

0 commit comments

Comments
 (0)