Skip to content

Commit c676f3e

Browse files
fix(SideNav): empty padding in banner (#2463)
* fix(SideNav): empty padding in banner * fix: remove comment * Create hot-snails-dress.md * fix: add makeSpace and makeBorderSize
1 parent 1fc3dcb commit c676f3e

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

.changeset/hot-snails-dress.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@razorpay/blade": patch
3+
---
4+
5+
fix(SideNav): empty padding in banner when banner component returns null

packages/blade/src/components/SideNav/SideNav.web.tsx

+19-14
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ import {
1313
SIDE_NAV_EXPANDED_L1_WIDTH_XL,
1414
} from './tokens';
1515
import BaseBox from '~components/Box/BaseBox';
16-
import { makeMotionTime, makeSize, makeSpace } from '~utils';
16+
import { makeBorderSize, makeMotionTime, makeSize, makeSpace } from '~utils';
1717
import { Drawer, DrawerBody, DrawerHeader } from '~components/Drawer';
1818
import { SkipNavContent, SkipNavLink } from '~components/SkipNav/SkipNav';
1919
import { useIsMobile } from '~utils/useIsMobile';
2020
import { getStyledProps } from '~components/Box/styledProps';
2121
import { metaAttribute, MetaConstants } from '~utils/metaAttribute';
2222
import type { BladeElementRef } from '~utils/types';
2323
import { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';
24+
import { size as sizeTokens } from '~tokens/global';
2425

2526
const {
2627
COLLAPSED,
@@ -93,6 +94,22 @@ const getL1MenuClassName = ({
9394
return '';
9495
};
9596

97+
const BannerContainer = styled(BaseBox)((props) => {
98+
return {
99+
'&:not(:empty)': {
100+
borderBottom: makeBorderSize(props.theme.border.width.thin),
101+
borderBottomStyle: 'solid',
102+
borderBottomColor: props.theme.colors.surface.border.gray.muted,
103+
borderRight: makeBorderSize(props.theme.border.width.thin),
104+
borderRightStyle: 'solid',
105+
borderRightColor: props.theme.colors.surface.border.gray.muted,
106+
padding: makeSpace(props.theme.spacing[3]),
107+
maxHeight: makeSize(sizeTokens['100']),
108+
width: '100%',
109+
},
110+
};
111+
});
112+
96113
/**
97114
* ### SideNav component
98115
*
@@ -253,19 +270,7 @@ const _SideNav = (
253270
{...getStyledProps(rest)}
254271
{...makeAnalyticsAttribute(rest)}
255272
>
256-
{banner ? (
257-
<BaseBox
258-
borderBottom="thin"
259-
borderBottomColor="surface.border.gray.muted"
260-
borderRight="thin"
261-
borderRightColor="surface.border.gray.muted"
262-
padding="spacing.3"
263-
maxHeight="100px"
264-
width="100%"
265-
>
266-
{banner}
267-
</BaseBox>
268-
) : null}
273+
{banner ? <BannerContainer>{banner}</BannerContainer> : null}
269274
<BaseBox position="relative" display="block" flex="1" width="100%">
270275
<BaseBox
271276
position="absolute"

0 commit comments

Comments
 (0)