-
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
Open
camila-carrillo
wants to merge
6
commits into
main
Choose a base branch
from
camila/implement-grant-status-design-w-lyanne-pr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cecf4de
base dropdown, needs edits
camila-carrillo 357c71e
small changes ot dropdown and filterbar
camila-carrillo c22c087
commented out unused imports
camila-carrillo 45030ea
Merge branch 'main' into camila/implement-grant-status-design-w-lyann…
janekamata d9a2ebc
start of addressing comments
camila-carrillo 2e66e09
addressed comments, commented out unused import in grantpage
camila-carrillo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
frontend/src/main-page/grants/filter-bar/StatusDropdown.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
|
|
||
| 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"; | ||
| import Button from "../../../components/Button"; | ||
| import { faChevronDown, faChevronUp } from "@fortawesome/free-solid-svg-icons"; | ||
|
|
||
| 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 | ||
| text="Status" | ||
| onClick={() => setIsOpen(!isOpen)} | ||
| logo={isOpen ? faChevronUp : faChevronDown} | ||
| logoPosition="right" | ||
| className="border-grey-400 bg-white text-grey-900 text-base whitespace-nowrap" | ||
| /> | ||
|
|
||
| {isOpen && ( | ||
| <div className="absolute top-12 left-0 bg-white border border-primary-900 rounded-md p-4 z-50 shadow-lg min-w-[25rem] overflow-x-auto"> | ||
|
|
||
| <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; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.