Skip to content

Commit 487d754

Browse files
committed
refactor: have a dedicated playground login page
1 parent b127043 commit 487d754

File tree

2 files changed

+85
-76
lines changed

2 files changed

+85
-76
lines changed

playground/pages/index.vue

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,9 @@
11
<script setup>
2-
const handleSuccess = (user) => {
3-
console.log('[Nuxt Users] Login successful:', user)
4-
alert(`Welcome back, ${user.name}!`)
5-
}
6-
7-
const handleError = (error) => {
8-
console.log('[Nuxt Users] Login error:', error)
9-
}
10-
11-
const handleSubmit = (data) => {
12-
console.log('[Nuxt Users] Form submitted:', data)
13-
}
142
</script>
153

164
<template>
17-
<div class="demo-container">
18-
<h1>Nuxt Users</h1>
19-
20-
<div class="demo-section">
21-
<h2>Login Component Demo</h2>
22-
<p>This is the default login form with all default styling and content.</p>
23-
</div>
24-
25-
<LoginForm
26-
@success="handleSuccess"
27-
@error="handleError"
28-
@submit="handleSubmit"
29-
/>
30-
</div>
5+
<h1>Nuxt Users Index</h1>
316
</template>
327

338
<style scoped>
34-
.demo-container {
35-
max-width: 75rem;
36-
margin: 0 auto;
37-
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
38-
}
39-
40-
.demo-container h1 {
41-
text-align: center;
42-
margin-bottom: 1em;
43-
color: var(--color-gray-800);
44-
font-size: 2rem;
45-
font-weight: 700;
46-
}
47-
48-
.demo-section {
49-
margin-bottom: 1em;
50-
border: 1px solid var(--color-border);
51-
border-radius: 12px;
52-
background: var(--color-bg-secondary);
53-
}
54-
55-
.demo-section h2 {
56-
color: var(--color-gray-700);
57-
margin-bottom: 0.5em;
58-
font-size: 1.5rem;
59-
font-weight: 600;
60-
text-align: center;
61-
}
62-
63-
.demo-section p {
64-
color: var(--color-gray-500);
65-
margin-bottom: 2em;
66-
font-size: 0.875rem;
67-
text-align: center;
68-
}
69-
70-
/* Responsive design */
71-
@media (max-width: 48rem) {
72-
.demo-container {
73-
padding: .5em;
74-
}
75-
76-
.demo-section {
77-
padding: .5em;
78-
}
79-
80-
.demo-container h1 {
81-
font-size: 2rem;
82-
}
83-
}
849
</style>

playground/pages/login.vue

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<script setup>
2+
const handleSuccess = (user) => {
3+
console.log('[Nuxt Users] Login successful:', user)
4+
alert(`Welcome back, ${user.name}!`)
5+
}
6+
7+
const handleError = (error) => {
8+
console.log('[Nuxt Users] Login error:', error)
9+
}
10+
11+
const handleSubmit = (data) => {
12+
console.log('[Nuxt Users] Form submitted:', data)
13+
}
14+
</script>
15+
16+
<template>
17+
<div class="demo-container">
18+
<h1>Nuxt Users</h1>
19+
20+
<div class="demo-section">
21+
<h2>Login Component Demo</h2>
22+
<p>This is the default login form with all default styling and content.</p>
23+
</div>
24+
25+
<LoginForm
26+
@success="handleSuccess"
27+
@error="handleError"
28+
@submit="handleSubmit"
29+
/>
30+
</div>
31+
</template>
32+
33+
<style scoped>
34+
.demo-container {
35+
max-width: 75rem;
36+
margin: 0 auto;
37+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
38+
}
39+
40+
.demo-container h1 {
41+
text-align: center;
42+
margin-bottom: 1em;
43+
color: var(--color-gray-800);
44+
font-size: 2rem;
45+
font-weight: 700;
46+
}
47+
48+
.demo-section {
49+
margin-bottom: 1em;
50+
border: 1px solid var(--color-border);
51+
border-radius: 12px;
52+
background: var(--color-bg-secondary);
53+
}
54+
55+
.demo-section h2 {
56+
color: var(--color-gray-700);
57+
margin-bottom: 0.5em;
58+
font-size: 1.5rem;
59+
font-weight: 600;
60+
text-align: center;
61+
}
62+
63+
.demo-section p {
64+
color: var(--color-gray-500);
65+
margin-bottom: 2em;
66+
font-size: 0.875rem;
67+
text-align: center;
68+
}
69+
70+
/* Responsive design */
71+
@media (max-width: 48rem) {
72+
.demo-container {
73+
padding: .5em;
74+
}
75+
76+
.demo-section {
77+
padding: .5em;
78+
}
79+
80+
.demo-container h1 {
81+
font-size: 2rem;
82+
}
83+
}
84+
</style>

0 commit comments

Comments
 (0)