feat(web): add reusable admin form dialog

This commit is contained in:
2026-05-09 20:15:35 +08:00
parent c0335bd5d0
commit a5e66e79cd
49 changed files with 6013 additions and 1108 deletions
+330
View File
@@ -0,0 +1,330 @@
.shCard {
overflow: hidden;
border: 1px solid var(--border);
border-radius: 8px;
background: var(--card);
color: var(--card-foreground);
}
.shCardHeader,
.shCardContent,
.shCardFooter {
padding: 16px;
}
.shCardHeader {
display: flex;
min-height: 60px;
align-items: center;
justify-content: space-between;
gap: 12px;
border-bottom: 1px solid #edf1f5;
}
.shCardTitle {
font-size: 16px;
line-height: 1.3;
}
.shCardDescription,
.mutedText {
color: var(--muted-foreground);
font-size: 13px;
}
.shButton {
display: inline-flex;
min-height: 40px;
align-items: center;
justify-content: center;
gap: 8px;
border: 1px solid transparent;
border-radius: 8px;
font-weight: 800;
line-height: 1;
}
.shButtonDefaultSize {
padding: 0 14px;
}
.shButtonSm {
min-height: 34px;
padding: 0 11px;
font-size: 13px;
}
.shButtonIcon {
width: 36px;
min-height: 36px;
padding: 0;
}
.shButtonDefault {
background: var(--primary);
color: var(--primary-foreground);
}
.shButtonSecondary {
background: var(--secondary);
color: var(--secondary-foreground);
}
.shButtonOutline {
border-color: var(--border);
background: #fff;
color: #344054;
}
.shButtonGhost {
background: transparent;
color: #344054;
}
.shButtonDestructive {
background: var(--destructive);
color: #fff;
}
.formDialogBackdrop {
position: fixed;
z-index: 60;
inset: 0;
display: grid;
place-items: center;
padding: 24px;
background: rgba(15, 23, 42, 0.42);
}
.formDialog {
display: grid;
width: min(720px, 100%);
max-height: min(760px, calc(100vh - 48px));
grid-template-rows: auto minmax(0, 1fr);
overflow: hidden;
border: 1px solid var(--border);
border-radius: 10px;
background: #fff;
box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}
.formDialogHeader {
display: flex;
align-items: center;
justify-content: space-between;
gap: 14px;
padding: 18px;
border-bottom: 1px solid var(--border);
}
.formDialogHeader span {
display: block;
color: var(--muted-foreground);
font-size: 12px;
font-weight: 800;
text-transform: uppercase;
}
.formDialogHeader strong {
display: block;
margin-top: 3px;
font-size: 18px;
}
.formDialogForm {
display: grid;
min-height: 0;
grid-template-rows: minmax(0, 1fr) auto;
}
.formDialogBody {
display: grid;
min-height: 0;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
overflow: auto;
padding: 18px;
}
.formDialogActions {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 10px;
padding: 14px 18px;
border-top: 1px solid var(--border);
background: #fff;
box-shadow: 0 -10px 24px rgba(15, 23, 42, 0.06);
}
.shInput,
.shTextarea {
width: 100%;
border: 1px solid var(--input);
border-radius: 8px;
background: #fff;
color: var(--foreground);
outline: none;
}
.shInput {
min-height: 40px;
padding: 0 11px;
}
.shTextarea {
min-height: 96px;
padding: 10px 11px;
resize: vertical;
}
.shInput:focus,
.shTextarea:focus,
.tokenInline input:focus {
border-color: var(--ring);
box-shadow: 0 0 0 3px rgba(47, 128, 193, 0.16);
}
.shLabel,
.formGrid {
display: grid;
gap: 8px;
}
.shLabel {
color: #475467;
font-size: 13px;
font-weight: 800;
}
.formGrid {
gap: 12px;
}
.formGrid.two {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.shTabs {
display: flex;
flex-wrap: wrap;
gap: 6px;
padding: 4px;
border: 1px solid var(--border);
border-radius: 8px;
background: #f8fafc;
}
.shTab {
display: inline-flex;
min-height: 34px;
align-items: center;
gap: 7px;
padding: 0 11px;
border: 0;
border-radius: 7px;
background: transparent;
color: #475467;
font-weight: 800;
}
.shTab[data-active="true"] {
background: #fff;
color: #145388;
box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}
.shBadge {
display: inline-flex;
min-height: 24px;
align-items: center;
width: fit-content;
padding: 0 8px;
border: 1px solid transparent;
border-radius: 999px;
font-size: 12px;
font-weight: 900;
}
.shBadgeDefault { background: #eaf2f8; color: #145388; }
.shBadgeSecondary { background: #eef2f6; color: #475467; }
.shBadgeOutline { border-color: var(--border); background: #fff; color: #344054; }
.shBadgeSuccess { background: #e8f5ef; color: #14805e; }
.shBadgeWarning { background: #fff6df; color: #98690c; }
.shBadgeDestructive { background: #fff1f1; color: #b42318; }
.shTable {
overflow: auto;
}
.shTableRow {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
min-width: 520px;
border-bottom: 1px solid #edf1f5;
}
.shTableHeader {
background: #f8fafc;
}
.shTableHead,
.shTableCell {
overflow: hidden;
min-height: 42px;
padding: 11px 12px;
text-overflow: ellipsis;
white-space: nowrap;
}
.shTableHead {
color: var(--muted-foreground);
font-size: 12px;
font-weight: 900;
}
.shTableCell {
color: #344054;
font-size: 13px;
}
.emptyState {
display: grid;
min-height: 104px;
place-items: center;
gap: 8px;
padding: 18px;
color: var(--muted-foreground);
text-align: center;
}
.modelMeta code,
.secretBox,
.codeBlock,
.taskPreview pre {
overflow: auto;
border: 1px solid var(--border);
border-radius: 8px;
background: #f8fafc;
color: #1f2937;
font-family: "SFMono-Regular", Consolas, monospace;
font-size: 12px;
}
.modelMeta code,
.secretBox {
padding: 8px;
}
.codeBlock,
.taskPreview pre {
margin: 0;
padding: 12px;
line-height: 1.5;
}
@media (max-width: 860px) {
.formDialogBody {
grid-template-columns: 1fr;
}
}