forked from opencollective/opencollective-frontend-template
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Location filter modal, update TimeFilter to also use the same FilterButton * Rename "United Kingdom of Great Britain and Northern Island" to "United Kingdom" * Remove count from Global/Online filter options
- Loading branch information
1 parent
dc4871a
commit e34dd27
Showing
7 changed files
with
429 additions
and
143 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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 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,39 @@ | ||
import React, { forwardRef } from 'react'; | ||
|
||
import { ChevronUpDown } from './Icons'; | ||
|
||
interface Props { | ||
currentCategoryColor: string; | ||
selectedOption?: any; | ||
icon: any; | ||
label: string; | ||
onClick?: any; | ||
} | ||
|
||
const FilterButton: React.ForwardRefRenderFunction<HTMLButtonElement, Props> = ( | ||
{ currentCategoryColor, selectedOption, icon, label, onClick }, | ||
ref, | ||
) => { | ||
return ( | ||
<button | ||
ref={ref} | ||
onClick={onClick} | ||
className={`group flex w-full items-center justify-between gap-2 rounded-lg border-2 bg-opacity-75 py-2 px-3 transition-colors ${ | ||
selectedOption && selectedOption.value !== 'ALL' | ||
? `bg-${currentCategoryColor}-50 border-transparent hover:bg-opacity-100 hover:border-${currentCategoryColor}-100` | ||
: 'border-transparent bg-white hover:border-gray-100 hover:bg-gray-50 ' | ||
}`} | ||
> | ||
<div className="flex items-center gap-2 whitespace-nowrap font-medium"> | ||
{icon} | ||
<span>{label}</span> | ||
</div> | ||
<div className="flex items-center gap-1.5 overflow-hidden whitespace-nowrap"> | ||
<span className="overflow-hidden overflow-ellipsis">{selectedOption?.label ?? 'All locations'}</span>{' '} | ||
<ChevronUpDown className="-mr-1 -ml-0.5 mt-0.5 h-4 w-4 flex-shrink-0" /> | ||
</div> | ||
</button> | ||
); | ||
}; | ||
|
||
export default forwardRef<HTMLButtonElement, Props>(FilterButton); |
Oops, something went wrong.
e34dd27
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.
Successfully deployed to the following URLs:
horizons – ./
horizons-git-main-opencollective.vercel.app
horizons-opencollective.vercel.app
discover.opencollective.com