-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create login UI * Update routing and auth providers * Update design tokens --------- Co-authored-by: Daniel R Farrell <[email protected]>
- Loading branch information
Showing
13 changed files
with
138 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { AuthManager } from '@/lib/auth'; | ||
import { createContext, ReactNode, useContext } from 'react'; | ||
|
||
const AuthContext = createContext(new AuthManager()); | ||
export const useAuthManager = () => useContext(AuthContext); | ||
|
||
const AuthProvider = ({ children }: { children: ReactNode }) => { | ||
return <AuthContext.Provider value={useAuthManager()}>{children}</AuthContext.Provider>; | ||
}; | ||
|
||
export default AuthProvider; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
import { Route } from '@/lib/routes'; | ||
import { observer } from 'mobx-react-lite'; | ||
import { useRouteManager } from '../components/RouteProvider'; | ||
import Login from './login'; | ||
import ProjectEditor from './project'; | ||
import RouteProvider, { useRouteManager } from './Provider'; | ||
|
||
const Routes = observer(() => { | ||
const routeManager = useRouteManager(); | ||
|
||
function renderRoutes() { | ||
switch (routeManager.route) { | ||
case Route.EDITOR: | ||
return <ProjectEditor />; | ||
case Route.LOGIN: | ||
return <div>Login</div>; | ||
default: | ||
return <div>404: Unknown route</div>; | ||
} | ||
switch (routeManager.route) { | ||
case Route.EDITOR: | ||
return <ProjectEditor />; | ||
case Route.LOGIN: | ||
return <Login />; | ||
default: | ||
return <div>404: Unknown route</div>; | ||
} | ||
|
||
return <RouteProvider>{renderRoutes()}</RouteProvider>; | ||
}); | ||
|
||
export default Routes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,97 @@ | ||
import dunes from '@/assets/dunes-login.png'; | ||
import google_logo from '@/assets/google_logo.svg'; | ||
import wordLogo from '@/assets/word-logo.svg'; | ||
import { Button } from '@/components/ui/button'; | ||
import { GitHubLogoIcon } from '@radix-ui/react-icons'; | ||
import { useEffect, useState } from 'react'; | ||
|
||
const Login = () => { | ||
return <>Login</>; | ||
const [lastLoginMethod, setLastLoginMethod] = useState<string | null>(null); | ||
|
||
useEffect(() => { | ||
// Retrieve the last login method from localStorage | ||
}, []); | ||
|
||
const handleLogin = (method: string) => { | ||
// Save the login method to localStorage | ||
// Implement actual login logic here | ||
}; | ||
|
||
return ( | ||
<div className="flex h-[calc(100vh-2.5rem)]"> | ||
<div className="flex flex-col justify-between w-full h-full max-w-xl p-16 space-y-8 overflow-auto"> | ||
<div className="flex items-center space-x-2"> | ||
<img className="w-1/4" src={wordLogo} alt="Onlook logo" /> | ||
</div> | ||
<div className="space-y-8"> | ||
<div className="space-y-2 uppercase border-border rounded-full p-1 px-2 w-auto inline-block text-micro border-[0.5px] text-blue-500"> | ||
<p>Alpha</p> | ||
</div> | ||
<div className="space-y-4"> | ||
<h1 className="text-title1"> | ||
{lastLoginMethod ? 'Welcome back to Onlook' : 'Welcome to Onlook'} | ||
</h1> | ||
<p className="text-text text-large"> | ||
Onlook is an open-source visual editor for React apps. Design directly | ||
in your live product. | ||
</p> | ||
</div> | ||
<div className="space-x-2 flex flex-row"> | ||
<div className="flex flex-col items-center w-full"> | ||
<Button | ||
variant="outline" | ||
className={`w-full text-active text-small ${lastLoginMethod === 'github' ? 'bg-teal-1000 border-teal-700 text-teal-100 text-small hover:bg-teal-800 hover:border-teal-500' : 'bg-bg'}`} | ||
onClick={() => handleLogin('github')} | ||
> | ||
<GitHubLogoIcon className="w-4 h-4 mr-2" /> Login with GitHub | ||
</Button> | ||
{lastLoginMethod === 'github' && ( | ||
<p className="text-teal-500 text-small mt-1"> | ||
You used this last time | ||
</p> | ||
)} | ||
</div> | ||
<div className="flex flex-col items-center w-full"> | ||
<Button | ||
variant="outline" | ||
className={`w-full text-active text-small ${lastLoginMethod === 'google' ? 'bg-teal-1000 border-teal-700 text-teal-100 text-small hover:bg-teal-800 hover:border-teal-500' : 'bg-bg'}`} | ||
onClick={() => handleLogin('google')} | ||
> | ||
<img src={google_logo} className="w-4 h-4 mr-2" alt="Google logo" />{' '} | ||
Login with Google | ||
</Button> | ||
{lastLoginMethod === 'google' && ( | ||
<p className="text-teal-500 text-small mt-1"> | ||
You used this last time | ||
</p> | ||
)} | ||
</div> | ||
</div> | ||
<p className="text-small text-text"> | ||
By signing up, you agree to our{' '} | ||
<a href="#" className="underline"> | ||
Terms and Conditions | ||
</a>{' '} | ||
and{' '} | ||
<a href="#" className="underline"> | ||
Privacy Policy | ||
</a> | ||
</p> | ||
</div> | ||
<div className="flex flex-row space-x-1 text-small text-gray-400"> | ||
<p>Version {window.env.APP_VERSION}</p> | ||
<p>• Last updated 2 weeks ago</p> | ||
</div> | ||
</div> | ||
<div className="hidden w-full lg:block md:block m-6"> | ||
<img | ||
className="w-full h-full object-cover rounded-xl" | ||
src={dunes} | ||
alt="Onlook dunes" | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Login; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters