Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(CountDown): remove hightlight theme #1645

Merged
merged 1 commit into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/count-down/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ format | String | HH:mm:ss | 时间格式,DD-日,HH-时,mm-分,ss-秒,
millisecond | Boolean | false | 是否开启毫秒级渲染 | N
size | String `v0.5.1` | 'medium' | 倒计时尺寸。可选项:small/medium/large | N
split-with-unit `v0.5.1` | Boolean | false | 使用时间单位分割 | N
theme | String `v0.5.1` | 'default' | 倒计时风格。可选项:default/round/square/hightlight | N
theme | String `v0.5.1` | 'default' | 倒计时风格。可选项:default/round/square | N
time | Number | - | 必需。倒计时时长,单位毫秒 | Y
external-classes | Array | - | 组件类名,分别用于设置 组件外层类名、计时器类型、分隔线类名 等。`['t-class', 't-class-count', 't-class-split']` | N

Expand Down
44 changes: 2 additions & 42 deletions src/count-down/__test__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ exports[`CountDown CountDown base demo works fine 1`] = `
<t-count-down
content="default"
splitWithUnit="{{true}}"
theme="hightlight"
tClassCount="external-count"
tClassSplit="external-split"
time="{{5760000}}"
/>
</wx-view>
Expand Down Expand Up @@ -302,46 +303,5 @@ exports[`CountDown CountDown size demo works fine 1`] = `
/>
</wx-view>
</wx-view>
<wx-view
class="demo-count-down"
>
<wx-text
class="demo-count-down-desc"
>
无底色带单位
</wx-text>
<wx-view
class="demo-count-down-content"
>
<t-count-down
format="HH:mm:ss"
size="small"
splitWithUnit="{{true}}"
theme="hightlight"
time="{{5760000}}"
/>
</wx-view>
<wx-view
class="demo-count-down-content"
>
<t-count-down
format="HH:mm:ss"
splitWithUnit="{{true}}"
theme="hightlight"
time="{{5760000}}"
/>
</wx-view>
<wx-view
class="demo-count-down-content"
>
<t-count-down
format="HH:mm:ss"
size="large"
splitWithUnit="{{true}}"
theme="hightlight"
time="{{5760000}}"
/>
</wx-view>
</wx-view>
</size>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ exports[`CountDown CountDown base demo works fine 1`] = `
<t-count-down
content="default"
splitWithUnit="{{true}}"
theme="hightlight"
tClassCount="external-count"
tClassSplit="external-split"
time="{{5760000}}"
/>
</wx-view>
Expand Down Expand Up @@ -302,46 +303,5 @@ exports[`CountDown CountDown size demo works fine 1`] = `
/>
</wx-view>
</wx-view>
<wx-view
class="demo-count-down"
>
<wx-text
class="demo-count-down-desc"
>
无底色带单位
</wx-text>
<wx-view
class="demo-count-down-content"
>
<t-count-down
format="HH:mm:ss"
size="small"
splitWithUnit="{{true}}"
theme="hightlight"
time="{{5760000}}"
/>
</wx-view>
<wx-view
class="demo-count-down-content"
>
<t-count-down
format="HH:mm:ss"
splitWithUnit="{{true}}"
theme="hightlight"
time="{{5760000}}"
/>
</wx-view>
<wx-view
class="demo-count-down-content"
>
<t-count-down
format="HH:mm:ss"
size="large"
splitWithUnit="{{true}}"
theme="hightlight"
time="{{5760000}}"
/>
</wx-view>
</wx-view>
</size>
`;
8 changes: 7 additions & 1 deletion src/count-down/_example/base/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
<view class="demo-count-down">
<text class="demo-count-down-desc"> 无底色带单位 </text>
<view class="demo-count-down-content">
<t-count-down content="default" time="{{ time }}" splitWithUnit theme="hightlight" />
<t-count-down
t-class-count="external-count"
t-class-split="external-split"
content="default"
time="{{ time }}"
splitWithUnit
/>
</view>
</view>
12 changes: 12 additions & 0 deletions src/count-down/_example/base/index.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,15 @@
.demo-count-down-content {
margin: 32rpx 0 48rpx;
}

.external-count {
color: #e34d59;
font-size: 36rpx;
line-height: 48rpx;
vertical-align: middle;
}

.external-split {
font-size: 20rpx;
margin: 0 10rpx;
}
13 changes: 0 additions & 13 deletions src/count-down/_example/size/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,3 @@
<t-count-down size="large" format="HH:mm:ss" time="{{ time }}" splitWithUnit theme="round" />
</view>
</view>

<view class="demo-count-down">
<text class="demo-count-down-desc"> 无底色带单位 </text>
<view class="demo-count-down-content">
<t-count-down size="small" format="HH:mm:ss" time="{{ time }}" splitWithUnit theme="hightlight" />
</view>
<view class="demo-count-down-content">
<t-count-down format="HH:mm:ss" time="{{ time }}" splitWithUnit theme="hightlight" />
</view>
<view class="demo-count-down-content">
<t-count-down size="large" format="HH:mm:ss" time="{{ time }}" splitWithUnit theme="hightlight" />
</view>
</view>
35 changes: 8 additions & 27 deletions src/count-down/count-down.less
Original file line number Diff line number Diff line change
@@ -1,44 +1,38 @@
@import '../common/style/index.less';

@countdown-small-unit-margin: calc(@spacer * 0.5); // 'small'尺寸单位分割文本左右间距
@countdown-medium-unit-margin: calc(@spacer * 0.625); // 'medium'尺寸单位分割文本左右间距
@countdown-large-unit-margin: calc(@spacer * 0.75); // 'large'尺寸单位分割文本左右间距
@countdown-small-unit-margin: 8rpx; // 'small'尺寸单位分割文本左右间距
@countdown-medium-unit-margin: 10rpx; // 'medium'尺寸单位分割文本左右间距
@countdown-large-unit-margin: 12rpx; // 'large'尺寸单位分割文本左右间距
@countdown-unit-color: @font-gray-1; // 带单位分割线文本颜色
@countdown-no-unit-color: @error-color-6; // 无单位分割线文本颜色
@countdown-large-no-unit-margin: calc(@spacer * 0.75); // 'large'尺寸无单位分割文本左右间距
@countdown-medium-no-unit-margin: calc(@spacer * 0.375); // 'medium'尺寸无单位分割文本左右间距
@countdown-small-no-unit-margin: calc(@spacer * 0.25); // 'small'尺寸无单位分割文本左右间距
@countdown-large-no-unit-margin: 12rpx; // 'large'尺寸无单位分割文本左右间距
@countdown-medium-no-unit-margin: 6rpx; // 'medium'尺寸无单位分割文本左右间距
@countdown-small-no-unit-margin: 4rpx; // 'small'尺寸无单位分割文本左右间距
@countdown-small-bg-width: 40rpx; // 'small'尺寸方/圆底背景宽高
@countdown-medium-bg-width: 48rpx; // 'medium'尺寸方/圆底背景宽高
@countdown-large-bg-width: 56rpx; // 'large'尺寸方/圆底背景宽高
@countdown-small-default-font-size: @font-size-base; // 'small'尺寸纯数字倒计时文本大小
@countdown-small-square-font-size: @font-size-s; // 'small'尺寸带方形底倒计时文本大小
@countdown-small-round-font-size: @font-size-s; // 'small'尺寸带圆形底倒计时文本大小
@countdown-small-hightlight-font-size: @font-size-m; // 'small'尺寸高亮倒计时文本大小
@countdown-small-unit-font-size: @font-size; // 'small'尺寸单位分割文本大小
@countdown-small-no-unit-font-size: @font-size-base; // 'small'尺寸无单位分割文本大小
@countdown-medium-default-font-size: @font-size-m; // 'medium'尺寸纯数字倒计时文本大小
@countdown-medium-square-font-size: @font-size-base; // 'medium'尺寸带方形底倒计时文本大小
@countdown-medium-round-font-size: @font-size-base; // 'medium'尺寸带圆形底倒计时文本大小
@countdown-medium-hightlight-font-size: 36rpx; // 'medium'尺寸高亮倒计时文本大小
@countdown-medium-unit-font-size: @font-size-s; // 'medium'尺寸单位分割文本大小
@countdown-medium-no-unit-font-size: @font-size-m; // 'medium'尺寸无单位分割文本大小
@countdown-large-default-font-size: 36rpx; // 'large'尺寸纯数字倒计时文本大小
@countdown-large-square-font-size: @font-size-m; // 'large'尺寸带方形底倒计时文本大小
@countdown-large-round-font-size: @font-size-m; // 'large'尺寸带圆形底倒计时文本大小
@countdown-large-hightlight-font-size: 36rpx; // 'large'尺寸高亮倒计时文本大小
@countdown-large-unit-font-size: @font-size-base; // 'large'尺寸单位分割文本大小
@countdown-large-no-unit-font-size: 36rpx; // 'large'尺寸无单位分割文本大小

// 纯数字倒计时文本颜色
@countdown-default-text-color: var(--td-countdown-default-color, @font-gray-1);
// 高亮倒计时文本颜色
@countdown-hightlight-color: var(--td-countdown-hightlight-color, @error-color-6);
// 方形/圆形底倒计时文本颜色
@countdown-text-color: var(--td-countdown-round-color, @font-white-1);
// 方形/圆形底背景颜色
@countdown-bg-color: var(--td-countdown-bg-color, @error-color-6);

// 带方形底倒计时圆角大小
@countdown-square-border-radius: var(--td-countdown-square-border-radius, @radius-small);
// 带圆形底倒计时圆角大小
Expand All @@ -53,7 +47,6 @@
@defaultFontSize: 'countdown-@{size}-default-font-size';
@roundFontSize: 'countdown-@{size}-round-font-size';
@squareFontSize: 'countdown-@{size}-square-font-size';
@hightlightFontSize: 'countdown-@{size}-hightlight-font-size';
@width: 'countdown-@{size}-bg-width';
@height: 'countdown-@{size}-bg-width';
@dotMargin: 'countdown-@{size}-no-unit-margin';
Expand All @@ -78,12 +71,6 @@
}
}

&.@{countdown}--hightlight {
> .@{item} {
font-size: @@hightlightFontSize;
}
}

&.@{countdown}--round,
&.@{countdown}--square {
> .@{item} {
Expand All @@ -93,8 +80,7 @@
}

&.@{countdown}--round,
&.@{countdown}--square,
&.@{countdown}--hightlight {
&.@{countdown}--square {
> .@{split}--dot {
margin: 0 @@dotMargin;
font-size: @@dotFontSize;
Expand Down Expand Up @@ -125,8 +111,7 @@
}

&--square,
&--round,
&--hightlight {
&--round {
> .@{split}--dot {
color: @countdown-no-unit-color;
}
Expand Down Expand Up @@ -157,8 +142,4 @@
background: @countdown-bg-color;
}
}

&--hightlight {
color: @countdown-hightlight-color;
}
}
2 changes: 1 addition & 1 deletion src/count-down/count-down.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
>
<slot wx:if="{{content !== 'default'}}" name="content" />
<slot wx:if="{{content !== 'default'}}" />
<block wx:elif="{{theme == 'default'}}">{{formattedTime}}</block>
<block wx:elif="{{theme == 'default' && !splitWithUnit}}">{{formattedTime}}</block>
<block wx:else>
<block wx:for="{{timeRange}}" wx:key="index">
<text class="{{classPrefix}}__item {{prefix}}-class-count">{{this.format(timeData[timeRange[index]])}}</text>
Expand Down
2 changes: 1 addition & 1 deletion src/count-down/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export interface TdCountDownProps {
*/
theme?: {
type: StringConstructor;
value?: 'default' | 'round' | 'square' | 'hightlight';
value?: 'default' | 'round' | 'square';
};
/**
* 倒计时时长,单位毫秒
Expand Down