style: dropdowns, feat: favorite projects in sidebar

This commit is contained in:
Aaryan Khandelwal 2023-03-04 17:47:03 +05:30
parent 067859b4bd
commit 4d598fd6b6
44 changed files with 574 additions and 950 deletions

View file

@ -61,16 +61,16 @@ export const IssueLabelSelect: React.FC<Props> = ({ setIsOpen, value, onChange,
<>
<Combobox.Button
className={({ open }) =>
`flex items-center text-xs cursor-pointer border rounded-md shadow-sm duration-200
`flex cursor-pointer items-center rounded-md border text-xs shadow-sm duration-200
${
open
? "outline-none border-theme bg-theme/5 ring-1 ring-theme "
? "border-theme bg-theme/5 outline-none ring-1 ring-theme "
: "hover:bg-theme/5 "
}`
}
>
{value && value.length > 0 ? (
<span className="flex items-center justify-center text-xs gap-2 px-3 py-1">
<span className="flex items-center justify-center gap-2 px-3 py-1 text-xs">
<IssueLabelsList
labels={value.map((v) => issueLabels?.find((l) => l.id === v)?.color) ?? []}
length={3}
@ -79,7 +79,7 @@ export const IssueLabelSelect: React.FC<Props> = ({ setIsOpen, value, onChange,
<span className=" text-gray-600">{value.length} Labels</span>
</span>
) : (
<span className="flex items-center justify-center text-xs gap-2 px-3 py-1.5">
<span className="flex items-center justify-center gap-2 px-3 py-1.5 text-xs">
<TagIcon className="h-3 w-3 text-gray-500" />
<span className=" text-gray-500">Label</span>
</span>
@ -97,10 +97,10 @@ export const IssueLabelSelect: React.FC<Props> = ({ setIsOpen, value, onChange,
leaveTo="opacity-0 translate-y-1"
>
<Combobox.Options
className={`absolute z-10 max-h-52 min-w-[8rem] mt-1 px-2 py-2 text-xs
rounded-md shadow-md overflow-auto border-none bg-white focus:outline-none`}
className={`absolute z-10 mt-1 max-h-52 min-w-[8rem] overflow-auto rounded-md border-none
bg-white px-2 py-2 text-xs shadow-md focus:outline-none`}
>
<div className="flex justify-start items-center rounded-sm border-[0.6px] bg-gray-100 border-gray-200 w-full px-2">
<div className="flex w-full items-center justify-start rounded-sm border-[0.6px] bg-gray-100 px-2">
<MagnifyingGlassIcon className="h-3 w-3 text-gray-500" />
<Combobox.Input
className="w-full bg-transparent py-1 px-2 text-xs text-gray-500 focus:outline-none"
@ -128,8 +128,8 @@ export const IssueLabelSelect: React.FC<Props> = ({ setIsOpen, value, onChange,
value={label.id}
>
{({ selected }) => (
<div className="flex w-full gap-2 justify-between rounded">
<div className="flex justify-start items-center gap-2">
<div className="flex w-full justify-between gap-2 rounded">
<div className="flex items-center justify-start gap-2">
<span
className="h-3 w-3 flex-shrink-0 rounded-full"
style={{
@ -141,7 +141,7 @@ export const IssueLabelSelect: React.FC<Props> = ({ setIsOpen, value, onChange,
/>
<span>{label.name}</span>
</div>
<div className="flex justify-center items-center p-1 rounded">
<div className="flex items-center justify-center rounded p-1">
<CheckIcon
className={`h-3 w-3 ${
selected ? "opacity-100" : "opacity-0"
@ -154,8 +154,8 @@ export const IssueLabelSelect: React.FC<Props> = ({ setIsOpen, value, onChange,
);
} else
return (
<div className="bg-gray-50 border-y border-gray-400">
<div className="flex select-none font-medium items-center gap-2 truncate p-2 text-gray-900">
<div className="border-y border-gray-400 bg-gray-50">
<div className="flex select-none items-center gap-2 truncate p-2 font-medium text-gray-900">
<RectangleGroupIcon className="h-3 w-3" /> {label.name}
</div>
<div>
@ -170,8 +170,8 @@ export const IssueLabelSelect: React.FC<Props> = ({ setIsOpen, value, onChange,
value={child.id}
>
{({ selected }) => (
<div className="flex w-full gap-2 justify-between rounded">
<div className="flex justify-start items-center gap-2">
<div className="flex w-full justify-between gap-2 rounded">
<div className="flex items-center justify-start gap-2">
<span
className="h-3 w-3 flex-shrink-0 rounded-full"
style={{
@ -180,7 +180,7 @@ export const IssueLabelSelect: React.FC<Props> = ({ setIsOpen, value, onChange,
/>
<span>{child.name}</span>
</div>
<div className="flex justify-center items-center p-1 rounded">
<div className="flex items-center justify-center rounded p-1">
<CheckIcon
className={`h-3 w-3 ${
selected ? "opacity-100" : "opacity-0"
@ -196,17 +196,17 @@ export const IssueLabelSelect: React.FC<Props> = ({ setIsOpen, value, onChange,
);
})
) : (
<p className="text-xs text-gray-500 px-2">No labels found</p>
<p className="px-2 text-xs text-gray-500">No labels found</p>
)
) : (
<p className="text-xs text-gray-500 px-2">Loading...</p>
<p className="px-2 text-xs text-gray-500">Loading...</p>
)}
<button
type="button"
className="flex select-none w-full items-center py-2 px-1 rounded hover:bg-gray-200"
className="flex w-full select-none items-center rounded py-2 px-1 hover:bg-gray-200"
onClick={() => setIsOpen(true)}
>
<span className="flex justify-start items-center gap-1">
<span className="flex items-center justify-start gap-1">
<PlusIcon className="h-4 w-4 text-gray-600" aria-hidden="true" />
<span className="text-gray-600">Create New Label</span>
</span>