From af630c90c7ed36f1f46a0ad69e470a72fd659aa0 Mon Sep 17 00:00:00 2001
From: running snail <13641039885@163.com>
Date: Tue, 5 Apr 2022 11:24:07 +0800
Subject: [PATCH] refactor(ui/BottomNavigation): docs optimize & code optimize
& add class (#394)
* perf(ui/divider): add class
* refactor(ui/BottomNavigation): code optimize
* docs: unified card level
---
.../BottomNavigationItem.less | 36 ++-
.../BottomNavigationItem.vue | 32 +-
.../src/bottom-navigation-item/provide.ts | 8 +-
.../bottom-navigation/BottomNavigation.vue | 28 +-
.../__snapshots__/index.spec.js.snap | 286 ++++++------------
.../src/bottom-navigation/docs/en-US.md | 48 ++-
.../src/bottom-navigation/docs/zh-CN.md | 49 ++-
.../src/bottom-navigation/example/index.vue | 2 +-
.../src/bottom-navigation/provide.ts | 12 +-
packages/varlet-ui/src/card/docs/en-US.md | 2 +-
.../src/checkbox-group/docs/en-US.md | 16 +-
.../src/checkbox-group/docs/zh-CN.md | 16 +-
.../varlet-ui/src/index-bar/docs/en-US.md | 8 +-
.../varlet-ui/src/index-bar/docs/zh-CN.md | 8 +-
.../varlet-ui/src/radio-group/docs/en-US.md | 18 +-
.../varlet-ui/src/radio-group/docs/zh-CN.md | 18 +-
packages/varlet-ui/src/row/docs/en-US.md | 12 +-
packages/varlet-ui/src/row/docs/zh-CN.md | 12 +-
packages/varlet-ui/src/select/docs/en-US.md | 16 +-
packages/varlet-ui/src/select/docs/zh-CN.md | 16 +-
packages/varlet-ui/src/space/docs/en-US.md | 3 +-
packages/varlet-ui/src/steps/docs/en-US.md | 8 +-
packages/varlet-ui/src/steps/docs/zh-CN.md | 8 +-
packages/varlet-ui/src/tabs/docs/en-US.md | 24 +-
packages/varlet-ui/src/tabs/docs/zh-CN.md | 24 +-
25 files changed, 318 insertions(+), 392 deletions(-)
diff --git a/packages/varlet-ui/src/bottom-navigation-item/BottomNavigationItem.less b/packages/varlet-ui/src/bottom-navigation-item/BottomNavigationItem.less
index dd0cf273db7..0730b2b9b1b 100644
--- a/packages/varlet-ui/src/bottom-navigation-item/BottomNavigationItem.less
+++ b/packages/varlet-ui/src/bottom-navigation-item/BottomNavigationItem.less
@@ -18,22 +18,33 @@
.var-bottom-navigation-item {
height: 100%;
- padding-top: 6px;
+ padding: 6px 12px 8px;
position: relative;
- flex: 1;
- text-align: center;
+ display: inline-flex;
+ flex: 1 1 0%;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
line-height: var(--bottom-navigation-item-line-height);
color: var(--bottom-navigation-item-inactive-color);
- transition: margin 0.25s;
+ cursor: pointer;
+ user-select: none;
+ vertical-align: middle;
+ appearance: none;
+ text-decoration: none;
+ background-color: transparent;
+ outline: 0;
+ border: 0;
+ transition: color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, margin 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
+ padding-top 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
&--active {
- background-color: var(--bottom-navigation-item-active-background-color);
- transition: background-color 0.25s;
color: var(--bottom-navigation-item-active-color);
+ background-color: var(--bottom-navigation-item-active-background-color);
+ transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
- .var-icon,
- .var-bottom-navigation__label {
- transform: scale(1.1);
+ .var-bottom-navigation-item__label {
+ font-size: calc(var(--bottom-navigation-item-font-size) * 1.16);
}
}
@@ -51,18 +62,17 @@
&__icon[var-bottom-navigation-item-cover] {
font-size: var(--bottom-navigation-item-icon-size);
- transition: transform 0.25s;
}
&__badge[var-bottom-navigation-item-cover] {
position: absolute;
- left: -10px;
- transform: translate(20%, -20px);
+ left: 4px;
+ transform: translateY(-22px);
}
&__label {
margin-top: var(--bottom-navigation-item-icon-margin-bottom);
font-size: var(--bottom-navigation-item-font-size);
- transition: transform 0.25s;
+ transition: font-size 0.2s ease 0.1s;
}
}
diff --git a/packages/varlet-ui/src/bottom-navigation-item/BottomNavigationItem.vue b/packages/varlet-ui/src/bottom-navigation-item/BottomNavigationItem.vue
index 6b5b6f83ca6..16d5d65f41d 100644
--- a/packages/varlet-ui/src/bottom-navigation-item/BottomNavigationItem.vue
+++ b/packages/varlet-ui/src/bottom-navigation-item/BottomNavigationItem.vue
@@ -1,8 +1,7 @@
-
-
-
-
+
+
{{ label }}
-
-
+
+