Skip to content

Commit 2d78105

Browse files
committed
refactor(input): 🙈 wrap tailwind classnames with cx in missed places
1 parent 2fd73e0 commit 2d78105

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

src/components/input/Input.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ const RNInput: React.FC<Partial<InputProps>> = forwardRef<
218218
return (
219219
<Box
220220
style={[
221-
tailwind.style(inputTheme.wrapper),
221+
tailwind.style(cx(inputTheme.wrapper)),
222222
styleAdapter(wrapperStyle, { pressed: false }, false),
223223
]}
224224
{...otherWrapperProps}
@@ -236,23 +236,27 @@ const RNInput: React.FC<Partial<InputProps>> = forwardRef<
236236
<RNTextInput
237237
style={[
238238
tailwind.style(
239-
inputTheme.size[size]?.base?.common,
240-
!prefix || !suffix ? inputTheme.size[size]?.base?.withoutAddon : "",
241-
inputTheme.variant[variant]?.base?.common,
242-
isHovered ? inputTheme.variant[variant]?.base?.hover : "",
243-
isFocussed ? inputTheme.variant[variant]?.base?.focus : "",
244-
invalid ? inputTheme.variant[variant]?.base?.invalid : "",
245-
editable ? "" : inputTheme.variant[variant]?.base?.disabled,
246-
_prefix ? `pl-[${prefixWidth}px]` : "",
247-
_suffix ? `pr-[${suffixWidth}px]` : "",
239+
cx(
240+
inputTheme.size[size]?.base?.common,
241+
!prefix || !suffix
242+
? inputTheme.size[size]?.base?.withoutAddon
243+
: "",
244+
inputTheme.variant[variant]?.base?.common,
245+
isHovered ? inputTheme.variant[variant]?.base?.hover : "",
246+
isFocussed ? inputTheme.variant[variant]?.base?.focus : "",
247+
invalid ? inputTheme.variant[variant]?.base?.invalid : "",
248+
editable ? "" : inputTheme.variant[variant]?.base?.disabled,
249+
_prefix ? `pl-[${prefixWidth}px]` : "",
250+
_suffix ? `pr-[${suffixWidth}px]` : "",
251+
),
248252
),
249253
isFocussed &&
250254
Platform.select({
251255
web: {
252256
outlineOffset:
253257
inputTheme.variant[variant]?.base?.focusWeb?.outlineOffset,
254258
outlineColor: (tailwind.getColor(
255-
inputTheme.variant[variant]?.base?.focusWeb?.borderColor,
259+
cx(inputTheme.variant[variant]?.base?.focusWeb?.borderColor),
256260
) || undefined) as string,
257261
outlineStyle:
258262
inputTheme.variant[variant]?.base?.focusWeb?.outlineStyle,

src/components/input/InputPrefix.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from "react";
22

33
import { Touchable, TouchableProps } from "../../primitives";
44
import { useTheme } from "../../theme";
5+
import { cx } from "../../utils";
56

67
import { InputProps } from "./Input";
78

@@ -21,9 +22,11 @@ export const InputPrefix: React.FC<InputPrefixProps> = ({
2122
<Touchable
2223
style={[
2324
tailwind.style(
24-
inputTheme.prefixWrapper,
25-
inputTheme.size[size]?.prefix,
26-
inputTheme.variant[variant]?.prefix?.common,
25+
cx(
26+
inputTheme.prefixWrapper,
27+
inputTheme.size[size]?.prefix,
28+
inputTheme.variant[variant]?.prefix?.common,
29+
),
2730
),
2831
]}
2932
{...props}

src/components/input/InputSuffix.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from "react";
22

33
import { Touchable, TouchableProps } from "../../primitives";
44
import { useTheme } from "../../theme";
5+
import { cx } from "../../utils";
56

67
import { InputProps } from "./Input";
78

@@ -21,9 +22,11 @@ export const InputSuffix: React.FC<InputSuffixProps> = ({
2122
<Touchable
2223
style={[
2324
tailwind.style(
24-
inputTheme.suffixWrapper,
25-
inputTheme.size[size]?.suffix,
26-
inputTheme.variant[variant]?.suffix?.common,
25+
cx(
26+
inputTheme.suffixWrapper,
27+
inputTheme.size[size]?.suffix,
28+
inputTheme.variant[variant]?.suffix?.common,
29+
),
2730
),
2831
]}
2932
{...props}

0 commit comments

Comments
 (0)