Commit cb2f7a46 authored by Lyza Danger Gardner's avatar Lyza Danger Gardner

Convert ‘Log in’ and ‘Sign up’ links to `Button` components

Part of #1727
parent e279908b
...@@ -158,16 +158,14 @@ describe('TopBar', () => { ...@@ -158,16 +158,14 @@ describe('TopBar', () => {
onSignUp, onSignUp,
}); });
const loginText = getLoginText(wrapper); const loginText = getLoginText(wrapper);
const links = loginText.find('a'); const loginButtons = loginText.find('Button');
assert.equal(links.length, 2); assert.equal(loginButtons.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', () => {
......
...@@ -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' && (
......
...@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment