-
Notifications
You must be signed in to change notification settings - Fork 0
Camila/implement grant status design w lyanne pr #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
cecf4de
357c71e
c22c087
45030ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
|
|
||
| import React, { useState } from "react"; | ||
| import { | ||
| Status, | ||
| getColorStatus, | ||
| } from "../../../../../middle-layer/types/Status.ts"; | ||
| import { updateFilter } from "../../../external/bcanSatchel/actions.ts"; | ||
| import { observer } from "mobx-react-lite"; | ||
|
|
||
| const StatusDropdown: React.FC = observer(() => { | ||
| const [isOpen, setIsOpen] = useState(false); | ||
| const [selected, setSelected] = useState<Status | null>(null); | ||
|
|
||
| const statuses = [ | ||
| Status.Active, | ||
| Status.Pending, | ||
| Status.Potential, | ||
| Status.Rejected, | ||
| Status.Inactive, | ||
| ]; | ||
|
|
||
| function handleSelect(status: Status) { | ||
| const newSelected = selected === status ? null : status; | ||
| setSelected(newSelected); | ||
| updateFilter(newSelected); | ||
| } | ||
|
|
||
|
|
||
| return ( | ||
| <div className="relative"> | ||
| <button | ||
| className="flex items-center gap-2 border border-grey-400 rounded-full px-5 py-2 bg-white text-grey-900 text-base whitespace-nowrap" | ||
| onClick={() => setIsOpen(!isOpen)} | ||
| > | ||
| Status {isOpen ? "∧" : "∨"} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same not from above - Button should use the reusable button component and probably map over a dictionary with name and icon. Instead of ascii characters, they should be react icons. See other uses of button in the codebase to see how to do the icon button param for the reusable component |
||
| </button> | ||
|
|
||
| {isOpen && ( | ||
| <div className="absolute top-12 left-0 bg-white border border-primary-900 rounded-md p-4 z-50 shadow-lg min-w-[400px]"> | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would double check that setting a hardcoded min width with pixels is responsive enough on small screens. typically I would say this should at least be rem |
||
| <div className="grid grid-cols-3 gap-2"> | ||
| {statuses.map((status) => ( | ||
| <div | ||
| key={status} | ||
| className="flex items-center gap-2 cursor-pointer" | ||
| onClick={() => handleSelect(status)} | ||
| > | ||
| <input | ||
| type="checkbox" | ||
| checked={selected === status} | ||
| onChange={() => handleSelect(status)} | ||
| className="cursor-pointer w-4 h-4 flex-shrink-0" | ||
| /> | ||
| <span | ||
| className="px-3 py-1 rounded-full text-sm font-medium" | ||
| style={{ | ||
| backgroundColor: getColorStatus(status, "light"), | ||
| color: getColorStatus(status, "dark"), | ||
| }} | ||
| > | ||
| {status} | ||
| </span> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| )} | ||
| </div> | ||
| ); | ||
| }); | ||
|
|
||
| export default StatusDropdown; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These buttons should all use the reusable button component and probably map over a dictionary with name and icon. Instead of ascii characters, they should be react icons. See other uses of button in the codebase to see how to do the icon button param for the reusable component