Skip to content

Commit

Permalink
fix(InputWrapper): Added alignment props for the addons
Browse files Browse the repository at this point in the history
  • Loading branch information
HHogg committed Jun 18, 2024
1 parent 2198fb0 commit 3954c01
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions workspaces/package/src/Input/InputWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@ export interface InputWrapperProps extends BoxProps {
* Addon that appears before the Input
*/
addonEnd?: JSX.Element;
/**
* Vertical alignment of the end addon
*/
addonEndAlignment?: BoxProps['alignSelf'];
/**
* Addon that appears after the Input
*/
addonStart?: JSX.Element;
/**
* Vertical alignment of the start addon
*/
addonStartAlignment?: BoxProps['alignSelf'];
/**
* Sets styling to indicate the input is invalid.
*/
Expand All @@ -38,7 +46,9 @@ export interface InputWrapperProps extends BoxProps {
export const InputWrapper = forwardRef<any, InputWrapperProps>((props, ref) => {
const {
addonEnd,
addonEndAlignment,
addonStart,
addonStartAlignment,
backgroundColor,
borderRadius = 'x2',
borderSize = 'x2',
Expand Down Expand Up @@ -75,9 +85,9 @@ export const InputWrapper = forwardRef<any, InputWrapperProps>((props, ref) => {
paddingVertical={paddingVertical}
ref={ref}
>
{addonStart && addonStart}
{addonStart && <Box alignSelf={addonStartAlignment}>{addonStart}</Box>}
{children}
{addonEnd && addonEnd}
{addonEnd && <Box alignSelf={addonEndAlignment}>{addonEnd}</Box>}
</Box>
);
});

0 comments on commit 3954c01

Please sign in to comment.