Merge branch 'unified-app-controls-style'
This commit is contained in:
@@ -61,7 +61,9 @@ import { mount } from '@vue/test-utils'
|
|||||||
import { describe, expect, it, vi } from 'vitest'
|
import { describe, expect, it, vi } from 'vitest'
|
||||||
import LoginPage from './LoginPage.vue'
|
import LoginPage from './LoginPage.vue'
|
||||||
|
|
||||||
const login = vi.fn()
|
const { login } = vi.hoisted(() => ({
|
||||||
|
login: vi.fn(),
|
||||||
|
}))
|
||||||
|
|
||||||
vi.mock('../composables/useAuth', () => ({
|
vi.mock('../composables/useAuth', () => ({
|
||||||
useAuth: () => ({ login }),
|
useAuth: () => ({ login }),
|
||||||
@@ -89,8 +91,10 @@ import { flushPromises, mount } from '@vue/test-utils'
|
|||||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||||
import AdminPage from './AdminPage.vue'
|
import AdminPage from './AdminPage.vue'
|
||||||
|
|
||||||
const authedFetch = vi.fn()
|
const { authedFetch, logout } = vi.hoisted(() => ({
|
||||||
const logout = vi.fn()
|
authedFetch: vi.fn(),
|
||||||
|
logout: vi.fn(),
|
||||||
|
}))
|
||||||
|
|
||||||
vi.mock('../composables/useAuth', () => ({
|
vi.mock('../composables/useAuth', () => ({
|
||||||
authedFetch: (...args: unknown[]) => authedFetch(...args),
|
authedFetch: (...args: unknown[]) => authedFetch(...args),
|
||||||
@@ -286,6 +290,7 @@ Expected: Still FAIL because component templates have not been updated yet.
|
|||||||
- Modify: `src/components/LoginPage.vue`
|
- Modify: `src/components/LoginPage.vue`
|
||||||
- Modify: `src/components/BookListPage.vue`
|
- Modify: `src/components/BookListPage.vue`
|
||||||
- Modify: `src/components/AdminPage.vue`
|
- Modify: `src/components/AdminPage.vue`
|
||||||
|
- Modify: `src/style.css`
|
||||||
|
|
||||||
- [ ] **Step 1: Update LoginPage template classes**
|
- [ ] **Step 1: Update LoginPage template classes**
|
||||||
|
|
||||||
@@ -356,7 +361,11 @@ In `src/components/BookListPage.vue`:
|
|||||||
|
|
||||||
Delete the scoped style block from `src/components/BookListPage.vue` because `.app-page-header` and `.app-page-actions` replace its rules.
|
Delete the scoped style block from `src/components/BookListPage.vue` because `.app-page-header` and `.app-page-actions` replace its rules.
|
||||||
|
|
||||||
- [ ] **Step 5: Update AdminPage template classes**
|
- [ ] **Step 5: Remove old BookListPage global control rules**
|
||||||
|
|
||||||
|
In `src/style.css`, remove the `.book-list-page` block and remove `.book-list-create input`, `.book-list-item input`, `.book-list-create button`, and `.book-list-item button` from the global book-list selectors. Keep the `.dialog input` rule and keep the book-list layout rules such as `.book-list`, `.book-list-item`, `.book-list-name`, and `.book-list-meta`.
|
||||||
|
|
||||||
|
- [ ] **Step 6: Update AdminPage template classes**
|
||||||
|
|
||||||
In `src/components/AdminPage.vue`:
|
In `src/components/AdminPage.vue`:
|
||||||
|
|
||||||
@@ -372,7 +381,7 @@ In `src/components/AdminPage.vue`:
|
|||||||
- Add `data-testid="delete-user-u1"` pattern by rendering ``:data-testid="`delete-user-${u.id}`"`` on each delete button.
|
- Add `data-testid="delete-user-u1"` pattern by rendering ``:data-testid="`delete-user-${u.id}`"`` on each delete button.
|
||||||
- Add `class="ui-button ui-button--danger"` to each delete button.
|
- Add `class="ui-button ui-button--danger"` to each delete button.
|
||||||
|
|
||||||
- [ ] **Step 6: Replace AdminPage scoped styles**
|
- [ ] **Step 7: Replace AdminPage scoped styles**
|
||||||
|
|
||||||
Replace the scoped style block in `src/components/AdminPage.vue` with:
|
Replace the scoped style block in `src/components/AdminPage.vue` with:
|
||||||
|
|
||||||
@@ -402,7 +411,7 @@ Replace the scoped style block in `src/components/AdminPage.vue` with:
|
|||||||
</style>
|
</style>
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 7: Run focused tests**
|
- [ ] **Step 8: Run focused tests**
|
||||||
|
|
||||||
Run:
|
Run:
|
||||||
|
|
||||||
|
|||||||
40
src/components/AdminPage.test.ts
Normal file
40
src/components/AdminPage.test.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import { flushPromises, mount } from '@vue/test-utils'
|
||||||
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||||
|
import AdminPage from './AdminPage.vue'
|
||||||
|
|
||||||
|
const { authedFetch, logout } = vi.hoisted(() => ({
|
||||||
|
authedFetch: vi.fn(),
|
||||||
|
logout: vi.fn(),
|
||||||
|
}))
|
||||||
|
|
||||||
|
vi.mock('../composables/useAuth', () => ({
|
||||||
|
authedFetch: (...args: unknown[]) => authedFetch(...args),
|
||||||
|
useAuth: () => ({ logout }),
|
||||||
|
}))
|
||||||
|
|
||||||
|
describe('AdminPage', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
vi.clearAllMocks()
|
||||||
|
authedFetch.mockResolvedValue([
|
||||||
|
{ id: 'u1', username: 'teacher', role: 'user', createdAt: '2026-01-01T00:00:00.000Z' },
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('uses shared app control classes', async () => {
|
||||||
|
const wrapper = mount(AdminPage)
|
||||||
|
await flushPromises()
|
||||||
|
|
||||||
|
expect(wrapper.get('.admin-page').classes()).toContain('app-page')
|
||||||
|
expect(wrapper.get('header').classes()).toContain('app-page-header')
|
||||||
|
expect(wrapper.get('input[placeholder="用户名"]').classes()).toContain('ui-field')
|
||||||
|
expect(wrapper.get('input[placeholder="密码"]').classes()).toContain('ui-field')
|
||||||
|
expect(wrapper.get('select').classes()).toContain('ui-select')
|
||||||
|
expect(wrapper.get('button[type="submit"]').classes()).toEqual(
|
||||||
|
expect.arrayContaining(['ui-button', 'ui-button--primary']),
|
||||||
|
)
|
||||||
|
expect(wrapper.get('table').classes()).toContain('ui-table')
|
||||||
|
expect(wrapper.get('button[data-testid="delete-user-u1"]').classes()).toEqual(
|
||||||
|
expect.arrayContaining(['ui-button', 'ui-button--danger']),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -63,30 +63,44 @@ onMounted(loadUsers)
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="admin-page">
|
<div class="admin-page app-page">
|
||||||
<header>
|
<header class="app-page-header">
|
||||||
<button @click="emit('back')">← 返回</button>
|
|
||||||
<h1>用户管理</h1>
|
<h1>用户管理</h1>
|
||||||
<button @click="handleLogout">退出登录</button>
|
<div class="app-page-actions">
|
||||||
|
<button class="ui-button" type="button" @click="emit('back')">← 返回</button>
|
||||||
|
<button class="ui-button" type="button" @click="handleLogout">退出登录</button>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="create-user">
|
<section class="create-user">
|
||||||
<h2>新建用户</h2>
|
<h2>新建用户</h2>
|
||||||
<form @submit.prevent="createUser">
|
<form @submit.prevent="createUser">
|
||||||
<input v-model="newUsername" placeholder="用户名" :disabled="loading" />
|
<input v-model="newUsername" class="ui-field" placeholder="用户名" :disabled="loading" />
|
||||||
<input v-model="newPassword" type="password" placeholder="密码" :disabled="loading" />
|
<input
|
||||||
<select v-model="newRole" :disabled="loading">
|
v-model="newPassword"
|
||||||
|
class="ui-field"
|
||||||
|
type="password"
|
||||||
|
placeholder="密码"
|
||||||
|
:disabled="loading"
|
||||||
|
/>
|
||||||
|
<select v-model="newRole" class="ui-select" :disabled="loading">
|
||||||
<option value="user">普通用户</option>
|
<option value="user">普通用户</option>
|
||||||
<option value="admin">管理员</option>
|
<option value="admin">管理员</option>
|
||||||
</select>
|
</select>
|
||||||
<button type="submit" :disabled="loading || !newUsername || !newPassword">创建</button>
|
<button
|
||||||
|
class="ui-button ui-button--primary"
|
||||||
|
type="submit"
|
||||||
|
:disabled="loading || !newUsername || !newPassword"
|
||||||
|
>
|
||||||
|
创建
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<p v-if="error" class="error">{{ error }}</p>
|
<p v-if="error" class="ui-error">{{ error }}</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="user-list">
|
<section class="user-list">
|
||||||
<h2>所有用户</h2>
|
<h2>所有用户</h2>
|
||||||
<table>
|
<table class="ui-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>用户名</th>
|
<th>用户名</th>
|
||||||
@@ -101,7 +115,14 @@ onMounted(loadUsers)
|
|||||||
<td>{{ u.role === 'admin' ? '管理员' : '普通用户' }}</td>
|
<td>{{ u.role === 'admin' ? '管理员' : '普通用户' }}</td>
|
||||||
<td>{{ new Date(u.createdAt).toLocaleDateString('zh-CN') }}</td>
|
<td>{{ new Date(u.createdAt).toLocaleDateString('zh-CN') }}</td>
|
||||||
<td>
|
<td>
|
||||||
<button @click="removeUser(u.id)">删除</button>
|
<button
|
||||||
|
class="ui-button ui-button--danger"
|
||||||
|
type="button"
|
||||||
|
:data-testid="`delete-user-${u.id}`"
|
||||||
|
@click="removeUser(u.id)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -111,69 +132,25 @@ onMounted(loadUsers)
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.admin-page {
|
.app-page-header h1 {
|
||||||
padding: 1.5rem;
|
|
||||||
max-width: 800px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 1rem;
|
|
||||||
margin-bottom: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
header h1 {
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
margin: 0;
|
}
|
||||||
|
|
||||||
|
.create-user {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.create-user h2,
|
||||||
|
.user-list h2 {
|
||||||
|
margin: 0 0 12px;
|
||||||
|
color: var(--green-700);
|
||||||
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.create-user form {
|
.create-user form {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 0.5rem;
|
gap: 8px;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.create-user input,
|
|
||||||
.create-user select {
|
|
||||||
padding: 0.4rem 0.6rem;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error {
|
|
||||||
color: #c0392b;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
margin-top: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
th, td {
|
|
||||||
text-align: left;
|
|
||||||
padding: 0.5rem;
|
|
||||||
border-bottom: 1px solid #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
th {
|
|
||||||
font-weight: 600;
|
|
||||||
color: #555;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
padding: 0.3rem 0.7rem;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:hover {
|
|
||||||
background: #f5f5f5;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -127,4 +127,23 @@ describe('BookListPage', () => {
|
|||||||
expect(booksApi.deleteBook).not.toHaveBeenCalled()
|
expect(booksApi.deleteBook).not.toHaveBeenCalled()
|
||||||
expect(wrapper.text()).toContain('Web 前端开发')
|
expect(wrapper.text()).toContain('Web 前端开发')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('uses shared app control classes for actions', async () => {
|
||||||
|
vi.mocked(booksApi.listBooks).mockResolvedValue([
|
||||||
|
{ id: 'b1', name: 'Web 前端开发', updatedAt: '2026-01-01T00:00:00.000Z', lessonCount: 0 },
|
||||||
|
])
|
||||||
|
|
||||||
|
const wrapper = mount(BookListPage)
|
||||||
|
await flushPromises()
|
||||||
|
|
||||||
|
expect(wrapper.get('form.book-list-create input').classes()).toContain('ui-field')
|
||||||
|
expect(wrapper.get('form.book-list-create button[type="submit"]').classes()).toEqual(
|
||||||
|
expect.arrayContaining(['ui-button', 'ui-button--primary']),
|
||||||
|
)
|
||||||
|
expect(wrapper.get('button[data-testid="open-b1"]').classes()).toContain('ui-button')
|
||||||
|
expect(wrapper.get('button[data-testid="rename-b1"]').classes()).toContain('ui-button')
|
||||||
|
expect(wrapper.get('button[data-testid="delete-b1"]').classes()).toEqual(
|
||||||
|
expect.arrayContaining(['ui-button', 'ui-button--danger']),
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -103,18 +103,26 @@ async function removeBook(book: BookSummary): Promise<void> {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="book-list-page">
|
<div class="book-list-page app-page">
|
||||||
<div class="page-header">
|
<div class="app-page-header">
|
||||||
<h1>教学设计</h1>
|
<h1>教学设计</h1>
|
||||||
<div class="header-actions">
|
<div class="app-page-actions">
|
||||||
<button v-if="user?.role === 'admin'" type="button" @click="emit('admin')">用户管理</button>
|
<button v-if="user?.role === 'admin'" class="ui-button" type="button" @click="emit('admin')">
|
||||||
<button type="button" @click="logout">退出登录</button>
|
用户管理
|
||||||
|
</button>
|
||||||
|
<button class="ui-button" type="button" @click="logout">退出登录</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form class="book-list-create" @submit.prevent="createBook">
|
<form class="book-list-create" @submit.prevent="createBook">
|
||||||
<input v-model="newBookName" type="text" placeholder="新整本名称" aria-label="新整本名称" />
|
<input
|
||||||
<button type="submit">新建整本</button>
|
v-model="newBookName"
|
||||||
|
class="ui-field"
|
||||||
|
type="text"
|
||||||
|
placeholder="新整本名称"
|
||||||
|
aria-label="新整本名称"
|
||||||
|
/>
|
||||||
|
<button class="ui-button ui-button--primary" type="submit">新建整本</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<p v-if="actionError" class="app-notice app-notice--error" role="alert">
|
<p v-if="actionError" class="app-notice app-notice--error" role="alert">
|
||||||
@@ -135,37 +143,37 @@ async function removeBook(book: BookSummary): Promise<void> {
|
|||||||
<ul v-else class="book-list">
|
<ul v-else class="book-list">
|
||||||
<li v-for="book in books" :key="book.id" class="book-list-item">
|
<li v-for="book in books" :key="book.id" class="book-list-item">
|
||||||
<template v-if="renamingId === book.id">
|
<template v-if="renamingId === book.id">
|
||||||
<input v-model="renameValue" type="text" aria-label="整本名称" />
|
<input v-model="renameValue" class="ui-field" type="text" aria-label="整本名称" />
|
||||||
<button type="button" :data-testid="`confirm-rename-${book.id}`" @click="confirmRename">保存</button>
|
<button
|
||||||
<button type="button" @click="cancelRename">取消</button>
|
class="ui-button"
|
||||||
|
type="button"
|
||||||
|
:data-testid="`confirm-rename-${book.id}`"
|
||||||
|
@click="confirmRename"
|
||||||
|
>
|
||||||
|
保存
|
||||||
|
</button>
|
||||||
|
<button class="ui-button" type="button" @click="cancelRename">取消</button>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<span class="book-list-name">{{ book.name }}</span>
|
<span class="book-list-name">{{ book.name }}</span>
|
||||||
<span class="book-list-meta">更新于 {{ formatCstUpdatedAt(book.updatedAt) }} · {{ book.lessonCount }} 课</span>
|
<span class="book-list-meta">更新于 {{ formatCstUpdatedAt(book.updatedAt) }} · {{ book.lessonCount }} 课</span>
|
||||||
<button type="button" :data-testid="`open-${book.id}`" @click="emit('open', book.id)">打开</button>
|
<button class="ui-button" type="button" :data-testid="`open-${book.id}`" @click="emit('open', book.id)">
|
||||||
<button type="button" :data-testid="`rename-${book.id}`" @click="startRename(book)">重命名</button>
|
打开
|
||||||
<button type="button" :data-testid="`delete-${book.id}`" @click="removeBook(book)">删除</button>
|
</button>
|
||||||
|
<button class="ui-button" type="button" :data-testid="`rename-${book.id}`" @click="startRename(book)">
|
||||||
|
重命名
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="ui-button ui-button--danger"
|
||||||
|
type="button"
|
||||||
|
:data-testid="`delete-${book.id}`"
|
||||||
|
@click="removeBook(book)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</button>
|
||||||
</template>
|
</template>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.page-header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-header h1 {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-actions {
|
|
||||||
display: flex;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
23
src/components/LoginPage.test.ts
Normal file
23
src/components/LoginPage.test.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { mount } from '@vue/test-utils'
|
||||||
|
import { describe, expect, it, vi } from 'vitest'
|
||||||
|
import LoginPage from './LoginPage.vue'
|
||||||
|
|
||||||
|
const { login } = vi.hoisted(() => ({
|
||||||
|
login: vi.fn(),
|
||||||
|
}))
|
||||||
|
|
||||||
|
vi.mock('../composables/useAuth', () => ({
|
||||||
|
useAuth: () => ({ login }),
|
||||||
|
}))
|
||||||
|
|
||||||
|
describe('LoginPage', () => {
|
||||||
|
it('uses shared form field and primary button classes', () => {
|
||||||
|
const wrapper = mount(LoginPage)
|
||||||
|
|
||||||
|
expect(wrapper.get('#username').classes()).toContain('ui-field')
|
||||||
|
expect(wrapper.get('#password').classes()).toContain('ui-field')
|
||||||
|
expect(wrapper.get('button[type="submit"]').classes()).toEqual(
|
||||||
|
expect.arrayContaining(['ui-button', 'ui-button--primary']),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -33,6 +33,7 @@ async function handleSubmit(): Promise<void> {
|
|||||||
<label for="username">用户名</label>
|
<label for="username">用户名</label>
|
||||||
<input
|
<input
|
||||||
id="username"
|
id="username"
|
||||||
|
class="ui-field"
|
||||||
v-model="username"
|
v-model="username"
|
||||||
type="text"
|
type="text"
|
||||||
autocomplete="username"
|
autocomplete="username"
|
||||||
@@ -43,14 +44,19 @@ async function handleSubmit(): Promise<void> {
|
|||||||
<label for="password">密码</label>
|
<label for="password">密码</label>
|
||||||
<input
|
<input
|
||||||
id="password"
|
id="password"
|
||||||
|
class="ui-field"
|
||||||
v-model="password"
|
v-model="password"
|
||||||
type="password"
|
type="password"
|
||||||
autocomplete="current-password"
|
autocomplete="current-password"
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<p v-if="error" class="error">{{ error }}</p>
|
<p v-if="error" class="ui-error">{{ error }}</p>
|
||||||
<button type="submit" :disabled="loading || !username || !password">
|
<button
|
||||||
|
class="ui-button ui-button--primary"
|
||||||
|
type="submit"
|
||||||
|
:disabled="loading || !username || !password"
|
||||||
|
>
|
||||||
{{ loading ? '登录中…' : '登录' }}
|
{{ loading ? '登录中…' : '登录' }}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -63,66 +69,37 @@ async function handleSubmit(): Promise<void> {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: #f5f5f5;
|
background: #edf0f2;
|
||||||
|
padding: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-form {
|
.login-form {
|
||||||
background: white;
|
width: min(100%, 340px);
|
||||||
padding: 2rem;
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
||||||
width: 320px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1rem;
|
gap: 16px;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 18px rgba(32, 42, 51, 0.12);
|
||||||
|
padding: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-form h1 {
|
.login-form h1 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 1.5rem;
|
color: var(--green-700);
|
||||||
|
font-size: 24px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.field {
|
.field {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.25rem;
|
gap: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.field label {
|
.field label {
|
||||||
font-size: 0.875rem;
|
color: var(--muted);
|
||||||
color: #555;
|
font-size: 14px;
|
||||||
}
|
|
||||||
|
|
||||||
.field input {
|
|
||||||
padding: 0.5rem;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field input:disabled {
|
|
||||||
background: #f5f5f5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error {
|
|
||||||
color: #c0392b;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
button[type='submit'] {
|
|
||||||
padding: 0.6rem;
|
|
||||||
background: #2c3e50;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-size: 1rem;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
button[type='submit']:disabled {
|
|
||||||
opacity: 0.5;
|
|
||||||
cursor: not-allowed;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
145
src/style.css
145
src/style.css
@@ -38,6 +38,130 @@ input {
|
|||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Shared app controls */
|
||||||
|
.app-page {
|
||||||
|
max-width: 880px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 32px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-page-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-page-header h1 {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--green-700);
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-page-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-button {
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 6px 14px;
|
||||||
|
color: var(--green-700);
|
||||||
|
cursor: pointer;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-button:hover:not(:disabled) {
|
||||||
|
background: var(--green-100);
|
||||||
|
border-color: var(--green-600);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-button:disabled {
|
||||||
|
color: var(--muted);
|
||||||
|
border-color: var(--line);
|
||||||
|
cursor: not-allowed;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-button--primary {
|
||||||
|
border-color: var(--green-600);
|
||||||
|
background: var(--green-600);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-button--primary:hover:not(:disabled) {
|
||||||
|
background: var(--green-700);
|
||||||
|
border-color: var(--green-700);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-button--danger {
|
||||||
|
color: #c0392b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-button--danger:hover:not(:disabled) {
|
||||||
|
background: #fdecea;
|
||||||
|
border-color: #c0392b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-field,
|
||||||
|
.ui-select {
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
background: #fff;
|
||||||
|
color: #202a33;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-field:focus,
|
||||||
|
.ui-select:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: var(--green-600);
|
||||||
|
box-shadow: 0 0 0 2px rgba(45, 122, 88, 0.16);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-field:disabled,
|
||||||
|
.ui-select:disabled {
|
||||||
|
background: #f4f6f7;
|
||||||
|
color: var(--muted);
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin-top: 8px;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-table th,
|
||||||
|
.ui-table td {
|
||||||
|
text-align: left;
|
||||||
|
padding: 8px 10px;
|
||||||
|
border-bottom: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-table th {
|
||||||
|
background: var(--green-100);
|
||||||
|
color: var(--green-700);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-table tr:last-child td {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-error {
|
||||||
|
color: #c0392b;
|
||||||
|
font-size: 14px;
|
||||||
|
margin: 8px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Toolbar */
|
/* Toolbar */
|
||||||
.workspace-toolbar {
|
.workspace-toolbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -592,38 +716,19 @@ table {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Book list */
|
/* Book list */
|
||||||
.book-list-page {
|
|
||||||
max-width: 720px;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 32px 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.book-list-create {
|
.book-list-create {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog input,
|
.dialog input {
|
||||||
.book-list-create input,
|
|
||||||
.book-list-item input {
|
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
border: 1px solid var(--line);
|
border: 1px solid var(--line);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
padding: 8px 12px;
|
padding: 8px 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.book-list-create button,
|
|
||||||
.book-list-item button {
|
|
||||||
border: 1px solid var(--line);
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 6px 14px;
|
|
||||||
color: var(--green-700);
|
|
||||||
cursor: pointer;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.book-list {
|
.book-list {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user