Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the SignInAndUpTheme #9

Closed
rishabhpoddar opened this issue Oct 15, 2020 · 13 comments
Closed

Implement the SignInAndUpTheme #9

rishabhpoddar opened this issue Oct 15, 2020 · 13 comments

Comments

@rishabhpoddar
Copy link
Member

rishabhpoddar commented Oct 15, 2020

  • import { SignInAndUpTheme } from "supertokens-auth-react/recipe/emailpassword"
  • There should be two sub themes in here: SignUpTheme and SignInTheme.
  • Themes should use a ThemeProvider which can be used to overwrite the default theme based on the passed props.
@mufassirkazi
Copy link

mufassirkazi commented Oct 16, 2020

Sign Up UI

Sign Up form with no Terms and condition checkbox (524 px width of white container)

Sign Up form with Terms and condition checkbox (524 px width of white container)

Sign Up form with no Terms and condition checkbox (420 px width of white container)

Sign Up form with Terms and condition checkbox (420 px width of white container)

Sign In UI

Sign In form with Terms and condition checkbox (524 px width of white container)

Sign In form with Terms and condition checkbox (420 px width of white container)

Loading Screen

Sign out State

Notes

  • The Sign Up and Sign In UI has a white container which is 524 pixels wide. This container is flexible in the sense that the width of this container can be reduced to as small as 420 pixels without affecting other elements inside it. Once the container width goes below 420 px, the UI should change to that of the 420 pixels one which was specifically designed.
  • The new 420 pixels white container is again flexible till a width of 320 pixels. 320 pixels is the smallest size we support. A user should have minimum 320 pixels width space for the login widget on his website.
  • We have correct states i.e orange ticks if that input field is properly filled. The 'Email Id' field gets an orange tick only after the user has provided the correct email id && clicks anywhere outside the input field.
  • The password field gets the orange tick when the user types in the password and our system detects that the condition is true i.e (8 characters and 1 number). As soon as the condition is true, there should be an orange tick even if the user continues to type.
  • In the error states, as soon as the user changes, adds or deletes even one character, the red warning icon, red error message and the red border should disappear.
  • The UI has been designed keeping our brand color i.e #FF9933 (orange) in mind. If a user changes this color, the new color will be reflected in all the places where the previous color was displayed.
  • For the error state, the primary color is #FF1717. The secondary color is #FFEBEB which is used in the 'Incorrect combination state' and 'Something went wrong state' to support the error states as a background color. A user can change these colors.
  • By default, the terms and conditions checkbox should be checked.
  • Required state is defined as the input field that needs to be filled to continue further in the sign up process. If the sign up form has only email id and password input field, then we don't have the "*" which signifies required. We also will not have the required field if all the fields in the sign up form are marked as required by the person creating the sign up form. In essence, the required state will only be available if the number of fields are more than 2 (which includes email and password) and among the total number of fields atleast one field is a non-required field.

@kant01ne
Copy link
Contributor

Notes on using default browser messages:
Source
TL;DR Not doing it.

  • Styling is editable but different in all browsers, making it hard to keep consistency.
  • Impossible to overwrite messages
  • Temporary messages, focusing in the message will make it disappear.

@mufassirkazi
Copy link

mufassirkazi commented Oct 27, 2020

Updated comment above to include design of successful sign in/ sign up with sign out functionality

@mufassirkazi
Copy link

mufassirkazi commented Oct 28, 2020

@NkxxkN I have added the "Required state" design in the main comment above along with the conditions under which it should be rendered in the last point of notes.

@rishabhpoddar
Copy link
Member Author

@mufassirkazi , you can change the design back to removing the checkbox for privacy policy and ToU.. instead, you can say "By signing up, you agree to..."

Sorry about that miscommunication eariler. The above also seems to be OK from a GDPR point of view since a lot of large, global companies do that

@mufassirkazi
Copy link

