-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.tsx
More file actions
100 lines (96 loc) · 3.01 KB
/
demo.tsx
File metadata and controls
100 lines (96 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
'use client';
import { useState } from 'react';
import cn from 'classnames';
import { DemoContainer } from 'src/components';
import './styles.scss';
function FormSwitchDemo() {
const [switched, setSwitched] = useState(false);
return (
<div className="local-container">
<div className={cn('demo', { 's--switched': switched })}>
<div className="demo__inner">
<div className="demo__forms">
<div className="demo__form">
<div className="demo__form-content">
<FakeForm
heading="Welcome back"
fields={['email', 'password']}
submitLabel="Sign in"
/>
</div>
</div>
<div className="demo__form">
<div className="demo__form-content">
<FakeForm
heading="Time to feel like home"
fields={['name', 'email', 'password']}
submitLabel="Sign up"
/>
</div>
</div>
</div>
<div className="demo__switcher">
<div className="demo__switcher-inner">
<div className="demo__switcher-content">
<div className="demo__switcher-text">
<div>
<h3>New here?</h3>
<p>
Sign up and discover great amount of new opportunities!
</p>
</div>
<div>
<h3>One of us?</h3>
<p>
If you already has an account, just sign in. We've
missed you!
</p>
</div>
</div>
<button
className="demo__switcher-btn"
onClick={() => setSwitched(!switched)}
>
<span className="animated-border" />
<span className="demo__switcher-btn-inner">
<span>Sign Up</span>
<span>Sign In</span>
</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
);
}
interface FakeFormProps {
heading: string;
fields: string[];
submitLabel: string;
}
function FakeForm({ heading, fields, submitLabel }: FakeFormProps) {
return (
<form className="form" onSubmit={(e) => e.preventDefault()}>
<div className="form__heading">{heading}</div>
{fields.map((field) => (
<label className="form__field" key={field}>
<span className="form__field-label">{field}</span>
<input className="form__field-input" type={field} />
</label>
))}
<button type="submit" className="form__submit">
{submitLabel}
</button>
</form>
);
}
export default function Demo() {
return (
<DemoContainer
component={FormSwitchDemo}
beforeDemo={<p>Click on SIGN UP button to trigger animation</p>}
/>
);
}