Skip to content

Commit

Permalink
Increase authed/non-authed clarity for mobile view, change wording on…
Browse files Browse the repository at this point in the history
… "Add Club" button (#737)

Make login button more prominent in mobile view, change wording for Add Club
  • Loading branch information
julianweng authored Oct 13, 2024
1 parent a4c1b2a commit c888c78
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
4 changes: 2 additions & 2 deletions frontend/components/DisplayButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ const DisplayButtons = ({
<Link href="/create" className="button is-small is-primary">
<Icon
name="plus"
alt={`create ${OBJECT_NAME_SINGULAR}`}
alt={`register ${OBJECT_NAME_SINGULAR}`}
style={iconStylesDark}
/>
Add {OBJECT_NAME_TITLE_SINGULAR}
Register {OBJECT_NAME_TITLE_SINGULAR}
</Link>
)}
</DisplayButtonsTag>
Expand Down
3 changes: 3 additions & 0 deletions frontend/components/Header/Burger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const Burger = ({ toggle }: BurgerProps): ReactElement => (
<a
role="button"
className="navbar-burger burger"
style={{
marginLeft: '8px',
}}
aria-label="menu"
aria-expanded="false"
data-target="navbarBasicExample"
Expand Down
18 changes: 16 additions & 2 deletions frontend/components/Header/Links.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,20 @@ const LoginButton = styled.a`
}
`

export const MobileLoginButton = styled(LoginButton)`
display: none;
margin-right: 0;
${mediaMaxWidth(MD)} {
display: inline-flex;
}
`
const DesktopLoginButton = styled(LoginButton)`
margin-left: 20px;
${mediaMaxWidth(MD)} {
display: none;
}
`

const StyledLinkAnchor = styled.a`
padding: ${LINK_MARGIN} 20px;
color: ${BANNER_TEXT} !important;
Expand Down Expand Up @@ -116,13 +130,13 @@ const Links = ({ userInfo, authenticated, show }: Props): ReactElement => {
FAQ
</StyledLink>
{authenticated === false && (
<LoginButton
<DesktopLoginButton
className="button"
href={`${LOGIN_URL}?next=${router.asPath}`}
onClick={() => logEvent('login', 'click')}
>
Login
</LoginButton>
</DesktopLoginButton>
)}
{authenticated && userInfo && (
<StyledLink href={SETTINGS_ROUTE}>
Expand Down
16 changes: 15 additions & 1 deletion frontend/components/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import Link from 'next/link'
import { useRouter } from 'next/router'
import { ReactElement, useEffect, useState } from 'react'
import styled from 'styled-components'

import { LOGIN_URL } from '~/utils'
import { logEvent } from '~/utils/analytics'

import { BANNER_BG, BANNER_TEXT, BORDER } from '../../constants/colors'
import {
ANIMATION_DURATION,
Expand Down Expand Up @@ -31,7 +35,7 @@ import {
import Burger from './Burger'
import Feedback from './Feedback'
import Heading from './Head'
import Links from './Links'
import Links, { MobileLoginButton } from './Links'

const Nav = styled.nav`
height: ${NAV_HEIGHT};
Expand Down Expand Up @@ -164,6 +168,7 @@ const isHub = SITE_ID === 'fyh'

const Header = ({ authenticated, userInfo }: HeaderProps): ReactElement => {
const [show, setShow] = useState(false)
const router = useRouter()

const toggle = () => setShow(!show)

Expand All @@ -184,6 +189,15 @@ const Header = ({ authenticated, userInfo }: HeaderProps): ReactElement => {
<Title>{SITE_NAME}</Title>
</LogoItem>
</Link>
{authenticated === false && (
<MobileLoginButton
className="button"
href={`${LOGIN_URL}?next=${router.asPath}`}
onClick={() => logEvent('login', 'click')}
>
Login
</MobileLoginButton>
)}
<Burger toggle={toggle} />
</div>
<Links userInfo={userInfo} authenticated={authenticated} show={show} />
Expand Down

0 comments on commit c888c78

Please sign in to comment.