No problem. @NkxxkN I updated the designs again and the designs are listed under the headers "Sign Up form with no Terms and condition checkbox (524 px width of white container)" and "Sign Up form with no Terms and condition checkbox (420 px width of white container)" resp.

@rishabhpoddar
Copy link
Member Author

@mufassirkazi are we sure we want to use orange as the default theme? As opposed to a more neutral colour like blue?

  • Pro: Orange is our brand colour.. so over time, high chances of brand recognition
  • Con: I think most people would want to change orange.

I prefer if we change it to a more neutral colour. But we can also do this later.

@mufassirkazi
Copy link

mufassirkazi commented Oct 29, 2020

Let's keep orange now. Even Auth0 keeps their brand color.
Agreed, that people will want to change the orange, but then again, there is no one one color that is right. So better to use the pro that we have.

@kant01ne
Copy link
Contributor

So at the moment overriding css is pretty straightforward which is nice! But we don't have a good way to override the "orange" color everywhere (In the button, the input focus state and in the valid email check image).

image

It can be done by overriding each properties in the EmailPassword.init({style: {...}}) but if you use another theme, you would have to duplicate your changes without knowing if you replaced all the colors... That seems to be a lot of work for someone who is allergic to orange 😄

Should we allow to override some CSS properties in SuperTokens.init() directly? That would need to be documented but we can make it pretty simple:

Default palette:

SuperTokens.init({
  appInfo: {...},
  palette: {
    colors: {
        background: "white",
        inputBackground: "#f2f2f2",
        primary: "#ff9b33",
        secondary: "#656565",
        link: "#0076ff",
        error: "#ff1717",
        textPrimary: "#222222"
    },
    fonts: {
        size: [14, 16, 28]
    }
  }
}

Override just the orange color:

SuperTokens.init({
  appInfo: {...},
  palette: {
    colors: {
        primary: "blue"
    }
  }
}

@rishabhpoddar

@rishabhpoddar
Copy link
Member Author

@NkxxkN . We should not have this in the supertokens.init level. We should have this in the emailpassword.init level. If the user specifies this and also the css (and they clash), then the CSS should be taken. So the priority is:

Our default CSS is lower than palette is lower than their provided CSS in style prop

In terms of what we allow them to change via this palette object:

  • Colours:
    • primary - cool
    • secondary - this refers to which colours?
    • background - refers to what?
    • link - this refers to the sign up and forgot password link? Are they not two different colours by defaukt?
    • error - cool
    • textPrimary - can we change this to be called text?
  • fonts:
    • Not sure if this is needed right now.

@rishabhpoddar
Copy link
Member Author

@mufassirkazi please discuss the above with @NkxxkN

@kant01ne
Copy link
Contributor

We should not have this in the supertokens.init level. We should have this in the emailpassword.init level.

Agreed

Our default CSS is lower than palette is lower than their provided CSS in style prop

So the default CSS is created with the help palette. The role of the palette is to have a centralised place for generic values that are used in multiple places in the css. Example of the orange colour above which is injected in multiple CSS properties.

The default CSS (generated with the palette - provided by the customer or not) can be overwritten by the CSS provided by the customer.

colors: {
        background: "white"
        inputBackground: "#f2f2f2",
        primary: "#ff9b33",
        error: "#ff1717",
        textPrimary: "#222222",
        textSecondary: "#656565",
        textLink: "#0076ff"
    },

    fonts: {
        size: [14, 16, 28]
    }
};

image

Questions: @mufassirkazi

  • Do we want to decouple textPrimary? i.e. changing the title color changes the label colors too. Do we need to introduce a "title" color?

  • Do we want to let users change font size from the palette or directly from overriding the css?

  • Anything else that should be in the palette? or that should be removed?

@mufassirkazi
Copy link

@NkxxkN

  • Please introduce a "title" color. Let the user have the ability to have different colors for the "Sign in" text and the label text. By default they should have the same color

  • Users can change font size from overriding the css

  • Rest, everything seems fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants