Skip to content

Commit

Permalink
feat: lint formatting update [gh-36]
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubfolta committed Jun 20, 2024
1 parent 849ba90 commit 61d0d02
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 27 deletions.
2 changes: 1 addition & 1 deletion frontend/src/app/(app)/people/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export default function People() {
options={filters}
selectedOptionValue={selectedFilter}
setSelectedOption={setSelectedFilter}
resetFilter={event => resetFilterHandler(event)}
resetFilter={(event) => resetFilterHandler(event)}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MouseEventHandler } from "react";
import { MouseEventHandler } from 'react';

export interface Option {
value: string;
Expand Down
56 changes: 32 additions & 24 deletions frontend/src/components/common/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,44 @@ import { ChevronRightIcon } from '@app/static/icons/ChevronRightIcon';
import { CloseIcon } from '@app/static/icons/CloseIcon';
import { generateClassNames } from '@app/utils';

export const Dropdown = ({ options, selectedOptionValue, selectedOptionLabel, setSelectedOption, resetFilter }: DropdownProps) => (
export const Dropdown = ({
options,
selectedOptionValue,
selectedOptionLabel,
setSelectedOption,
resetFilter,
}: DropdownProps) => (
<div>
<Listbox value={selectedOptionValue} onChange={setSelectedOption}>
<div className="relative">
<Listbox.Button className={generateClassNames('relative flex justify-between items-center gap-3 h-12 border border-navy-200 cursor-default rounded-xl bg-white px-4 text-left focus:outline-none focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-white/75 focus-visible:ring-offset-2 focus-visible:ring-offset-orange-300', {
'px-0 gap-0 bg-blue-200': selectedOptionValue !== options[0].value
})}
<Listbox.Button
className={generateClassNames(
'relative flex justify-between items-center gap-3 h-12 border border-navy-200 cursor-default rounded-xl bg-white px-4 text-left focus:outline-none focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-white/75 focus-visible:ring-offset-2 focus-visible:ring-offset-orange-300',
{
'px-0 gap-0 bg-blue-200': selectedOptionValue !== options[0].value,
},
)}
>
{selectedOptionValue !== options[0].value
? <>
<div className="flex items-center gap-2 h-12 pr-2 pl-3">
<span className="pointer-events-none">
<ChevronRightIcon className="h-4 w-4 text-navy-600 rotate-90" aria-hidden="true" />
</span>
<span className="block truncate text-navy-900">{selectedOptionLabel}</span>
</div>
<span
className="flex items-center h-12 pr-3 pl-2 cursor-pointer"
onClick={resetFilter}
>
<CloseIcon className="h-3 w-[18px] text-navy-600" aria-hidden="true" />
</span>
</>
: <>
<span className="block truncate text-navy-600">{selectedOptionLabel}</span>
<span className="pointer-events-none flex items-center">
{selectedOptionValue !== options[0].value ? (
<>
<div className="flex items-center gap-2 h-12 pr-2 pl-3">
<span className="pointer-events-none">
<ChevronRightIcon className="h-4 w-4 text-navy-600 rotate-90" aria-hidden="true" />
</span>
</>
}
<span className="block truncate text-navy-900">{selectedOptionLabel}</span>
</div>
<span className="flex items-center h-12 pr-3 pl-2 cursor-pointer" onClick={resetFilter}>
<CloseIcon className="h-3 w-[18px] text-navy-600" aria-hidden="true" />
</span>
</>
) : (
<>
<span className="block truncate text-navy-600">{selectedOptionLabel}</span>
<span className="pointer-events-none flex items-center">
<ChevronRightIcon className="h-4 w-4 text-navy-600 rotate-90" aria-hidden="true" />
</span>
</>
)}
</Listbox.Button>
<Transition
enter="transition duration-100 ease-out"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/const/peopleDropdownFilterOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export const filters = [
{ label: 'Band 3', value: 'band_3', id: 4 },
{ label: 'Band 4', value: 'band_4', id: 5 },
{ label: 'Band 5', value: 'band_5', id: 6 },
];
];

0 comments on commit 61d0d02

Please sign in to comment.