parent
f89ce686ee
commit
96d08f93cd
@ -2,7 +2,7 @@ import type { SelectHTMLAttributes } from 'react';
|
|||||||
import { forwardRef } from 'react';
|
import { forwardRef } from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { Icon } from '..';
|
import { Icon } from '..';
|
||||||
import { defaultFormElement } from '../../utils/shared';
|
import { defaultSelectElement } from '../../utils/shared';
|
||||||
|
|
||||||
export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
|
export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
|
||||||
hasError?: boolean;
|
hasError?: boolean;
|
||||||
@ -18,7 +18,7 @@ export const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
|||||||
ref={ref}
|
ref={ref}
|
||||||
{...props}
|
{...props}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
defaultFormElement(hasError),
|
defaultSelectElement(hasError),
|
||||||
className,
|
className,
|
||||||
'appearance-none rounded-md'
|
'appearance-none rounded-md'
|
||||||
)}
|
)}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
|
||||||
|
export const defaultSelectElement = (hasError?: boolean) =>
|
||||||
|
classnames(defaultFormElement(hasError), 'dark:bg-black');
|
||||||
|
|
||||||
export const defaultFormElement = (hasError?: boolean) =>
|
export const defaultFormElement = (hasError?: boolean) =>
|
||||||
classnames(
|
classnames(
|
||||||
'flex items-center w-full text-sm',
|
'flex items-center w-full text-sm',
|
||||||
'p-2 border-2 rounded-none',
|
'p-2 border-2 rounded-none',
|
||||||
'bg-transparent ',
|
'bg-transparent',
|
||||||
'border border-neutral-500 focus:border-black dark:focus:border-white',
|
'border border-neutral-500 focus:border-black dark:focus:border-white',
|
||||||
'disabled:opacity-40',
|
'disabled:opacity-40',
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user