feat(device-tab): 智能设备页头部切换为绿色渐变
Navbar 新增 variant: 'default' | 'hero' 可选 prop,默认 default 保持现有白底黑字。hero 模式背景为深绿到亮绿垂直渐变,标题白色。智能设备 tab 引用 hero 复刻设计参考图视觉;其余页面 Navbar 调用点不动。
This commit is contained in:
parent
1250a54076
commit
36aa262834
|
|
@ -57,3 +57,14 @@
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// hero 变体:智能设备 tab 等需要绿色品牌头部的页面使用
|
||||||
|
// 垂直渐变贴近设计参考图:顶部深绿、底部亮绿;局部样式不引入新 token
|
||||||
|
.navbarHero {
|
||||||
|
background: linear-gradient(180deg, #0da89b 0%, #2ccb98 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
// hero 模式下标题反白,避免与渐变背景对比度不足
|
||||||
|
.titleHero {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ interface Props {
|
||||||
autoBack?: boolean // 默认 true(修复 uni-app up-navbar 坑)
|
autoBack?: boolean // 默认 true(修复 uni-app up-navbar 坑)
|
||||||
border?: boolean // 默认 false
|
border?: boolean // 默认 false
|
||||||
safeAreaTop?: boolean // 默认 true
|
safeAreaTop?: boolean // 默认 true
|
||||||
|
variant?: 'default' | 'hero' // hero 为绿色渐变头部,default 为白底黑字
|
||||||
onBack?: () => void
|
onBack?: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -18,6 +19,7 @@ export function Navbar({
|
||||||
autoBack = true,
|
autoBack = true,
|
||||||
border = false,
|
border = false,
|
||||||
safeAreaTop = true,
|
safeAreaTop = true,
|
||||||
|
variant = 'default',
|
||||||
onBack
|
onBack
|
||||||
}: Props) {
|
}: Props) {
|
||||||
// getSystemInfoSync 已废弃,改用 getWindowInfo
|
// getSystemInfoSync 已废弃,改用 getWindowInfo
|
||||||
|
|
@ -30,7 +32,7 @@ export function Navbar({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
className={styles.navbar}
|
className={`${styles.navbar} ${variant === 'hero' ? styles.navbarHero : ''}`}
|
||||||
style={{
|
style={{
|
||||||
paddingTop: safeAreaTop ? `${statusBarHeight}px` : 0,
|
paddingTop: safeAreaTop ? `${statusBarHeight}px` : 0,
|
||||||
position: fixed ? 'fixed' : 'relative',
|
position: fixed ? 'fixed' : 'relative',
|
||||||
|
|
@ -44,7 +46,7 @@ export function Navbar({
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
<View className={styles.titleWrap}>
|
<View className={styles.titleWrap}>
|
||||||
<Text className={styles.title}>{title}</Text>
|
<Text className={`${styles.title} ${variant === 'hero' ? styles.titleHero : ''}`}>{title}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ export default function DeviceList() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.page}>
|
<View className={styles.page}>
|
||||||
<Navbar title="智能设备" autoBack={false} />
|
<Navbar title="智能设备" autoBack={false} variant="hero" />
|
||||||
|
|
||||||
<View className={styles.siteRow} onClick={goSceneSelect}>
|
<View className={styles.siteRow} onClick={goSceneSelect}>
|
||||||
<Text className={styles.siteText}>{scene?.name || '请选择场所'}</Text>
|
<Text className={styles.siteText}>{scene?.name || '请选择场所'}</Text>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue