mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-21 16:01:32 +00:00
fix(frontend): polish modal and responsive styles
This commit is contained in:
@@ -55,12 +55,13 @@ const inputClasses = computed(() => [
|
||||
|
||||
<template>
|
||||
<label class="grid box-content gap-2 overflow-visible p-0.75">
|
||||
<span :class="containerClasses">
|
||||
<span class="base-input__control" :class="containerClasses">
|
||||
<span v-if="$slots.prefix" :class="iconClasses">
|
||||
<slot name="prefix" />
|
||||
</span>
|
||||
<input
|
||||
v-model="model"
|
||||
class="base-input__field"
|
||||
:class="inputClasses"
|
||||
:placeholder="placeholder"
|
||||
:type="type"
|
||||
@@ -77,3 +78,27 @@ const inputClasses = computed(() => [
|
||||
}}</span>
|
||||
</label>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.base-input__control {
|
||||
--base-input-autofill-bg: var(--cp-input-current-bg, var(--cp-input-context-bg));
|
||||
}
|
||||
|
||||
.base-input__control:hover {
|
||||
--base-input-autofill-bg: var(--cp-input-current-bg-hover, var(--cp-input-context-bg-hover));
|
||||
}
|
||||
|
||||
.base-input__control:focus-within {
|
||||
--base-input-autofill-bg: var(--cp-input-soft-bg-focus);
|
||||
}
|
||||
|
||||
.base-input__field:-webkit-autofill,
|
||||
.base-input__field:-webkit-autofill:hover,
|
||||
.base-input__field:-webkit-autofill:focus,
|
||||
.base-input__field:autofill {
|
||||
caret-color: var(--cp-text-primary);
|
||||
-webkit-text-fill-color: var(--cp-text-primary) !important;
|
||||
-webkit-box-shadow: 0 0 0 1000px var(--base-input-autofill-bg) inset !important;
|
||||
box-shadow: 0 0 0 1000px var(--base-input-autofill-bg) inset !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -14,7 +14,6 @@ const props = defineProps<{
|
||||
width?: string | number
|
||||
variant?: ModalVariant
|
||||
closeDisabled?: boolean
|
||||
scrollable?: boolean
|
||||
bodyMaxHeight?: string
|
||||
bodyViewClass?: string
|
||||
hideFooter?: boolean
|
||||
@@ -45,11 +44,12 @@ const modalStyle = computed(() => {
|
||||
}
|
||||
})
|
||||
const bodyClass = computed(() => [
|
||||
'min-h-0 flex-1 overflow-x-hidden p-4 sm:p-7',
|
||||
props.scrollable ? 'overflow-hidden' : 'overflow-y-auto overscroll-contain',
|
||||
'min-h-0 overflow-hidden p-4 sm:p-7',
|
||||
props.description || variant.value !== 'default' ? 'pt-4 sm:pt-5' : 'pt-4 sm:pt-6',
|
||||
])
|
||||
const scrollViewClass = computed(() => ['pr-4', props.bodyViewClass].filter(Boolean).join(' '))
|
||||
const scrollViewClass = computed(() =>
|
||||
['pr-3 sm:pr-4', props.bodyViewClass].filter(Boolean).join(' '),
|
||||
)
|
||||
|
||||
const iconMap = {
|
||||
default: Info,
|
||||
@@ -177,7 +177,7 @@ onBeforeUnmount(() => {
|
||||
<div class="absolute inset-0 bg-(--cp-overlay-scrim)" @click="closeModal" />
|
||||
<section
|
||||
ref="panel"
|
||||
class="cp-modal-panel [--cp-input-current-bg:var(--cp-input-soft-bg)] [--cp-input-current-bg-hover:var(--cp-input-soft-bg-hover)] relative flex max-h-[calc(100dvh-1.5rem)] min-w-0 flex-col overflow-hidden rounded-(--cp-card-radius) bg-(--cp-bg-surface) shadow-(--cp-shadow-popover) sm:max-h-[calc(100dvh-3rem)]"
|
||||
class="cp-modal-panel [--cp-input-current-bg:var(--cp-input-soft-bg)] [--cp-input-current-bg-hover:var(--cp-input-soft-bg-hover)] relative grid max-h-[calc(100dvh-1.5rem)] min-w-0 grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden rounded-(--cp-card-radius) bg-(--cp-bg-surface) shadow-(--cp-shadow-popover) sm:max-h-[calc(100dvh-3rem)]"
|
||||
:style="modalStyle"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
@@ -219,14 +219,12 @@ onBeforeUnmount(() => {
|
||||
</header>
|
||||
<div :class="bodyClass">
|
||||
<BaseScrollbar
|
||||
v-if="scrollable"
|
||||
class="h-full sm:-mr-4"
|
||||
class="h-full -mr-3 sm:-mr-4"
|
||||
:max-height="bodyMaxHeight"
|
||||
:view-class="scrollViewClass"
|
||||
>
|
||||
<slot />
|
||||
</BaseScrollbar>
|
||||
<slot v-else />
|
||||
</div>
|
||||
<footer
|
||||
v-if="!hideFooter"
|
||||
|
||||
@@ -338,7 +338,7 @@ watch(
|
||||
>
|
||||
<span
|
||||
v-if="!isCollapsed"
|
||||
class="inline-flex h-7 items-center gap-1.5 rounded-lg bg-(--cp-success-bg) px-2.5 text-xs leading-none font-[650] text-(--cp-success-text)"
|
||||
class="inline-flex whitespace-nowrap h-7 items-center gap-1.5 rounded-lg bg-(--cp-success-bg) px-2.5 text-xs leading-none font-[650] text-(--cp-success-text)"
|
||||
>
|
||||
<i class="size-1.5 rounded-full bg-(--cp-success)" />
|
||||
在线
|
||||
|
||||
@@ -309,7 +309,6 @@ onUnmounted(() => {
|
||||
title="系统更新"
|
||||
variant="success"
|
||||
width="820px"
|
||||
scrollable
|
||||
body-max-height="72dvh"
|
||||
body-view-class="pr-3"
|
||||
:close-disabled="updating || restarting"
|
||||
|
||||
@@ -60,15 +60,19 @@ const valueToneClasses: Record<string, string> = {
|
||||
class="col-start-3 text-[13px] leading-[1.15] font-[650] text-(--cp-text-primary)"
|
||||
>{{ item.label }}</strong
|
||||
>
|
||||
<span
|
||||
class="col-start-4 text-[13px] leading-[1.15] font-bold"
|
||||
:class="valueToneClasses[item.tone]"
|
||||
>{{ item.value }}</span
|
||||
>
|
||||
<span
|
||||
class="col-start-5 text-right font-mono text-xs leading-[1.15] font-semibold text-(--cp-text-secondary)"
|
||||
>{{ item.detail }}</span
|
||||
<div
|
||||
class="col-start-4 col-span-2 grid min-w-0 grid-cols-1 justify-items-end gap-1.5 sm:grid-cols-[minmax(0,1.08fr)_minmax(72px,0.92fr)] sm:items-center sm:justify-items-stretch sm:gap-0"
|
||||
>
|
||||
<span
|
||||
class="max-w-full min-w-0 wrap-break-word text-right text-[13px] leading-[1.15] font-bold sm:text-left"
|
||||
:class="valueToneClasses[item.tone]"
|
||||
>{{ item.value }}</span
|
||||
>
|
||||
<span
|
||||
class="text-right font-mono text-xs leading-[1.15] font-semibold text-(--cp-text-secondary)"
|
||||
>{{ item.detail }}</span
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -178,6 +178,9 @@ function togglePasswordVisible(): void {
|
||||
--cp-disabled-bg: var(--login-disabled-bg);
|
||||
--cp-disabled-text: var(--login-disabled-text);
|
||||
--cp-disabled-icon: var(--login-disabled-text);
|
||||
--cp-input-current-bg: var(--login-input-bg);
|
||||
--cp-input-current-bg-hover: var(--login-input-bg-hover);
|
||||
--cp-input-soft-bg-focus: var(--login-input-focus);
|
||||
--cp-button-radius-base: 6px;
|
||||
--cp-icon-button-radius: 6px;
|
||||
--cp-shadow-control: none;
|
||||
|
||||
@@ -50,7 +50,6 @@ function latencyDisplay(value: unknown) {
|
||||
description="状态码、失败分类与诊断信息"
|
||||
variant="danger"
|
||||
width="920px"
|
||||
scrollable
|
||||
body-max-height="min(76dvh,760px)"
|
||||
>
|
||||
<template v-if="record">
|
||||
|
||||
@@ -214,7 +214,6 @@ function themeColor(name: string, fallback: string) {
|
||||
description="单次请求的完整链路信息"
|
||||
variant="info"
|
||||
width="960px"
|
||||
scrollable
|
||||
body-max-height="min(76dvh,820px)"
|
||||
body-view-class="grid gap-3"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user