Skip to content

Commit

Permalink
add $ styleprop prefix for styled component props
Browse files Browse the repository at this point in the history
  • Loading branch information
yogurtandjam committed Oct 21, 2024
1 parent 6b28487 commit dec2128
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
14 changes: 7 additions & 7 deletions src/components/FormInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@ export const FormInput = forwardRef<HTMLInputElement, FormInputProps>(
label={label}
inputID={id}
disabled={otherProps?.disabled}

Check warning on line 42 in src/components/FormInput.tsx

View workflow job for this annotation

GitHub Actions / lint

Unnecessary optional chain on a non-nullish value
backgroundColorOverride={backgroundColorOverride}
$backgroundColorOverride={backgroundColorOverride}
>
<Input
ref={ref}
id={id}
{...otherProps}
backgroundColorOverride={backgroundColorOverride}
$backgroundColorOverride={backgroundColorOverride}
/>
</$WithLabel>
) : (
<Input
ref={ref}
id={id}
{...otherProps}
backgroundColorOverride={backgroundColorOverride}
$backgroundColorOverride={backgroundColorOverride}
/>
)}
{slotRight}
Expand Down Expand Up @@ -110,12 +110,12 @@ const $InputContainer = styled.div<{
`}
`;

const $WithLabel = styled(WithLabel)<{ disabled?: boolean; backgroundColorOverride?: string }>`
const $WithLabel = styled(WithLabel)<{ disabled?: boolean; $backgroundColorOverride?: string }>`
${formMixins.inputLabel}
${({ backgroundColorOverride }) =>
backgroundColorOverride &&
${({ $backgroundColorOverride }) =>
$backgroundColorOverride &&
css`
background-color: ${backgroundColorOverride};
background-color: ${$backgroundColorOverride};
`}
label {
Expand Down
24 changes: 12 additions & 12 deletions src/components/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export enum InputType {

type StyleProps = {
className?: string;
backgroundColorOverride?: string;
$backgroundColorOverride?: string;
};

type ElementProps = {
Expand Down Expand Up @@ -82,7 +82,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
onFocus,
onInput,
type = InputType.Number,
backgroundColorOverride,
$backgroundColorOverride: backgroundColorOverride,
...otherProps
},
ref
Expand Down Expand Up @@ -128,7 +128,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
<$InputContainer className={className}>
{type === InputType.Text || type === InputType.Search ? (
<$Input
backgroundColorOverride={backgroundColorOverride}
$backgroundColorOverride={backgroundColorOverride}
// React
ref={ref}
id={id}
Expand All @@ -148,7 +148,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
/>
) : (
<$NumericFormat
backgroundColorOverride={backgroundColorOverride}
$backgroundColorOverride={backgroundColorOverride}
// React
getInputRef={ref}
id={id}
Expand Down Expand Up @@ -238,21 +238,21 @@ const InputStyle = css`
}
`;

const $NumericFormat = styled(NumericFormat)<{ backgroundColorOverride?: string }>`
const $NumericFormat = styled(NumericFormat)<{ $backgroundColorOverride?: string }>`
${InputStyle}
font-feature-settings: var(--fontFeature-monoNumbers);
${({ backgroundColorOverride }) =>
backgroundColorOverride &&
${({ $backgroundColorOverride }) =>
$backgroundColorOverride &&
css`
background-color: ${backgroundColorOverride};
background-color: ${$backgroundColorOverride};
`}
`;

const $Input = styled.input<{ backgroundColorOverride?: string }>`
const $Input = styled.input<{ $backgroundColorOverride?: string }>`
${InputStyle}
${({ backgroundColorOverride }) =>
backgroundColorOverride &&
${({ $backgroundColorOverride }) =>
$backgroundColorOverride &&
css`
background-color: ${backgroundColorOverride};
background-color: ${$backgroundColorOverride};
`}
`;

0 comments on commit dec2128

Please sign in to comment.