From 15057462c85f1d5dacd0e75f7191afddb9f25c42 Mon Sep 17 00:00:00 2001 From: Rupa-Rd Date: Sun, 10 Mar 2024 17:32:07 +0530 Subject: [PATCH] Profile after authentication is added --- open-source-galaxy/src/components/Profile.css | 20 +++++++++++++++++++ open-source-galaxy/src/components/Profile.js | 17 ++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 open-source-galaxy/src/components/Profile.css create mode 100644 open-source-galaxy/src/components/Profile.js diff --git a/open-source-galaxy/src/components/Profile.css b/open-source-galaxy/src/components/Profile.css new file mode 100644 index 0000000..69e28a3 --- /dev/null +++ b/open-source-galaxy/src/components/Profile.css @@ -0,0 +1,20 @@ + + + +.profile-pic > img{ + height: 50px; + width: 50px; + margin: 10px 20px 5px 5px; + border-radius: 50%; +} + +@media (max-width: 1025px){ + + .profile-pic > img{ + height: 40px; + width: 40px; + margin-right: 50px; + cursor: pointer; + border-radius: 50%; + } +} \ No newline at end of file diff --git a/open-source-galaxy/src/components/Profile.js b/open-source-galaxy/src/components/Profile.js new file mode 100644 index 0000000..8bf5694 --- /dev/null +++ b/open-source-galaxy/src/components/Profile.js @@ -0,0 +1,17 @@ +import React from 'react' +import { useAuth0 } from '@auth0/auth0-react'; +import './Profile.css'; + +function Profile() { + const { user, isAuthenticated, logout} = useAuth0(); + return ( + isAuthenticated && ( +
+ {user.name} logout({ logoutParams: { returnTo: window.location.origin } })}/> +
+ ) + + ) +} + +export default Profile