Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Fixed Navbar Login/Account button on Mobile. #2

Closed
wants to merge 1 commit into from

Conversation

Lezzz
Copy link

@Lezzz Lezzz commented May 11, 2023

While trying to set-up the template for the first time I noticed that my Login button was not working on mobile and it was simply redirecting me to the main page (or to be more exact - to the /account page but I was not logged in).

The purpose of this PR is to fix the issue by adding an user check that switches between /account and /login depending on Auth state, like on Desktop.

Old behaviour:

  • User can't login on mobile (unless explicitly going to /login) because the Account button is not directing to the login page first.

New behaviour:

  • For logged in users, the Account button will direct them to their account page.
  • For logged out users, the Account button will direct them to the login page.

Please review the changes and let me know if any further modifications are required.

+      {user ? (
       <Disclosure.Button
         as='a'
         href='/account'
         className='block px-4 py-2 text-base font-medium text-gray-500 hover:bg-gray-100 hover:text-gray-800'
       >
         Account
       </Disclosure.Button>
+      )   :   (
+        <Disclosure.Button
+        as='a'
+        href='/login'
+        className='block px-4 py-2 text-base font-medium text-gray-500 hover:bg-gray-100 hover:text-gray-800'
+      >
+        Account
+      </Disclosure.Button>
+      )}

@Lezzz Lezzz closed this by deleting the head repository Aug 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant