Skip to content

Commit ac14358

Browse files
Visual changes on dropdown
1 parent 68fedab commit ac14358

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

components/Dropdown.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,21 @@ import { Menu, Transition } from '@headlessui/react'
33
import { ChevronDownIcon } from '@heroicons/react/20/solid'
44
import { DropdownProps, OptionProps } from '../types/dropdown';
55
import { combineClassNames } from '../../javascript-functions/general';
6+
import { IconClock } from '@tabler/icons';
67

78

89
export default function Dropdown(props: DropdownProps) {
910
const isDisabled = props.disabled || props.options.length < 1;
1011
return (
11-
<Menu as="div" className="relative inline-block text-left">
12+
<Menu as="div" className="relative inline-block text-left w-full">
1213
<div>
13-
<Menu.Button className={`inline-flex w-full justify-center items-center rounded-md border border-gray-300
14+
<Menu.Button className={`inline-flex w-full justify-between items-center rounded-md border border-gray-300
1415
bg-white px-4 py-2 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2
1516
focus:ring-gray-300 focus:ring-offset-2 focus:ring-offset-gray-100
1617
${isDisabled ? "opacity-50" : ""}`}
1718
disabled={isDisabled}
1819
>
20+
{props.hasIconClock ? <IconClock className="h-5 w-5 text-gray-900" aria-hidden="true" /> : null}
1921
{props.buttonName}
2022
<ChevronDownIcon
2123
className="-mr-1 ml-2 h-5 w-5"
@@ -32,7 +34,7 @@ export default function Dropdown(props: DropdownProps) {
3234
leaveFrom="transform opacity-100 scale-100"
3335
leaveTo="transform opacity-0 scale-95"
3436
>
35-
<Menu.Items className="absolute z-10 mt-2 w-40 origin-top-right rounded-md bg-white shadow-sm ring-1 ring-black ring-opacity-5 focus:outline-none">
37+
<Menu.Items className={`absolute z-10 mt-2 w-40 origin-top-right rounded-md bg-white shadow-sm ring-1 ring-black ring-opacity-5 focus:outline-none ${props.itemsClasses ? props.itemsClasses : ''}`}>
3638
<div className="py-1">
3739
{props.options.map((option: OptionProps) => (
3840
<div key={option.id}>

types/dropdown.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
export type DropdownProps = {
2-
options: OptionProps[];
2+
options: any[];
33
buttonName: string;
44
disabled?: boolean;
55
selectedOption: (event: any) => void;
6+
itemsClasses?: string;
7+
hasIconClock?: boolean;
68
}
79

810
export type OptionProps = {

0 commit comments

Comments
 (0)