Skip to content

Commit

Permalink
feat(Progress): add some less vars (youzan#4790)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Oct 20, 2019
1 parent 95598e8 commit 02c027b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
11 changes: 2 additions & 9 deletions src/progress/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { createNamespace, isDef, addUnit } from '../utils';
import { BLUE, WHITE } from '../utils/constant';

const [createComponent, bem] = createNamespace('progress');

export default createComponent({
props: {
color: String,
inactive: Boolean,
pivotText: String,
textColor: String,
pivotColor: String,
trackColor: String,
strokeWidth: [String, Number],
Expand All @@ -18,14 +19,6 @@ export default createComponent({
showPivot: {
type: Boolean,
default: true
},
color: {
type: String,
default: BLUE
},
textColor: {
type: String,
default: WHITE
}
},

Expand Down
2 changes: 2 additions & 0 deletions src/progress/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
position: absolute;
left: 0;
height: 100%;
background: @progress-color;
border-radius: inherit;
}

Expand All @@ -19,6 +20,7 @@
box-sizing: border-box;
min-width: 3.6em;
padding: @progress-pivot-padding;
color: @progress-pivot-text-color;
font-size: @progress-pivot-font-size;
line-height: @progress-pivot-line-height;
text-align: center;
Expand Down
12 changes: 6 additions & 6 deletions src/progress/test/__snapshots__/demo.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
exports[`renders demo correctly 1`] = `
<div>
<div>
<div class="van-progress"><span class="van-progress__portion" style="background: rgb(25, 137, 250); width: 0px;"><span class="van-progress__pivot" style="color: rgb(255, 255, 255); left: 0px; background: rgb(25, 137, 250);">50%</span></span></div>
<div class="van-progress"><span class="van-progress__portion" style="width: 0px;"><span class="van-progress__pivot" style="left: 0px;">50%</span></span></div>
</div>
<div>
<div class="van-progress" style="height: 8px;"><span class="van-progress__portion" style="background: rgb(25, 137, 250); width: 0px;"><span class="van-progress__pivot" style="color: rgb(255, 255, 255); left: 0px; background: rgb(25, 137, 250);">50%</span></span></div>
<div class="van-progress" style="height: 8px;"><span class="van-progress__portion" style="width: 0px;"><span class="van-progress__pivot" style="left: 0px;">50%</span></span></div>
</div>
<div>
<div class="van-progress"><span class="van-progress__portion" style="background: rgb(202, 202, 202); width: 0px;"><span class="van-progress__pivot" style="color: rgb(255, 255, 255); left: 0px; background: rgb(202, 202, 202);">50%</span></span></div>
<div class="van-progress"><span class="van-progress__portion" style="background: rgb(202, 202, 202); width: 0px;"><span class="van-progress__pivot" style="left: 0px; background: rgb(202, 202, 202);">50%</span></span></div>
</div>
<div>
<div class="van-progress"><span class="van-progress__portion" style="background: rgb(242, 130, 106); width: 0px;"><span class="van-progress__pivot" style="color: rgb(255, 255, 255); left: 0px; background: rgb(242, 130, 106);">橙色</span></span></div>
<div class="van-progress"><span class="van-progress__portion" style="background: rgb(238, 10, 36); width: 0px;"><span class="van-progress__pivot" style="color: rgb(255, 255, 255); left: 0px; background: rgb(238, 10, 36);">红色</span></span></div>
<div class="van-progress"><span class="van-progress__portion" style="width: 0px;"><span class="van-progress__pivot" style="color: rgb(255, 255, 255); left: 0px; background: rgb(114, 50, 221);">紫色</span></span></div>
<div class="van-progress"><span class="van-progress__portion" style="background: rgb(242, 130, 106); width: 0px;"><span class="van-progress__pivot" style="left: 0px; background: rgb(242, 130, 106);">橙色</span></span></div>
<div class="van-progress"><span class="van-progress__portion" style="background: rgb(238, 10, 36); width: 0px;"><span class="van-progress__pivot" style="left: 0px; background: rgb(238, 10, 36);">红色</span></span></div>
<div class="van-progress"><span class="van-progress__portion" style="width: 0px;"><span class="van-progress__pivot" style="left: 0px; background: rgb(114, 50, 221);">紫色</span></span></div>
</div>
</div>
`;
4 changes: 2 additions & 2 deletions src/progress/test/__snapshots__/index.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`calc width 1`] = `<div class="van-progress"><span class="van-progress__portion" style="background: rgb(25, 137, 250); width: 0px;"></span></div>`;
exports[`calc width 1`] = `<div class="van-progress"><span class="van-progress__portion" style="width: 0px;"></span></div>`;

exports[`calc width 2`] = `<div class="van-progress"><span class="van-progress__portion" style="background: rgb(25, 137, 250); width: 0px;"><span class="van-progress__pivot" style="color: rgb(255, 255, 255); left: 0px; background: rgb(25, 137, 250);">test</span></span></div>`;
exports[`calc width 2`] = `<div class="van-progress"><span class="van-progress__portion" style="width: 0px;"><span class="van-progress__pivot" style="left: 0px;">test</span></span></div>`;
4 changes: 3 additions & 1 deletion src/style/var.less
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,13 @@

// Progress
@progress-height: 4px;
@progress-color: @blue;
@progress-background-color: @gray-light;
@progress-pivot-padding: 0 5px;
@progress-pivot-text-color: @white;
@progress-pivot-font-size: @font-size-xs;
@progress-pivot-line-height: 1.6;
@progress-pivot-background-color: @gray-light;
@progress-pivot-background-color: @blue;

// PullRefresh
@pull-refresh-head-height: 50px;
Expand Down

0 comments on commit 02c027b

Please sign in to comment.