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
cb2f7a46
Commit
cb2f7a46
authored
Feb 12, 2020
by
Lyza Danger Gardner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert ‘Log in’ and ‘Sign up’ links to `Button` components
Part of #1727
parent
e279908b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
21 deletions
+32
-21
top-bar-test.js
src/sidebar/components/test/top-bar-test.js
+6
-8
top-bar.js
src/sidebar/components/top-bar.js
+13
-10
top-bar.scss
src/styles/sidebar/components/top-bar.scss
+13
-3
No files found.
src/sidebar/components/test/top-bar-test.js
View file @
cb2f7a46
...
...
@@ -158,16 +158,14 @@ describe('TopBar', () => {
onSignUp
,
});
const
loginText
=
getLoginText
(
wrapper
);
const
l
inks
=
loginText
.
find
(
'a
'
);
assert
.
equal
(
l
ink
s
.
length
,
2
);
const
l
oginButtons
=
loginText
.
find
(
'Button
'
);
assert
.
equal
(
l
oginButton
s
.
length
,
2
);
assert
.
equal
(
links
.
at
(
0
).
text
(),
'Sign up'
);
links
.
at
(
0
).
simulate
(
'click'
);
assert
.
called
(
onSignUp
);
assert
.
equal
(
loginButtons
.
at
(
0
).
props
().
buttonText
,
'Sign up'
);
assert
.
equal
(
loginButtons
.
at
(
0
).
props
().
onClick
,
onSignUp
);
assert
.
equal
(
links
.
at
(
1
).
text
(),
'Log in'
);
links
.
at
(
1
).
simulate
(
'click'
);
assert
.
called
(
onLogin
);
assert
.
equal
(
loginButtons
.
at
(
1
).
props
().
buttonText
,
'Log in'
);
assert
.
equal
(
loginButtons
.
at
(
1
).
props
().
onClick
,
onLogin
);
});
it
(
'Shows user menu when logged in'
,
()
=>
{
...
...
src/sidebar/components/top-bar.js
View file @
cb2f7a46
...
...
@@ -72,16 +72,19 @@ function TopBar({
)}
{
auth
.
status
===
'logged-out'
&&
(
<
span
className
=
"top-bar__login-links"
>
{
/* FIXME-A11Y */
}
{
/* eslint-disable-next-line jsx-a11y/anchor-is-valid */
}
<
a
href
=
"#"
onClick
=
{
onSignUp
}
target
=
"_blank"
style
=
{
loginLinkStyle
}
>
Sign
up
<
/a>{' '
}
/
{
/* FIXME-A11Y */
}
{
/* eslint-disable-next-line jsx-a11y/anchor-is-valid */
}
<
a
href
=
"#"
onClick
=
{
onLogin
}
style
=
{
loginLinkStyle
}
>
Log
in
<
/a
>
<
Button
className
=
"top-bar__login-button"
buttonText
=
"Sign up"
onClick
=
{
onSignUp
}
style
=
{
loginLinkStyle
}
/>{' '
}
/
<
Button
className
=
"top-bar__login-button"
buttonText
=
"Log in"
onClick
=
{
onLogin
}
style
=
{
loginLinkStyle
}
/
>
<
/span
>
)}
{
auth
.
status
===
'logged-in'
&&
(
...
...
src/styles/sidebar/components/top-bar.scss
View file @
cb2f7a46
...
...
@@ -40,10 +40,20 @@
border-bottom
:
none
;
}
.top-bar__login-links
{
flex-shrink
:
0
;
.top-bar__login-button.button
{
padding
:
0
0
.25em
;
background-color
:
transparent
;
color
:
var
.
$brand
;
font-size
:
var
.
$body2-font-size
;
padding-left
:
5px
;
font-weight
:
400
;
&
:hover
{
color
:
var
.
$link-color-hover
;
}
}
.top-bar__login-links
{
display
:
flex
;
}
.top-bar__inner
{
...
...
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