New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
(feat): custom signin page #6016
(feat): custom signin page #6016
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's great having you contribute to this project
Welcome to the community 馃If you would like to continue contributing to open source and would like to do it with an awesome inclusive community, you should join our Discord chat and our GitHub Organisation - we help and encourage each other to contribute to open source little and often 馃 . Any questions let us know.
A couple of suggestion from my end :
|
Thanks @ChinmayMhatre for the suggestion, I'll work on this when I get free, also I may reach out to you on EddieHub discrod for help :) |
@ChinmayMhatre I've done some tweaking. Can you review it? |
I'll take a look tommorow! |
@NiazMorshed2007 please add screenshots of the page in light mode and dark mode |
@ChinmayMhatre Sure thing! |
Ui looks good to me. Maybe @eddiejaoude can take a look for any more optimizations. |
return ( | ||
<BlankLayout> | ||
{page} | ||
</BlankLayout> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The formatting doesn't look quite right, can you check you are using our Prettier config in VScode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep we use the default, that is fine, the plugin will work on save usually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but it doesn't fix the formatting. I've pinged on discord about this issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 馃憤 some inline comments
export default function SignIn({ providers }) { | ||
|
||
const handleProviderIcon = (provider_name) => { | ||
if (provider_name === "GitHub") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A switch
would be better here and then add a default
at the end for a fallback login icon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But for now maybe just add a return out side of the if
with a default key/secure icon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean like this?
const handleProviderIcon = (provider_name) => {
if (provider_name === "GitHub") {
return <BsGithub className="text-xl" />
}
return <LockIcon />
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes 馃憤 , but you might want to add the same class to it also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you 馃憤
* feat: custom signin page (#6016) * (feat): login page re-designed * proposed-changes * (update): custom login page --------- Co-authored-by: Amanda <97615019+amandamartin-dev@users.noreply.github.com> Co-authored-by: Eddie Jaoude <eddie@jaoudestudios.com> * feat: custom login page * fix: sub title text --------- Co-authored-by: Niaz Morshed <77217706+NiazMorshed2007@users.noreply.github.com> Co-authored-by: Amanda <97615019+amandamartin-dev@users.noreply.github.com>
This feature closes #5856 by adding custom login page.
What I included?
1. Configuration part
I added some configuration in the
[...nextauth].js
file to allow creating custom page inauth/signin
. Changes I added 馃憞2. Design and connecting the login functionality part
Kept the design simple but I'm always open to redesign if you wish!
Can I see a screenshot?
Sure! Here is how it's currently look like:
How did I managed the login funtionality?
I followed the best practices from NextAuth documentation to implement this. Here is a little brief about it 馃憞:
getServerSideProps()
function I checked if the user is already logged in or not. If the user is logged I sent them to/
page and if not I pushed the providers in theprops
of the pageprops
and turnedproviders
into an array usingObject.values()
and mapped over to display different auth providers. Notice thehandleProviderIcon
function here, it will check the provider name and render icon accordingly.The
handleProviderIcon
function:That's is the wrap.
I look forward for reviews.
Thanks!馃檶