Skip to content

Commit a75b16a

Browse files
4manasamanasa
andauthored
Added support for two-column and narrow-wide templates in Banner template (#110)
* Added QuickCreate component to support Quick links in wss portal Co-authored-by: manasa <[email protected]>
1 parent 8c148e5 commit a75b16a

File tree

5 files changed

+41
-25
lines changed

5 files changed

+41
-25
lines changed

packages/react-sdk-components/src/components/designSystemExtension/Banner/Banner.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@
3333
font-size: 1rem;
3434
font-weight: 400;
3535
}
36+
37+
.banner-layout {
38+
padding: 1rem;
39+
}

packages/react-sdk-components/src/components/designSystemExtension/Banner/Banner.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@ import Grid from '@material-ui/core/Grid';
33
import './Banner.css';
44

55
export default function Banner(props) {
6-
const { a, b, banner } = props;
6+
const { a, b, banner, variant} = props;
77
const { title, message, backgroundImage } = banner;
8+
const variantMap = {
9+
'two-column': [6, 6],
10+
'narrow-wide': [4, 8],
11+
'wide-narrow': [8, 4]
12+
};
813
return (
914
<div style={{ marginBottom: '2rem' }}>
1015
<div
@@ -18,16 +23,14 @@ export default function Banner(props) {
1823
</div>
1924
</div>
2025
</div>
21-
<div style={{ padding: '1rem' }}>
22-
<Grid container item xs={12} spacing={1}>
23-
<Grid item xs={8} style={{ padding: '1em' }}>
24-
{a}
25-
</Grid>
26-
<Grid item xs={4} style={{ padding: '1em' }}>
27-
{b}
28-
</Grid>
26+
<Grid container item xs={12} className='banner-layout' spacing={1}>
27+
<Grid item xs={variantMap[variant][0]} style={{ padding: '1em' }}>
28+
{a}
2929
</Grid>
30-
</div>
30+
<Grid item xs={variantMap[variant][1]} style={{ padding: '1em' }}>
31+
{b}
32+
</Grid>
33+
</Grid>
3134
</div>
3235
);
3336
}

packages/react-sdk-components/src/components/designSystemExtension/WssQuickCreate/WssQuickCreate.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.quick-link-ul-list {
22
list-style: none;
33
padding: 0;
4-
grid-template-columns: repeat(3, 1fr);
4+
grid-template-columns: repeat(auto-fill, minmax(min(40ch, 100%), 1fr));
55
display: grid;
66
gap: calc(1rem);
77
}
@@ -33,4 +33,8 @@
3333
display: flex;
3434
align-items: center;
3535
gap: 0.5rem;
36-
}
36+
}
37+
38+
.quick-link-heading {
39+
margin-top: 8px;
40+
}

packages/react-sdk-components/src/components/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default function WssQuickCreate(props) {
77

88
return (
99
<div>
10-
<h1>{heading}</h1>
10+
<h1 className='quick-link-heading'>{heading}</h1>
1111
<ul className='quick-link-ul-list'>
1212
{actions &&
1313
actions.map(element => {

packages/react-sdk-components/src/components/template/WssNavBar/WssNavBar.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const useStyles = makeStyles(theme => ({
3434

3535
export default function WssNavBar(props) {
3636
const { appInfo, navLinks, operator, navDisplayOptions } = props;
37-
const { alignment } = navDisplayOptions;
37+
const { alignment, position } = navDisplayOptions;
3838
const classes = useStyles();
3939

4040
const [anchorElNav, setAnchorElNav] = useState<null | HTMLElement>(null);
@@ -55,11 +55,24 @@ export default function WssNavBar(props) {
5555
setAnchorElUser(null);
5656
};
5757

58+
const navLinksContent = (
59+
<Box
60+
sx={{ flexGrow: 1, display: { xs: 'none', md: 'flex' } }}
61+
style={{ justifyContent: alignment }}
62+
>
63+
{navLinks.map(link => (
64+
<Button className='link-style' key={link.text} onClick={link.onClick}>
65+
{link.text}
66+
</Button>
67+
))}
68+
</Box>
69+
);
70+
5871
return (
5972
<div id='NavBar' className='nav-bar'>
6073
<AppBar position='static' color='primary'>
6174
<Container maxWidth='xl'>
62-
<Toolbar disableGutters>
75+
<Toolbar disableGutters style={{ justifyContent: 'space-between' }}>
6376
<Button style={{ textTransform: 'capitalize' }} onClick={appInfo.onClick}>
6477
<img src={appInfo.imageSrc} className={classes.appListLogo} />
6578
<span className={classes.appName}>{appInfo.appName}</span>
@@ -98,16 +111,7 @@ export default function WssNavBar(props) {
98111
</Menu>
99112
</Box>
100113

101-
<Box
102-
sx={{ flexGrow: 1, display: { xs: 'none', md: 'flex' } }}
103-
style={{ justifyContent: alignment }}
104-
>
105-
{navLinks.map(link => (
106-
<Button className='link-style' key={link.text} onClick={link.onClick}>
107-
{link.text}
108-
</Button>
109-
))}
110-
</Box>
114+
{position === 'inline' && <>{navLinksContent}</>}
111115

112116
<Box sx={{ flexGrow: 0 }}>
113117
<IconButton onClick={handleOpenUserMenu}>
@@ -134,6 +138,7 @@ export default function WssNavBar(props) {
134138
</Menu>
135139
</Box>
136140
</Toolbar>
141+
{position === 'below' && <>{navLinksContent}</>}
137142
</Container>
138143
</AppBar>
139144
</div>

0 commit comments

Comments
 (0)