Skip to content

Commit 25d6152

Browse files
committed
Update new input styling
1 parent 7c4028f commit 25d6152

File tree

3 files changed

+45
-8
lines changed

3 files changed

+45
-8
lines changed

resources/scripts/components/elements/inputs/InputField.tsx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,29 @@ import React, { forwardRef } from 'react';
22
import classNames from 'classnames';
33
import styles from './styles.module.css';
44

5-
export default forwardRef<HTMLInputElement, React.ComponentProps<'input'>>(({ className, ...props }, ref) => (
6-
<input ref={ref} className={classNames('form-input', styles.text_input, className)} {...props} />
5+
enum Variant {
6+
Normal,
7+
Snug,
8+
Loose,
9+
}
10+
11+
interface InputFieldProps extends React.ComponentProps<'input'> {
12+
variant?: Variant;
13+
}
14+
15+
const Component = forwardRef<HTMLInputElement, InputFieldProps>(({ className, variant, ...props }, ref) => (
16+
<input
17+
ref={ref}
18+
className={classNames(
19+
'form-input',
20+
styles.text_input,
21+
{ [styles.loose]: variant === Variant.Loose },
22+
className
23+
)}
24+
{...props}
25+
/>
726
));
27+
28+
const InputField = Object.assign(Component, { Variants: Variant });
29+
30+
export default InputField;
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1-
export { default as Checkbox } from './Checkbox';
2-
export { default as InputField } from './InputField';
1+
import Checkbox from '@/components/elements/inputs/Checkbox';
2+
import InputField from '@/components/elements/inputs/InputField';
3+
4+
const Input = Object.assign(
5+
{},
6+
{
7+
Text: InputField,
8+
Checkbox: Checkbox,
9+
}
10+
);
11+
12+
export { Input };
313
export { default as styles } from './styles.module.css';

resources/scripts/components/elements/inputs/styles.module.css

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@
1212
}
1313

1414
.text_input {
15-
@apply transition-all duration-75;
16-
@apply bg-neutral-800 border-neutral-600 rounded px-4 py-2 outline-none;
15+
@apply transition-shadow duration-75;
16+
@apply w-full bg-neutral-800 rounded px-4 py-2 outline-none border-0;
1717

18-
&:focus {
19-
@apply border-blue-600 ring-2 ring-blue-500;
18+
&:focus, &:active {
19+
@apply ring-4 ring-blue-300 ring-opacity-75;
20+
}
21+
22+
&.loose {
23+
@apply px-6 py-3;
2024
}
2125
}

0 commit comments

Comments
 (0)