Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(DatePicker): adjust icon vertical margins for better alignment #2503

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/grumpy-turtles-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@razorpay/blade": patch
---

fix(DatePicker): adjust icon vertical margins for better alignment
19 changes: 4 additions & 15 deletions packages/blade/src/components/DatePicker/DateInput.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ const HiddenInput = ({
};

const iconVerticalMargin = {
medium: sizeTokens[14],
large: sizeTokens[24],
medium: sizeTokens[6],
large: sizeTokens[12],
} as const;
const LEFT_LABEL_WIDTH = 132;

Expand All @@ -99,7 +99,6 @@ const _DatePickerInput = (
ref: React.ForwardedRef<any>,
): React.ReactElement => {
const isMobile = useIsMobile();
const isLarge = size === 'large';
const hasLabel = typeof label === 'string' ? Boolean(label) : Boolean(label?.start || label?.end);
const isLabelPositionLeft = labelPosition === 'left';
const isLabelPositionTop = labelPosition === 'top';
Expand Down Expand Up @@ -213,18 +212,8 @@ const _DatePickerInput = (
{...referenceProps}
/>
</BaseBox>
<BaseBox flexShrink={0} alignSelf="start">
<ArrowRightIcon
size="medium"
marginTop={
// Hacky layouting because the we cannot put this inside the internal layout of BaseInput.
hasLabel && (!isLabelPositionLeft || isMobile)
? `calc(${makeSize(iconVerticalMargin[size])} + ${makeSize(
isLarge ? sizeTokens[20] : sizeTokens[15],
)})`
: makeSize(iconVerticalMargin[size])
}
/>
<BaseBox flexShrink={0} alignSelf="end">
<ArrowRightIcon size="medium" marginBottom={makeSize(iconVerticalMargin[size])} />
</BaseBox>
<BaseBox flex={1}>
<HiddenInput
Expand Down
Loading