mirror of
https://github.com/yuruotong1/autoMate.git
synced 2025-12-26 05:16:21 +08:00
✨ ui(autoMate):Content页面添加自动获取焦点功能及文本框placeholder提示
📝 ui(autoMate):ContentListAction页面重构,添加逻辑处理并重定向 🔧 ui(autoMate):ContentList样式表调整,修改链接边距及样式 ♻️ ui(autoMate):ContentList页面重构,修改NavLink类名及布局样式
This commit is contained in:
parent
08b33ca439
commit
65ea1214d4
@ -6,10 +6,10 @@ export const Content = () => {
|
||||
return (
|
||||
<Form method="PUT">
|
||||
<main className="content-page" key={content.id}>
|
||||
<input defaultValue={content.title} name="title" onChange={(e) => {
|
||||
<input autoFocus defaultValue={content.title} name="title" onChange={(e) => {
|
||||
submit(e.target.form)
|
||||
}}/>
|
||||
<textarea defaultValue={content.content} name="content" onChange={(e) => {
|
||||
<textarea placeholder="请输入内容..." defaultValue={content.content} name="content" onChange={(e) => {
|
||||
submit(e.target.form)
|
||||
}}/>
|
||||
</main>
|
||||
|
||||
@ -1,12 +1,15 @@
|
||||
import { redirect } from "react-router-dom"
|
||||
|
||||
export default async ({request, params}) => {
|
||||
const formData = await request.formData()
|
||||
const cid = params.cid || 0
|
||||
switch(formData.get("action")){
|
||||
case "add":
|
||||
await window.api.sql(
|
||||
case "add": {
|
||||
const id = await window.api.sql(
|
||||
`insert into contents (title, content, category_id, created_at) values ('未命名', '', ${cid}, datetime())`,
|
||||
"create")
|
||||
break
|
||||
return redirect(`content/${id}`)
|
||||
}
|
||||
}
|
||||
|
||||
return {}
|
||||
|
||||
@ -6,10 +6,10 @@
|
||||
@apply border-r overflow-y-auto;
|
||||
grid-area: list;
|
||||
a {
|
||||
@apply truncate py-1 px-1 cursor-pointer flex items-center gap-1 border-b mx-2;
|
||||
|
||||
@apply truncate py-1 px-1 cursor-pointer flex items-center gap-1 border-b mx-2 my-1;
|
||||
&.active{
|
||||
// mx-1 外边距
|
||||
@apply bg-blue-700 text-white mx-1 rounded-md;
|
||||
@apply bg-blue-700 text-white rounded-md;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ export const ContentList = () => {
|
||||
<NavLink
|
||||
key={content.id}
|
||||
to={`/config/category/contentList/${content.category_id}/content/${content.id}`}
|
||||
className={({ isActive }) => `${isActive ? "active" : ""}`}>
|
||||
className="flex justify-between items-center">
|
||||
<div className="truncate">{content.title}</div>
|
||||
<div className="text-[10px] opacity-80 ">{dayjs(content.created_at).format("YYYY/MM/DD")}</div>
|
||||
</NavLink>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user