Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

added dark mode support to Checkbox, Input and Select UI elements

Blue Mouse28b0ee067033
diff --git a/src/ui/Checkbox.jsx b/src/ui/Checkbox.jsx
index 438c09151..9dddaabfe 100644
--- a/src/ui/Checkbox.jsx
+++ b/src/ui/Checkbox.jsx
@@ -17,7 +17,7 @@ const Checkbox = ({
type='checkbox'
checked={checked}
onChange={onChange}
- className='focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded cursor-pointer'
+ className='focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 dark:border-gray-800 dark:bg-gray-700 dark:checked:bg-indigo-600 rounded cursor-pointer'
/>
</div>
<div className='ml-3 text-sm'>
diff --git a/src/ui/Input.jsx b/src/ui/Input.jsx
index e039c9640..1742c16b1 100644
--- a/src/ui/Input.jsx
+++ b/src/ui/Input.jsx
@@ -24,7 +24,7 @@ const Input = ({
name={name}
id={identifier}
onChange={onChange}
- className={cx('shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md', {
+ className={cx('shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 dark:text-gray-50 dark:placeholder-gray-400 dark:border-gray-800 dark:bg-gray-700 rounded-md', {
'border-red-300 text-red-900 placeholder-red-300': isError,
})}
placeholder={placeholder}
diff --git a/src/ui/Select.jsx b/src/ui/Select.jsx
index 2812bc37b..6ea7a6643 100644
--- a/src/ui/Select.jsx
+++ b/src/ui/Select.jsx
@@ -14,7 +14,7 @@ const Select = ({
<>
<Listbox.Label className='block text-sm font-medium text-gray-700 dark:text-gray-100'>{label}</Listbox.Label>
<div className='mt-1 relative'>
- <Listbox.Button className='relative w-full bg-white border border-gray-300 rounded-md shadow-sm pl-3 pr-10 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm'>
+ <Listbox.Button className='relative w-full bg-white border border-gray-300 dark:text-gray-50 dark:border-gray-800 dark:bg-gray-700 rounded-md shadow-sm pl-3 pr-10 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm'>
<span className='block truncate capitalize'>{title}</span>
<span className='absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none'>
<SelectorIcon className='h-5 w-5 text-gray-400' aria-hidden='true' />
@@ -30,7 +30,7 @@ const Select = ({
>
<Listbox.Options
static
- className='absolute z-10 mt-1 w-full bg-white shadow-lg max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm'
+ className='absolute z-10 mt-1 w-full bg-white dark:bg-gray-700 shadow-lg max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm'
>
{_map(items, (item) => (
<Listbox.Option
@@ -38,7 +38,7 @@ const Select = ({
className={({ active }) =>
cx(
active ? 'text-white bg-indigo-600' : 'text-gray-900',
- 'cursor-default select-none relative py-2 pl-8 pr-4'
+ 'dark:text-white cursor-default select-none relative py-2 pl-8 pr-4'
)
}
value={labelExtractor ? labelExtractor(item) : item}