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
Hide 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', () => {
...
@@ -158,16 +158,14 @@ describe('TopBar', () => {
onSignUp
,
onSignUp
,
});
});
const
loginText
=
getLoginText
(
wrapper
);
const
loginText
=
getLoginText
(
wrapper
);
const
l
inks
=
loginText
.
find
(
'a
'
);
const
l
oginButtons
=
loginText
.
find
(
'Button
'
);
assert
.
equal
(
l
ink
s
.
length
,
2
);
assert
.
equal
(
l
oginButton
s
.
length
,
2
);
assert
.
equal
(
links
.
at
(
0
).
text
(),
'Sign up'
);
assert
.
equal
(
loginButtons
.
at
(
0
).
props
().
buttonText
,
'Sign up'
);
links
.
at
(
0
).
simulate
(
'click'
);
assert
.
equal
(
loginButtons
.
at
(
0
).
props
().
onClick
,
onSignUp
);
assert
.
called
(
onSignUp
);
assert
.
equal
(
links
.
at
(
1
).
text
(),
'Log in'
);
assert
.
equal
(
loginButtons
.
at
(
1
).
props
().
buttonText
,
'Log in'
);
links
.
at
(
1
).
simulate
(
'click'
);
assert
.
equal
(
loginButtons
.
at
(
1
).
props
().
onClick
,
onLogin
);
assert
.
called
(
onLogin
);
});
});
it
(
'Shows user menu when logged in'
,
()
=>
{
it
(
'Shows user menu when logged in'
,
()
=>
{
...
...
src/sidebar/components/top-bar.js
View file @
cb2f7a46
...
@@ -72,16 +72,19 @@ function TopBar({
...
@@ -72,16 +72,19 @@ function TopBar({
)}
)}
{
auth
.
status
===
'logged-out'
&&
(
{
auth
.
status
===
'logged-out'
&&
(
<
span
className
=
"top-bar__login-links"
>
<
span
className
=
"top-bar__login-links"
>
{
/* FIXME-A11Y */
}
<
Button
{
/* eslint-disable-next-line jsx-a11y/anchor-is-valid */
}
className
=
"top-bar__login-button"
<
a
href
=
"#"
onClick
=
{
onSignUp
}
target
=
"_blank"
style
=
{
loginLinkStyle
}
>
buttonText
=
"Sign up"
Sign
up
onClick
=
{
onSignUp
}
<
/a>{' '
}
style
=
{
loginLinkStyle
}
/
{
/* FIXME-A11Y */
}
/>{' '
}
{
/* eslint-disable-next-line jsx-a11y/anchor-is-valid */
}
/
<
a
href
=
"#"
onClick
=
{
onLogin
}
style
=
{
loginLinkStyle
}
>
<
Button
Log
in
className
=
"top-bar__login-button"
<
/a
>
buttonText
=
"Log in"
onClick
=
{
onLogin
}
style
=
{
loginLinkStyle
}
/
>
<
/span
>
<
/span
>
)}
)}
{
auth
.
status
===
'logged-in'
&&
(
{
auth
.
status
===
'logged-in'
&&
(
...
...
src/styles/sidebar/components/top-bar.scss
View file @
cb2f7a46
...
@@ -40,10 +40,20 @@
...
@@ -40,10 +40,20 @@
border-bottom
:
none
;
border-bottom
:
none
;
}
}
.top-bar__login-links
{
.top-bar__login-button.button
{
flex-shrink
:
0
;
padding
:
0
0
.25em
;
background-color
:
transparent
;
color
:
var
.
$brand
;
font-size
:
var
.
$body2-font-size
;
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
{
.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