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
30f18b3b
Commit
30f18b3b
authored
May 09, 2022
by
Lyza Danger Gardner
Committed by
Lyza Gardner
May 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate `FilterSelect` to tailwind
parent
1adb25a4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
31 deletions
+18
-31
FilterSelect.js
src/sidebar/components/FilterSelect.js
+18
-3
FilterSelect.scss
src/styles/sidebar/components/FilterSelect.scss
+0
-27
_index.scss
src/styles/sidebar/components/_index.scss
+0
-1
No files found.
src/sidebar/components/FilterSelect.js
View file @
30f18b3b
import
{
Icon
}
from
'@hypothesis/frontend-shared'
;
import
{
Icon
}
from
'@hypothesis/frontend-shared'
;
import
classnames
from
'classnames'
;
import
Menu
from
'./Menu'
;
import
Menu
from
'./Menu'
;
import
MenuItem
from
'./MenuItem'
;
import
MenuItem
from
'./MenuItem'
;
...
@@ -35,14 +36,28 @@ function FilterSelect({
...
@@ -35,14 +36,28 @@ function FilterSelect({
const
selected
=
selectedOption
??
defaultOption
;
const
selected
=
selectedOption
??
defaultOption
;
const
menuLabel
=
(
const
menuLabel
=
(
<
span
className
=
"FilterSelect__menu-label"
>
<
span
{
icon
&&
<
Icon
name
=
{
icon
}
classes
=
"text-xl hyp-u-margin--right--3"
/>
}
className
=
{
classnames
(
// Don't allow the label text to wrap
'shrink-0 flex items-center gap-x-2'
,
'text-color-text font-bold text-lg'
)}
>
{
icon
&&
<
Icon
name
=
{
icon
}
classes
=
"w-4 h-4"
/>
}
{
selected
.
display
}
{
selected
.
display
}
<
/span
>
<
/span
>
);
);
return
(
return
(
<
Menu
label
=
{
menuLabel
}
title
=
{
title
}
contentClass
=
"FilterSelect__menu"
>
<
Menu
label
=
{
menuLabel
}
title
=
{
title
}
contentClass
=
{
classnames
(
// Don't let filter list get too terribly tall. On shorter screens,
// restrict to 70vh; set a static max-height for taller screens.
'max-h-[70vh] tall:max-h-[504px] overflow-y-auto'
)}
>
{
filterOptions
.
map
(
filterOption
=>
(
{
filterOptions
.
map
(
filterOption
=>
(
<
MenuItem
<
MenuItem
onClick
=
{()
=>
onSelect
(
filterOption
)}
onClick
=
{()
=>
onSelect
(
filterOption
)}
...
...
src/styles/sidebar/components/FilterSelect.scss
deleted
100644 → 0
View file @
1adb25a4
@use
'../../mixins/utils'
;
@use
'../../variables'
as
var
;
.FilterSelect
{
&
__menu
{
// Prevent the list from overflowing off screen in most cases.
max-height
:
70vh
;
overflow-y
:
auto
;
// Limit the length for large screens.
@media
only
screen
and
(
min-height
:
44em
)
{
max-height
:
36em
;
}
}
&
__menu-label
{
@include
utils
.
font--large
;
align-items
:
center
;
color
:
var
.
$color-text
;
display
:
flex
;
// Prevent label from wrapping if top bar is too narrow to fit all of its
// items.
flex-shrink
:
0
;
font-weight
:
bold
;
}
}
src/styles/sidebar/components/_index.scss
View file @
30f18b3b
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
// UI (Preact) Components
// UI (Preact) Components
// ----------
// ----------
@use
'./FilterSelect'
;
@use
'./StyledText'
;
@use
'./StyledText'
;
// TODO: Evaluate all classes below after components have been converted to
// TODO: Evaluate all classes below after components have been converted to
...
...
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