|
1 | 1 | ---
|
| 2 | +import type { SignUpProps } from './signup' |
| 3 | +
|
2 | 4 | import {
|
3 | 5 | Button,
|
4 | 6 | Card,
|
5 | 7 | Input
|
6 | 8 | } from 'webcoreui/astro'
|
| 9 | +
|
| 10 | +interface Props extends SignUpProps { |
| 11 | + primaryButtonSelector?: string |
| 12 | + secondaryButtonSelector?: string |
| 13 | +} |
| 14 | +
|
| 15 | +const { |
| 16 | + label = 'Sign up', |
| 17 | + emailLabel = 'Email', |
| 18 | + emailPlaceholder = 'Enter your email', |
| 19 | + emailSubText = '', |
| 20 | + passwordLabel = 'Password', |
| 21 | + passwordPlaceholder = 'Enter your password', |
| 22 | + passwordSubText = 'Generate a unique password <a href="#">here</a>', |
| 23 | + primaryButtonTheme = 'success', |
| 24 | + primaryButtonLabel = 'Create an account', |
| 25 | + secondaryButtonTheme = 'secondary', |
| 26 | + secondaryButtonLabel = 'Sign in', |
| 27 | + primaryButtonSelector, |
| 28 | + secondaryButtonSelector |
| 29 | +} = Astro.props |
7 | 30 | ---
|
8 | 31 |
|
9 |
| -<Card title="Sign up"> |
10 |
| - <form class="flex column"> |
11 |
| - <Input label="Email" placeholder="Enter your email" /> |
| 32 | +<Card title={label}> |
| 33 | + <form class="flex column sign-up-form"> |
| 34 | + <Input |
| 35 | + label={emailLabel} |
| 36 | + placeholder={emailPlaceholder} |
| 37 | + subText={emailSubText} |
| 38 | + autocomplete="on" |
| 39 | + /> |
12 | 40 | <Input
|
13 | 41 | type="password"
|
14 |
| - label="Password" |
15 |
| - placeholder="Enter your password" |
16 |
| - subText="Generate a unique password <a href='#'>here</a>" |
| 42 | + label={passwordLabel} |
| 43 | + placeholder={passwordPlaceholder} |
| 44 | + subText={passwordSubText} |
| 45 | + autocomplete="on" |
17 | 46 | />
|
18 | 47 | <div class="flex xs wrap">
|
19 |
| - <Button theme="success">Create an account</Button> |
20 |
| - <Button theme="secondary">Sign in</Button> |
| 48 | + {primaryButtonLabel && ( |
| 49 | + <Button theme={primaryButtonTheme} className={primaryButtonSelector}> |
| 50 | + {primaryButtonLabel} |
| 51 | + </Button> |
| 52 | + )} |
| 53 | + {secondaryButtonLabel && ( |
| 54 | + <Button theme={secondaryButtonTheme} className={secondaryButtonSelector}> |
| 55 | + {secondaryButtonLabel} |
| 56 | + </Button> |
| 57 | + )} |
21 | 58 | </div>
|
22 | 59 | </form>
|
23 | 60 | </Card>
|
| 61 | + |
| 62 | +<script> |
| 63 | + import { on } from '@utils/DOMUtils' |
| 64 | + |
| 65 | + on('.sign-up-form', 'submit', (event: Event) => event.preventDefault()) |
| 66 | +</script> |
0 commit comments