Skip to content

Commit

Permalink
fix(SideNav): empty padding in banner (#2463)
Browse files Browse the repository at this point in the history
* fix(SideNav): empty padding in banner

* fix: remove comment

* Create hot-snails-dress.md

* fix: add makeSpace and makeBorderSize
  • Loading branch information
saurabhdaware authored Jan 9, 2025
1 parent 1fc3dcb commit c676f3e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/hot-snails-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@razorpay/blade": patch
---

fix(SideNav): empty padding in banner when banner component returns null
33 changes: 19 additions & 14 deletions packages/blade/src/components/SideNav/SideNav.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ import {
SIDE_NAV_EXPANDED_L1_WIDTH_XL,
} from './tokens';
import BaseBox from '~components/Box/BaseBox';
import { makeMotionTime, makeSize, makeSpace } from '~utils';
import { makeBorderSize, makeMotionTime, makeSize, makeSpace } from '~utils';
import { Drawer, DrawerBody, DrawerHeader } from '~components/Drawer';
import { SkipNavContent, SkipNavLink } from '~components/SkipNav/SkipNav';
import { useIsMobile } from '~utils/useIsMobile';
import { getStyledProps } from '~components/Box/styledProps';
import { metaAttribute, MetaConstants } from '~utils/metaAttribute';
import type { BladeElementRef } from '~utils/types';
import { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';
import { size as sizeTokens } from '~tokens/global';

const {
COLLAPSED,
Expand Down Expand Up @@ -93,6 +94,22 @@ const getL1MenuClassName = ({
return '';
};

const BannerContainer = styled(BaseBox)((props) => {
return {
'&:not(:empty)': {
borderBottom: makeBorderSize(props.theme.border.width.thin),
borderBottomStyle: 'solid',
borderBottomColor: props.theme.colors.surface.border.gray.muted,
borderRight: makeBorderSize(props.theme.border.width.thin),
borderRightStyle: 'solid',
borderRightColor: props.theme.colors.surface.border.gray.muted,
padding: makeSpace(props.theme.spacing[3]),
maxHeight: makeSize(sizeTokens['100']),
width: '100%',
},
};
});

/**
* ### SideNav component
*
Expand Down Expand Up @@ -253,19 +270,7 @@ const _SideNav = (
{...getStyledProps(rest)}
{...makeAnalyticsAttribute(rest)}
>
{banner ? (
<BaseBox
borderBottom="thin"
borderBottomColor="surface.border.gray.muted"
borderRight="thin"
borderRightColor="surface.border.gray.muted"
padding="spacing.3"
maxHeight="100px"
width="100%"
>
{banner}
</BaseBox>
) : null}
{banner ? <BannerContainer>{banner}</BannerContainer> : null}
<BaseBox position="relative" display="block" flex="1" width="100%">
<BaseBox
position="absolute"
Expand Down

0 comments on commit c676f3e

Please sign in to comment.