Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
e39bce94
Commit
e39bce94
authored
Jan 10, 2023
by
Alejandro Celaya
Committed by
Alejandro Celaya
Jan 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate FilterSelect to TS
parent
e974774b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
17 deletions
+12
-17
FilterSelect.tsx
src/sidebar/components/FilterSelect.tsx
+12
-17
No files found.
src/sidebar/components/FilterSelect.
js
→
src/sidebar/components/FilterSelect.
tsx
View file @
e39bce94
import
classnames
from
'classnames'
;
import
type
{
IconComponent
}
from
'@hypothesis/frontend-shared/lib/types'
;
import
type
{
FilterOption
}
from
'../store/modules/filters'
;
import
Menu
from
'./Menu'
;
import
MenuItem
from
'./MenuItem'
;
/**
* @typedef {import('../store/modules/filters').FilterOption} FilterOption
* @typedef {import('@hypothesis/frontend-shared/lib/types').IconComponent} IconComponent
*/
/**
* @typedef FilterSelectProps
* @prop {FilterOption} defaultOption
* @prop {IconComponent} [icon]
* @prop {(selectedFilter: FilterOption) => void} onSelect
* @prop {FilterOption[]} options
* @prop {FilterOption} [selectedOption]
* @prop {string} title
*/
type
FilterSelectProps
=
{
defaultOption
:
FilterOption
;
icon
?:
IconComponent
;
onSelect
:
(
selectedFilter
:
FilterOption
)
=>
void
;
options
:
FilterOption
[];
selectedOption
?:
FilterOption
;
title
:
string
;
};
/**
* A select-element-like control for selecting one of a defined set of
* options.
*
* @param {FilterSelectProps} props
*/
function
FilterSelect
({
defaultOption
,
...
...
@@ -31,7 +26,7 @@ function FilterSelect({
options
,
selectedOption
,
title
,
})
{
}
:
FilterSelectProps
)
{
const
filterOptions
=
[
defaultOption
,
...
options
];
const
selected
=
selectedOption
??
defaultOption
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment