From 18c8a743436c0f83ac1fc7e8e4458c244eaca277 Mon Sep 17 00:00:00 2001 From: LUCAS DINIZ DE MELO Date: Fri, 2 Feb 2024 14:51:24 -0300 Subject: [PATCH] fix props name with camel case (#170) --- package.json | 2 +- src/components/Button/index.tsx | 30 +++++++++++++++-------------- src/components/Button/styles.tsx | 2 +- src/components/Button/types.ts | 2 +- src/components/TextInput/index.tsx | 24 +++++++++++------------ src/components/TextInput/styles.tsx | 10 +++++----- 6 files changed, 36 insertions(+), 34 deletions(-) diff --git a/package.json b/package.json index 327e3cd..48ceeac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@platformbuilders/fluid-react", - "version": "1.2.1", + "version": "1.2.2", "private": false, "description": "Builders React for Fluid Design System", "keywords": [ diff --git a/src/components/Button/index.tsx b/src/components/Button/index.tsx index 003a0b9..03bfa32 100644 --- a/src/components/Button/index.tsx +++ b/src/components/Button/index.tsx @@ -10,7 +10,7 @@ const Button: FC = ({ accessibility, disabled = false, loading = false, - fullWidth = false, + $fullWidth = false, variant = 'filled', typographyVariant = 'md', leftIconName, @@ -21,26 +21,28 @@ const Button: FC = ({ }) => { const LeftIcon = leftIconName ? Icons[leftIconName] : undefined; const RightIcon = rightIconName ? Icons[rightIconName] : undefined; + const contentWrapperProps = { + variant, + size, + $fullWidth, + }; + const touchableProps = { + accessibility, + disabled: loading || disabled, + variant, + onPress, + colorVariant, + size, + }; return ( - + {loading ? ( ) : ( {LeftIcon ? : null} diff --git a/src/components/Button/styles.tsx b/src/components/Button/styles.tsx index 7f41a8f..9c300d6 100644 --- a/src/components/Button/styles.tsx +++ b/src/components/Button/styles.tsx @@ -104,7 +104,7 @@ export const Touchable = styled(TouchableComponent)` border: none; ${getStylesButton} ${({ size }) => !!size && sizeButton[size]} - width: ${({ fullWidth }) => (!!fullWidth ? '100%' : undefined)}; + width: ${({ $fullWidth }) => (!!$fullWidth ? '100%' : undefined)}; padding: ${spacingSm}px; cursor: ${isDisabled('not-allowed', 'pointer')}; flex-direction: row; diff --git a/src/components/Button/types.ts b/src/components/Button/types.ts index 5321c54..cc50835 100644 --- a/src/components/Button/types.ts +++ b/src/components/Button/types.ts @@ -10,7 +10,7 @@ export type ButtonProps = { style?: any; type?: 'button' | 'submit' | 'reset'; loading?: boolean; - fullWidth?: boolean; + $fullWidth?: boolean; variant?: ButtonVariants; typographyVariant?: TypographyVariants; children?: string | ReactNode; diff --git a/src/components/TextInput/index.tsx b/src/components/TextInput/index.tsx index 95bd0c3..d6c6fe1 100644 --- a/src/components/TextInput/index.tsx +++ b/src/components/TextInput/index.tsx @@ -24,23 +24,23 @@ type IconsType = keyof typeof Icons; type InputMaskProps = ReactElementProps & { inputRef: Ref; hasError?: boolean; - hasIconLeft?: boolean; - hasIconRight?: boolean; + $hasIconLeft?: boolean; + $hasIconRight?: boolean; }; const InputMask = IMaskMixin( ({ inputRef, hasError, - hasIconRight, - hasIconLeft, + $hasIconRight, + $hasIconLeft, ...props }: InputMaskProps) => ( | undefined} /> ), @@ -133,8 +133,8 @@ const TextInput: FC = ({ onAccept={onAccept} autoFocus={autoFocus} hasError={hasError} - hasIconLeft={!!iconLeft} - hasIconRight={!!iconRight} + $hasIconLeft={!!iconLeft} + $hasIconRight={!!iconRight} defaultValue={value} {...rest} /> @@ -151,8 +151,8 @@ const TextInput: FC = ({ maxLength={maxLength} autoFocus={autoFocus} $hasError={hasError} - hasIconLeft={!!iconLeft} - hasIconRight={!!iconRight} + $hasIconLeft={!!iconLeft} + $hasIconRight={!!iconRight} {...rest} /> )} @@ -166,8 +166,8 @@ const TextInput: FC = ({ )} diff --git a/src/components/TextInput/styles.tsx b/src/components/TextInput/styles.tsx index 7da83c9..10cc986 100644 --- a/src/components/TextInput/styles.tsx +++ b/src/components/TextInput/styles.tsx @@ -2,8 +2,8 @@ import styled from 'styled-components'; import { getTheme, ifStyle, pxToRem } from '@platformbuilders/theme-toolkit'; type HasIcon = { - hasIconLeft?: boolean; - hasIconRight?: boolean; + $hasIconLeft?: boolean; + $hasIconRight?: boolean; }; type PlaceholderLabelProps = { @@ -38,7 +38,7 @@ export const PlaceholderLabel = styled.span` left: ${pxToRem(14)}; line-height: 147.6%; transition: top 0.2s; - ${({ hasIconLeft }) => !!hasIconLeft && `left: ${pxToRem(36)};`} + ${({ $hasIconLeft }) => !!$hasIconLeft && `left: ${pxToRem(36)};`} ${(props) => props.$hasValue && `top: 0; font-size: ${fontSizeMd}; margin-bottom: 40px;`} @@ -53,8 +53,8 @@ export const Input = styled.input` display: flex; height: ${pxToRem(44)}; padding: ${spacingXs}px ${spacingSm}px ${spacingXs}px ${spacingMd}px; - ${({ hasIconRight }) => !!hasIconRight && `padding-right: ${pxToRem(36)};`} - ${({ hasIconLeft }) => !!hasIconLeft && `padding-left: ${pxToRem(36)};`} + ${({ $hasIconRight }) => !!$hasIconRight && `padding-right: ${pxToRem(36)};`} + ${({ $hasIconLeft }) => !!$hasIconLeft && `padding-left: ${pxToRem(36)};`} align-items: center; gap: ${pxToRem(12)}; background: ${(props) =>