Skip to content

Commit

Permalink
Merge pull request #89 from Giveth/adds-leftIcon
Browse files Browse the repository at this point in the history
adds left icon on buttons
  • Loading branch information
MohammadPCh authored Jun 15, 2023
2 parents 3aa024a + 0759d6b commit 71d0c91
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@giveth/ui-design-system",
"version": "1.11.10",
"version": "1.11.11",
"files": [
"/lib"
],
Expand Down
4 changes: 3 additions & 1 deletion src/components/buttonLinks/ButtonLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export const ButtonLink: FC<IButtonLinkProps> = forwardRef(
linkType = 'secondary',
disabled = false,
icon,
leftIcon,
target,
className,
href,
Expand All @@ -173,10 +174,11 @@ export const ButtonLink: FC<IButtonLinkProps> = forwardRef(
size={size}
className={className}
>
{leftIcon && leftIcon}
<ButtonText as='span' size={size}>
{label}
</ButtonText>
{icon && icon}
{icon && !leftIcon && icon}
</ButtonLinkContainer>
);
},
Expand Down
4 changes: 3 additions & 1 deletion src/components/buttonLinks/OutlineButtonLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const OutlineLinkButton: FC<IButtonLinkProps> = forwardRef(
linkType = 'secondary',
disabled = false,
icon,
leftIcon,
href,
target,
className,
Expand All @@ -103,8 +104,9 @@ export const OutlineLinkButton: FC<IButtonLinkProps> = forwardRef(
as={isExternal ? 'a' : 'span'}
>
<ButtonText as='span' size={size}>
{leftIcon && leftIcon}
{label}
{icon && icon}
{icon && !leftIcon && icon}
</ButtonText>
</ButtonLinkContainer>
);
Expand Down
1 change: 1 addition & 0 deletions src/components/buttonLinks/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ export interface IButtonLinkProps
extends ComponentPropsWithoutRef<'a'>,
IButtonLinkContainerProps {
icon?: ReactNode;
leftIcon?: ReactNode;
label: string;
}
4 changes: 3 additions & 1 deletion src/components/buttons/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export const Button: FC<IButtonProps> = ({
loading = false,
onClick,
icon,
leftIcon,
className,
type = 'button',
}) => {
Expand All @@ -172,8 +173,9 @@ export const Button: FC<IButtonProps> = ({
<Loader buttonType={buttonType} disabled={disabled} />
)}
</LoadingContainer>
{leftIcon && leftIcon}
<ButtonText size={size}>{label}</ButtonText>
{icon && icon}
{icon && !leftIcon && icon}
</ButtonContainer>
);
};
4 changes: 3 additions & 1 deletion src/components/buttons/OutlineButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export const OutlineButton: FC<IButtonProps> = ({
loading = false,
onClick,
icon,
leftIcon,
className,
type = 'button',
}) => {
Expand All @@ -110,8 +111,9 @@ export const OutlineButton: FC<IButtonProps> = ({
<Loader buttonType={buttonType} disabled={disabled} />
)}
</LoadingContainer>
{leftIcon && leftIcon}
<ButtonText size={size}>{label}</ButtonText>
{icon && icon}
{icon && !leftIcon && icon}
</ButtonContainer>
);
};
1 change: 1 addition & 0 deletions src/components/buttons/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ export interface IButtonProps
loading?: boolean;
label: string;
icon?: ReactNode;
leftIcon?: ReactNode;
}

0 comments on commit 71d0c91

Please sign in to comment.