-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add individual components to SolidJS package (#171)
- Loading branch information
Andrew Smith
authored
May 8, 2023
1 parent
7482109
commit 4ee8437
Showing
5 changed files
with
130 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@supabase/auth-ui-solid': minor | ||
--- | ||
|
||
Add individual components to SolidJS Auth UI |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { default as Auth } from './Auth' | ||
export * from './interfaces' | ||
export * from './ui' |
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,110 @@ | ||
import Auth from '../Auth' | ||
import { Auth as AuthProps } from '../../../types' | ||
import { PREPENDED_CLASS_NAMES } from '@supabase/auth-ui-shared' | ||
import { css } from '@stitches/core' | ||
import { CssComponent } from '@stitches/core/types/styled-component' | ||
import { JSXElement } from 'solid-js' | ||
|
||
const containerDefaultStyles = css({ | ||
borderRadius: '12px', | ||
boxShadow: 'rgba(100, 100, 111, 0.2) 0px 7px 29px 0px', | ||
width: '360px', | ||
padding: '28px 32px', | ||
}) | ||
|
||
interface Card { | ||
className?: string | CssComponent | ||
} | ||
|
||
export const AuthCard = ({ | ||
children, | ||
appearance, | ||
}: { | ||
children?: JSXElement | ||
appearance?: Card | ||
}) => { | ||
const classNames = [ | ||
`${PREPENDED_CLASS_NAMES}_ui-card`, | ||
containerDefaultStyles(), | ||
appearance?.className, | ||
] | ||
return <div class={classNames.join(' ')}>{children}</div> | ||
} | ||
|
||
export const SignUp = ( | ||
props: Omit<AuthProps, 'view' | 'onlyThirdPartyProviders'> | ||
) => { | ||
return ( | ||
<Auth | ||
showLinks={false} | ||
{...props} | ||
onlyThirdPartyProviders={false} | ||
view="sign_up" | ||
/> | ||
) | ||
} | ||
|
||
export const SignIn = ( | ||
props: Omit<AuthProps, 'view' | 'onlyThirdPartyProviders'> | ||
) => { | ||
return ( | ||
<Auth | ||
showLinks={false} | ||
{...props} | ||
onlyThirdPartyProviders={false} | ||
view="sign_in" | ||
/> | ||
) | ||
} | ||
|
||
export const MagicLink = ( | ||
props: Omit< | ||
AuthProps, | ||
'view' | 'onlyThirdPartyProviders' | 'magicLink' | 'showLinks' | ||
> | ||
) => { | ||
return <Auth {...props} view="magic_link" showLinks={false} /> | ||
} | ||
|
||
export const SocialAuth = ( | ||
props: Omit< | ||
AuthProps, | ||
| 'view' | ||
| 'onlyThirdPartyProviders' | ||
| 'magicLink' | ||
| 'showLinks' | ||
| 'children' | ||
> | ||
) => { | ||
return ( | ||
<Auth | ||
{...props} | ||
view="sign_in" | ||
showLinks={false} | ||
onlyThirdPartyProviders={true} | ||
/> | ||
) | ||
} | ||
|
||
export const ForgottenPassword = ( | ||
props: Pick< | ||
AuthProps, | ||
| 'supabaseClient' | ||
| 'appearance' | ||
| 'localization' | ||
| 'theme' | ||
| 'showLinks' | ||
| 'redirectTo' | ||
> | ||
) => { | ||
return <Auth showLinks={false} {...props} view="forgotten_password" /> | ||
} | ||
|
||
export const UpdatePassword = ( | ||
props: Pick< | ||
AuthProps, | ||
'supabaseClient' | 'appearance' | 'localization' | 'theme' | ||
> | ||
) => { | ||
return <Auth {...props} view="update_password" /> | ||
} |