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
3f20c4b3
Commit
3f20c4b3
authored
Apr 12, 2022
by
Lyza Danger Gardner
Committed by
Lyza Gardner
Apr 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Transition `HypothesisApp` to Tailwind
- Use `SidebarContent` component - Remove unused CSS
parent
163f3899
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
62 deletions
+43
-62
HypothesisApp.js
src/sidebar/components/HypothesisApp.js
+18
-6
HypothesisApp-test.js
src/sidebar/components/test/HypothesisApp-test.js
+14
-13
HypothesisApp.scss
src/styles/sidebar/components/HypothesisApp.scss
+0
-38
_index.scss
src/styles/sidebar/components/_index.scss
+11
-5
No files found.
src/sidebar/components/HypothesisApp.js
View file @
3f20c4b3
...
...
@@ -16,6 +16,7 @@ import StreamView from './StreamView';
import
HelpPanel
from
'./HelpPanel'
;
import
NotebookView
from
'./NotebookView'
;
import
ShareAnnotationsPanel
from
'./ShareAnnotationsPanel'
;
import
SidebarContent
from
'./SidebarContent'
;
import
ToastMessages
from
'./ToastMessages'
;
import
TopBar
from
'./TopBar'
;
...
...
@@ -164,10 +165,21 @@ function HypothesisApp({ auth, frameSync, settings, session, toastMessenger }) {
return
(
<
div
className
=
{
classnames
(
'HypothesisApp'
,
'js-thread-list-scroll-root'
,
{
'theme-clean'
:
isThemeClean
,
'HypothesisApp--notebook'
:
route
===
'notebook'
,
})}
className
=
{
classnames
(
'h-full min-h-full overflow-scroll'
,
// Precise padding to align with annotation cards in content
// Larger padding on bottom for wide screens
'p-[9px] lg:pb-16 bg-grey-2'
,
'js-thread-list-scroll-root'
,
{
'theme-clean'
:
isThemeClean
,
// Make room at top for the TopBar (40px) plus custom padding (9px)
// but not in the Notebook, which doesn't use the TopBar
'pt-[49px]'
:
route
!==
'notebook'
,
'p-4 lg:p-12'
:
route
===
'notebook'
,
}
)}
data
-
testid
=
"hypothesis-app"
style
=
{
backgroundStyle
}
>
{
route
!==
'notebook'
&&
(
...
...
@@ -179,7 +191,7 @@ function HypothesisApp({ auth, frameSync, settings, session, toastMessenger }) {
isSidebar
=
{
isSidebar
}
/
>
)}
<
div
className
=
"HypothesisApp__content"
>
<
SidebarContent
>
<
ToastMessages
/>
<
HelpPanel
auth
=
{
authState
.
status
===
'logged-in'
?
authState
:
{}}
/
>
<
ShareAnnotationsPanel
/>
...
...
@@ -194,7 +206,7 @@ function HypothesisApp({ auth, frameSync, settings, session, toastMessenger }) {
)}
<
/main
>
)}
<
/
div
>
<
/
SidebarContent
>
<
/div
>
);
}
...
...
src/sidebar/components/test/HypothesisApp-test.js
View file @
3f20c4b3
...
...
@@ -428,33 +428,34 @@ describe('HypothesisApp', () => {
});
describe
(
'theming'
,
()
=>
{
const
appSelector
=
'[data-testid="hypothesis-app"]'
;
it
(
'applies theme config'
,
()
=>
{
const
style
=
{
backgroundColor
:
'red'
};
fakeApplyTheme
.
returns
({
backgroundColor
:
'red'
});
const
wrapper
=
createComponent
();
const
background
=
wrapper
.
find
(
'.HypothesisApp'
);
const
background
=
wrapper
.
find
(
appSelector
);
assert
.
calledWith
(
fakeApplyTheme
,
[
'appBackgroundColor'
],
fakeSettings
);
assert
.
deepEqual
(
background
.
prop
(
'style'
),
style
);
});
});
it
(
'applies a clean-theme style when config sets theme to "clean"'
,
()
=>
{
fakeSettings
.
theme
=
'clean'
;
it
(
'applies a clean-theme style when config sets theme to "clean"'
,
()
=>
{
fakeSettings
.
theme
=
'clean'
;
const
wrapper
=
createComponent
();
const
container
=
wrapper
.
find
(
'.HypothesisApp'
);
const
wrapper
=
createComponent
();
const
container
=
wrapper
.
find
(
appSelector
);
assert
.
isTrue
(
container
.
hasClass
(
'theme-clean'
));
});
assert
.
isTrue
(
container
.
hasClass
(
'theme-clean'
));
});
it
(
'does not apply clean-theme style when config does not assert `clean` theme'
,
()
=>
{
fakeSettings
.
theme
=
''
;
it
(
'does not apply clean-theme style when config does not assert `clean` theme'
,
()
=>
{
fakeSettings
.
theme
=
''
;
const
wrapper
=
createComponent
();
const
container
=
wrapper
.
find
(
'.HypothesisApp'
);
const
wrapper
=
createComponent
();
const
container
=
wrapper
.
find
(
appSelector
);
assert
.
isFalse
(
container
.
hasClass
(
'HypothesisApp--theme-clean'
));
assert
.
isFalse
(
container
.
hasClass
(
'theme-clean'
));
});
});
});
src/styles/sidebar/components/HypothesisApp.scss
deleted
100644 → 0
View file @
163f3899
@use
'../../variables'
as
var
;
@use
'../mixins/layout'
;
@use
'../mixins/responsive'
;
.HypothesisApp
{
$sidebar-h-padding
:
9px
;
background
:
var
.
$grey-2
;
min-height
:
100%
;
height
:
100%
;
overflow
:
scroll
;
-webkit-overflow-scrolling
:
touch
;
padding
:
$sidebar-h-padding
;
padding-top
:
$sidebar-h-padding
+
var
.
$top-bar-height
;
@include
responsive
.
respond-to
(
tablets
desktops
)
{
padding-bottom
:
4rem
;
}
&
__content
{
@include
layout
.
sidebar-content
;
}
// FIXME: Temporary affordance for the Notebook view to override some
// layout spacing that assumes the presence of the top bar
&
--notebook
{
padding
:
var
.
$layout-space
;
@include
responsive
.
respond-to
(
tablets
desktops
)
{
padding
:
var
.
$layout-space--xlarge
;
}
}
}
// Disable scroll anchoring as it interferes with `ThreadList` and
// `visible-threads` calculations and can cause a render loop
.js-thread-list-scroll-root
{
overflow-anchor
:
none
;
}
src/styles/sidebar/components/_index.scss
View file @
3f20c4b3
...
...
@@ -14,7 +14,6 @@
@use
'./FilterStatus'
;
@use
'./GroupList'
;
@use
'./GroupListItem'
;
@use
'./HypothesisApp'
;
@use
'./LaunchErrorPanel'
;
@use
'./Menu'
;
@use
'./MenuItem'
;
...
...
@@ -31,10 +30,11 @@
@use
'./ToastMessages'
;
@use
'./VersionInfo'
;
// TODO: Put these in @layer components after shared component styles have
// been converted to Tailwind (and are contained in the components layer
// themselves). They need to come after shared-component styles in the
// output stylesheet.
// TODO: Evaluate all classes below after components have been converted to
// Tailwind. If retaining, put them in @layer components after `frontend-shared`
// component styles have been converted to Tailwind (and are contained in the
// components layer themselves). They need to come after shared-component
// styles in the output stylesheet.
// Applies to <Link>
.p-muted-link
{
...
...
@@ -45,3 +45,9 @@
.p-redacted-text
{
@apply
line-through
grayscale
contrast-50
text-color-text-light
;
}
// Disable scroll anchoring as it interferes with `ThreadList` and
// `visible-threads` calculations and can cause a render loop
.js-thread-list-scroll-root
{
overflow-anchor
:
none
;
}
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