Skip to content

Commit

Permalink
fix: default improved input classes
Browse files Browse the repository at this point in the history
  • Loading branch information
gravitano committed Nov 8, 2021
1 parent 3a353a8 commit 20b9864
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/utils/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ export const inputDisabledClasses =
export const inputClasses =
'border shadow-sm rounded-md text-gray-800 ' + inputDisabledClasses;

export const inputErrorClasses = 'border-error-500 placeholder-error-500 text-error-500 focus:border-error-500 focus:ring-error-500'
export const inputErrorClasses =
'border-error-500 placeholder-error-500 text-error-500 focus-visible:ring-error-500 focus-visible:border-error-500 ring-error-500 focus:border-error-500 focus:ring-error-500';

export const useInputClasses = (error = false) => {
let className = ['transition duration-300 border shadow-sm rounded-md text-gray-800 focus:border-primary-500 focus:ring-primary-500', inputDisabledClasses];
let className = [
'transition duration-300 border shadow-sm rounded-md text-gray-800 focus:border-primary-500 focus:ring-primary-500',
inputDisabledClasses,
];

if (error) {
className.push(inputErrorClasses);
} else {
className.push('border-gray-200');
className.push('border-gray-300');
}

return className.join(' ')
return className.join(' ');
};

0 comments on commit 20b9864

Please sign in to comment.