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
07b97101
Commit
07b97101
authored
Nov 06, 2023
by
Alejandro Celaya
Committed by
Alejandro Celaya
Nov 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use rounded_corners feature flag to enable CSS vars
parent
42d38207
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletion
+33
-1
HypothesisApp.tsx
src/sidebar/components/HypothesisApp.tsx
+15
-1
HypothesisApp-test.js
src/sidebar/components/test/HypothesisApp-test.js
+18
-0
No files found.
src/sidebar/components/HypothesisApp.tsx
View file @
07b97101
import
classnames
from
'classnames'
;
import
{
useEffect
,
useMemo
}
from
'preact/hooks'
;
import
{
useEffect
,
use
LayoutEffect
,
use
Memo
}
from
'preact/hooks'
;
import
{
confirm
}
from
'../../shared/prompts'
;
import
type
{
SidebarSettings
}
from
'../../types/config'
;
...
...
@@ -49,6 +49,20 @@ function HypothesisApp({
const
route
=
store
.
route
();
const
isModalRoute
=
route
===
'notebook'
||
route
===
'profile'
;
const
roundedCornersEnabled
=
store
.
isFeatureEnabled
(
'rounded_corners'
);
useLayoutEffect
(()
=>
{
const
html
=
document
.
querySelector
(
'html'
);
html
?.
style
.
setProperty
(
'--h-border-radius'
,
roundedCornersEnabled
?
'0.25rem'
:
null
,
);
html
?.
style
.
setProperty
(
'--h-border-radius-lg'
,
roundedCornersEnabled
?
'0.5rem'
:
null
,
);
},
[
roundedCornersEnabled
]);
const
backgroundStyle
=
useMemo
(
()
=>
applyTheme
([
'appBackgroundColor'
],
settings
),
[
settings
],
...
...
src/sidebar/components/test/HypothesisApp-test.js
View file @
07b97101
...
...
@@ -142,6 +142,24 @@ describe('HypothesisApp', () => {
});
});
[
true
,
false
].
forEach
(
roundedCornersEnabled
=>
{
it
(
'defines border-radius CSS vars when the feature flag is enabled'
,
()
=>
{
fakeStore
.
isFeatureEnabled
.
returns
(
roundedCornersEnabled
);
createComponent
();
const
styles
=
document
.
querySelector
(
'html'
)?.
style
;
assert
.
equal
(
styles
.
getPropertyValue
(
'--h-border-radius'
),
roundedCornersEnabled
?
'0.25rem'
:
''
,
);
assert
.
equal
(
styles
.
getPropertyValue
(
'--h-border-radius-lg'
),
roundedCornersEnabled
?
'0.5rem'
:
''
,
);
});
});
describe
(
'auto-opening tutorial'
,
()
=>
{
it
(
'should open tutorial on profile load when criteria are met'
,
()
=>
{
fakeShouldAutoDisplayTutorial
.
returns
(
true
);
...
...
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