mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-07 07:19:16 +00:00
feat: reusable input component
This commit is contained in:
committed by
Carlos Valente
parent
3f3cef7d6f
commit
97691eba05
@@ -10,7 +10,7 @@
|
|||||||
padding-inline: 1em;
|
padding-inline: 1em;
|
||||||
|
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
border-radius: 3px;
|
border-radius: $component-border-radius-md;
|
||||||
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
|||||||
@@ -82,4 +82,5 @@
|
|||||||
.xlarge {
|
.xlarge {
|
||||||
height: 3rem;
|
height: 3rem;
|
||||||
height: 3rem;
|
height: 3rem;
|
||||||
|
font-size: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,13 @@ interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|||||||
size?: 'medium' | 'large' | 'xlarge';
|
size?: 'medium' | 'large' | 'xlarge';
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function IconButton(props: IconButtonProps) {
|
export default function IconButton({
|
||||||
const { className, children, variant = 'subtle', size = 'medium', ...buttonProps } = props;
|
className,
|
||||||
|
children,
|
||||||
|
variant = 'subtle',
|
||||||
|
size = 'medium',
|
||||||
|
...buttonProps
|
||||||
|
}: IconButtonProps) {
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
className={cx([style.baseIconButton, style[variant], style[size], className])}
|
className={cx([style.baseIconButton, style[variant], style[size], className])}
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
.input {
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
background-color: $gray-1200;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 400;
|
||||||
|
color: $gray-200;
|
||||||
|
border-radius: $component-border-radius-md;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
|
||||||
|
padding-inline: 0.5em;
|
||||||
|
|
||||||
|
&:hover:not(:disabled) {
|
||||||
|
background-color: $gray-1100;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
background-color: $gray-1000;
|
||||||
|
border: 1px solid $blue-500;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
opacity: 0.4;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::placeholder {
|
||||||
|
color: $gray-500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.medium {
|
||||||
|
height: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.large {
|
||||||
|
height: 2.5rem;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { InputHTMLAttributes } from 'react';
|
||||||
|
|
||||||
|
import { cx } from '../../../utils/styleUtils';
|
||||||
|
|
||||||
|
import style from './Input.module.scss';
|
||||||
|
|
||||||
|
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
||||||
|
variant?: 'subtle';
|
||||||
|
height?: 'medium' | 'large';
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Input({ className, variant = 'subtle', height = 'medium', ...inputProps }: InputProps) {
|
||||||
|
return <input type='text' className={cx([style.input, style[variant], style[height], className])} {...inputProps} />;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user