Skip to content

Commit

Permalink
ui: add datepicker focus state
Browse files Browse the repository at this point in the history
  • Loading branch information
RaunoT committed Aug 26, 2024
1 parent 0ad2040 commit abbb1ef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/components/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ export default function DatePicker({
>
<Group className='select-wrapper flex cursor-pointer'>
<div
className='input select-input focus-within:focus-ring !bg-none'
className={clsx(
'input select-input focus-within:focus-ring !bg-none',
isOpen && 'focus-ring bg-neutral-400',
)}
onClick={() => setIsOpen(true)}
>
<I18nProvider locale='en-GB'>
Expand Down Expand Up @@ -88,7 +91,7 @@ export default function DatePicker({
<CalendarDaysIcon className='absolute inset-y-0 right-3.5 my-auto size-5 text-neutral-300' />
</div>
</Group>
<Label className='label'>
<Label className={clsx('label', isOpen && 'text-white')}>
<span className={clsx('label-wrapper', required && 'required')}>
{label}
</span>{' '}
Expand Down
10 changes: 6 additions & 4 deletions src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@

&:focus {
@apply focus-ring bg-neutral-400 placeholder:text-neutral-300;

+ .label {
@apply text-white;
}
}

&[required] + .label > .label-wrapper {
Expand All @@ -137,6 +133,12 @@

.input-wrapper {
@apply relative flex flex-col-reverse gap-2 sm:flex-row-reverse sm:items-center;

&:focus-within {
.label {
@apply text-white;
}
}
}

.select-wrapper {
Expand Down

0 comments on commit abbb1ef

Please sign in to comment.