feat: 立志/改过卡片增加编辑模式切换按钮
This commit is contained in:
@@ -388,6 +388,14 @@
|
||||
addEveningRow('', '');
|
||||
};
|
||||
|
||||
/* 切换卡片编辑模式 */
|
||||
window.toggleEditMode = function(btn) {
|
||||
var card = btn.closest('.card');
|
||||
if (!card) return;
|
||||
var editing = card.classList.toggle('editing');
|
||||
btn.classList.toggle('active', editing);
|
||||
};
|
||||
|
||||
/* ================================================================
|
||||
Load & Auto Save Checkin
|
||||
================================================================ */
|
||||
|
||||
@@ -492,16 +492,57 @@ body {
|
||||
.card-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.card-head-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.card-head h3 {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
/* ── 编辑模式切换按钮 ── */
|
||||
|
||||
.btn-edit-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--text-muted);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.btn-edit-toggle:hover {
|
||||
background: var(--bg);
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.btn-edit-toggle.active {
|
||||
background: var(--primary-light);
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
/* 编辑模式下才显示的元素 */
|
||||
.edit-only { display: none; }
|
||||
.card.editing .edit-only { display: flex; }
|
||||
.card.editing .btn-del { display: inline-flex; }
|
||||
|
||||
/* 默认隐藏删除按钮 */
|
||||
.btn-del { display: none; }
|
||||
|
||||
.icon-h2 {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
@@ -568,7 +609,6 @@ body {
|
||||
line-height: 1;
|
||||
border-radius: 6px;
|
||||
transition: background 0.2s;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,4 +63,8 @@
|
||||
<symbol id="icon-chevron-right" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M8.25 4.5l7.5 7.5-7.5 7.5"/>
|
||||
</symbol>
|
||||
<!-- 铅笔 -->
|
||||
<symbol id="icon-pencil" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125"/>
|
||||
</symbol>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.7 KiB |
@@ -104,23 +104,33 @@
|
||||
<div class="daily-grid">
|
||||
<div class="card card-morning">
|
||||
<div class="card-head">
|
||||
<svg class="icon-h2"><use href="#icon-sun"/></svg>
|
||||
<h3>早间立志</h3>
|
||||
<div class="card-head-left">
|
||||
<svg class="icon-h2"><use href="#icon-sun"/></svg>
|
||||
<h3>早间立志</h3>
|
||||
</div>
|
||||
<button class="btn-edit-toggle" onclick="toggleEditMode(this)" title="编辑">
|
||||
<svg class="icon-sm"><use href="#icon-pencil"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<p class="card-desc">今天最重要的 1~3 件事</p>
|
||||
<div id="morning-list"></div>
|
||||
<button class="btn-add" onclick="addMorning()">
|
||||
<button class="btn-add edit-only" onclick="addMorning()">
|
||||
<svg class="icon-sm"><use href="#icon-plus"/></svg> 增加一条
|
||||
</button>
|
||||
</div>
|
||||
<div class="card card-evening">
|
||||
<div class="card-head">
|
||||
<svg class="icon-h2"><use href="#icon-magnifying-glass"/></svg>
|
||||
<h3>责善 · 改过</h3>
|
||||
<div class="card-head-left">
|
||||
<svg class="icon-h2"><use href="#icon-magnifying-glass"/></svg>
|
||||
<h3>责善 · 改过</h3>
|
||||
</div>
|
||||
<button class="btn-edit-toggle" onclick="toggleEditMode(this)" title="编辑">
|
||||
<svg class="icon-sm"><use href="#icon-pencil"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<p class="card-desc">今天犯的错 & 改进方案(最多5条)</p>
|
||||
<div id="evening-list"></div>
|
||||
<button class="btn-add" onclick="addEvening()">
|
||||
<button class="btn-add edit-only" onclick="addEvening()">
|
||||
<svg class="icon-sm"><use href="#icon-plus"/></svg> 增加一条
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user