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

Ashton logout userface #46

Merged
merged 5 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 174 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion src/components/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React, { useState, useEffect } from 'react'
import Image from 'next/image'
import searchIcon from '../../public/svg/search.svg'
import logo from '../../public/quaysideLogo.png'
import { useSession } from 'next-auth/react'
import { useSession, signOut } from 'next-auth/react'

/**
* A Navbar component that fetches a user's name from a specified API and displays a navigation bar with several interactive elements.
Expand Down Expand Up @@ -89,6 +89,20 @@ const Navbar = () => {
</div>
</div>

{/* Sign Out */}
<div className='flex w-2/12 lg:w-1/12 justify-end my-auto text-right px-2'>
<button onClick={() => signOut()}>Sign Out</button>
</div>

{/* User Avatar Icon */}
{session && session.user && (
<div>
<img
src={session.user.image}
style={{ width: '40px', height: '40px', borderRadius: '50%' }}
/>
</div>
)}
{/* User */}
<div className='flex w-2/12 lg:w-1/12 justify-end my-auto text-right px-2'> {name} </div>

Expand Down