新增 ledger.css 设计令牌与桌面端布局,AppRail 左导航、PageHead 桌面页头、ResultsColumn 常驻结果栏;做菜/菜谱/发现/我的/设置/帮助/关于各页做桌面窄屏双形态适配,窄屏仍走原有底部标签栏与弹层交互。
108 lines
2.6 KiB
Vue
108 lines
2.6 KiB
Vue
<script lang="ts" setup>
|
|
/**
|
|
* 食材 / 厨具选择按钮:未选中是中性灰底,选中后填充主色并显示勾
|
|
*/
|
|
defineProps<{
|
|
label: string
|
|
selected: boolean
|
|
emoji?: string
|
|
icon?: string
|
|
}>()
|
|
</script>
|
|
|
|
<template>
|
|
<button type="button" class="ingredient-chip" :aria-pressed="selected">
|
|
<ion-icon v-if="selected" class="ingredient-chip-mark" :icon="ioniconsCheckmark" aria-hidden="true" />
|
|
<span v-else-if="emoji" class="ingredient-chip-mark" aria-hidden="true">{{ emoji }}</span>
|
|
<span v-else-if="icon" class="ingredient-chip-mark" :class="icon" aria-hidden="true" />
|
|
<span>{{ label }}</span>
|
|
</button>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.ingredient-chip {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 5px;
|
|
min-height: 34px;
|
|
padding: 0 12px;
|
|
border-radius: 17px;
|
|
background: var(--cook-fill);
|
|
color: var(--ion-text-color, #000);
|
|
font-size: 15px;
|
|
line-height: 1;
|
|
transition:
|
|
transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
|
|
background-color 0.2s ease,
|
|
color 0.2s ease;
|
|
-webkit-user-select: none;
|
|
user-select: none;
|
|
}
|
|
.ingredient-chip:active {
|
|
transform: scale(0.94);
|
|
}
|
|
.ingredient-chip[aria-pressed='true'] {
|
|
background: var(--ion-color-primary);
|
|
color: var(--ion-color-primary-contrast);
|
|
font-weight: 500;
|
|
animation: ingredient-chip-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
}
|
|
.ingredient-chip-mark {
|
|
display: inline-flex;
|
|
font-size: 15px;
|
|
}
|
|
.ingredient-chip:focus-visible {
|
|
outline: 2px solid var(--ion-color-primary);
|
|
outline-offset: 2px;
|
|
}
|
|
@keyframes ingredient-chip-pop {
|
|
0% {
|
|
transform: scale(0.92);
|
|
}
|
|
60% {
|
|
transform: scale(1.05);
|
|
}
|
|
100% {
|
|
transform: scale(1);
|
|
}
|
|
}
|
|
|
|
@media (min-width: 1024px) {
|
|
/* 桌面端用原型的白底描边 chip */
|
|
.ingredient-chip {
|
|
min-height: 38px;
|
|
padding: 0 14px;
|
|
border: 1px solid var(--ledger-border);
|
|
border-radius: var(--ledger-r-pill);
|
|
background: var(--ledger-surface);
|
|
color: var(--ledger-text);
|
|
font: 400 var(--ledger-t-15) / 1 var(--ledger-font-body);
|
|
}
|
|
.ingredient-chip:hover {
|
|
border-color: var(--ledger-border-strong);
|
|
}
|
|
.ingredient-chip[aria-pressed='true'] {
|
|
border-color: var(--ledger-primary);
|
|
background: var(--ledger-primary);
|
|
color: #fff;
|
|
font-weight: 500;
|
|
}
|
|
.ingredient-chip:focus-visible {
|
|
outline: 2px solid var(--ledger-primary);
|
|
outline-offset: 2px;
|
|
}
|
|
}
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.ingredient-chip {
|
|
transition: none;
|
|
}
|
|
.ingredient-chip:active {
|
|
transform: none;
|
|
}
|
|
.ingredient-chip[aria-pressed='true'] {
|
|
animation: none;
|
|
}
|
|
}
|
|
</style>
|