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

fix(rate): update style #1350

Merged
merged 1 commit into from
Dec 30, 2022
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
4 changes: 2 additions & 2 deletions src/rate/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
name | type | default | description | required
-- | -- | -- | -- | --
allow-half | Boolean | false | \- | N
color | String / Array | '#ED7B2F' | Typescript:`string \| Array<string>` | N
color | String / Array | '#ED7B2F' | `0.30.0`。Typescript:`string \| Array<string>` | N
count | Number | 5 | \- | N
custom-style | String | - | `0.25.0` | N
disabled | Boolean | - | \- | N
external-classes | Array | - | `['t-class', 't-class-icon', 't-class-text']` | N
gap | Number | 4 | \- | N
gap | String / Number | 8 | \- | N
icon | String / Array | - | Typescript:`string \| string[]` | N
show-text | Boolean | false | \- | N
size | String | 24px | \- | N
Expand Down
29 changes: 5 additions & 24 deletions src/rate/__test__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ exports[`Rate Rate base demo works fine 1`] = `
<wx-view
class="demo-rate__title"
>
请点击评分
实心评分
</wx-view>
<t-rate
value="{{3}}"
Expand Down Expand Up @@ -128,26 +128,6 @@ exports[`Rate Rate custom demo works fine 1`] = `
</custom>
`;

exports[`Rate Rate disabled demo works fine 1`] = `
<disabled>
<wx-view
class="demo-rate"
>
<wx-view
class="demo-rate__title"
>
仅展示
</wx-view>
<t-rate
disabled="{{true}}"
value="{{3}}"
variant="filled"
bind:change="onChange"
/>
</wx-view>
</disabled>
`;

exports[`Rate Rate show-text demo works fine 1`] = `
<show-text>
<wx-view
Expand All @@ -156,7 +136,7 @@ exports[`Rate Rate show-text demo works fine 1`] = `
<wx-view
class="demo-rate__title"
>
请点击评分
带描述评分
</wx-view>
<t-rate
data-index="{{0}}"
Expand All @@ -181,7 +161,7 @@ exports[`Rate Rate show-text demo works fine 1`] = `
<wx-view
class="demo-rate__title"
>
请点击评分
带描述评分
</wx-view>
<t-rate
data-index="{{1}}"
Expand All @@ -197,12 +177,13 @@ exports[`Rate Rate show-text demo works fine 1`] = `
<wx-view
class="demo-rate__title"
>
请点击评分
带描述评分
</wx-view>
<t-rate
data-index="{{2}}"
showText="{{true}}"
value="{{0}}"
variant="filled"
bind:change="onChange"
/>
</wx-view>
Expand Down
2 changes: 1 addition & 1 deletion src/rate/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import simulate from 'miniprogram-simulate';
import path from 'path';

const mapper = ['action', 'base', 'color', 'count', 'custom', 'disabled', 'show-text', 'size', 'special', 'un-filled'];
const mapper = ['action', 'base', 'color', 'count', 'custom', 'show-text', 'size', 'special', 'un-filled'];

describe('Rate', () => {
mapper.forEach((demoName) => {
Expand Down
2 changes: 1 addition & 1 deletion src/rate/_example/base/index.wxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<view class="demo-rate">
<view class="demo-rate__title">请点击评分</view>
<view class="demo-rate__title">实心评分</view>
<!-- 实心评分,设置属性:variant-->
<t-rate value="{{value}}" variant="filled" bind:change="onChange" />
</view>
13 changes: 0 additions & 13 deletions src/rate/_example/disabled/index.js

This file was deleted.

6 changes: 0 additions & 6 deletions src/rate/_example/disabled/index.json

This file was deleted.

4 changes: 0 additions & 4 deletions src/rate/_example/disabled/index.wxml

This file was deleted.

23 changes: 0 additions & 23 deletions src/rate/_example/disabled/index.wxss

This file was deleted.

1 change: 0 additions & 1 deletion src/rate/_example/rate.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"count": "./count",
"action": "./action",
"show-text": "./show-text",
"disabled": "./disabled",
"color": "./color",
"size": "./size"
}
Expand Down
3 changes: 0 additions & 3 deletions src/rate/_example/rate.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
<view class="demo-desc">评分大小</view>
<size />

<view class="demo-desc">禁用评分</view>
<disabled />

<view class="demo-desc">设置评分颜色</view>
<color />
</t-demo>
Expand Down
8 changes: 4 additions & 4 deletions src/rate/_example/show-text/index.wxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<view class="demo-rate">
<view class="demo-rate__title">请点击评分</view>
<view class="demo-rate__title">带描述评分</view>
<!-- 自定义带描述评分,设置属性:texts -->
<t-rate
value="{{value[0]}}"
Expand All @@ -11,12 +11,12 @@
/>
</view>
<view class="demo-rate">
<view class="demo-rate__title">请点击评分</view>
<view class="demo-rate__title">带描述评分</view>
<!-- 带描述评分,设置属性:showText-->
<t-rate value="{{value[1]}}" variant="filled" data-index="{{1}}" bind:change="onChange" showText="{{true}}" />
</view>

<view class="demo-rate">
<view class="demo-rate__title">请点击评分</view>
<t-rate value="{{value[2]}}" data-index="{{2}}" bind:change="onChange" showText="{{true}}" />
<view class="demo-rate__title">带描述评分</view>
<t-rate value="{{value[2]}}" variant="filled" data-index="{{2}}" bind:change="onChange" showText="{{true}}" />
</view>
6 changes: 3 additions & 3 deletions src/rate/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ const props: TdRateProps = {
},
/** 评分图标的间距 */
gap: {
type: Number,
value: 4,
type: null,
value: 8,
},
/** 自定义评分图标;此时不受 variant 影响 */
/** 自定义评分图标,[选中图标,未选中图标];此时不受 variant 影响 */
icon: {
type: null,
},
Expand Down
17 changes: 0 additions & 17 deletions src/rate/rate.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
@rate-text-active-color: var(--td-rate-text-active-color, @font-gray-1);
@rate-selected-color: var(--td-rate-selected-color, @warning-color);
@rate-unselected-color: var(--td-rate-unselected-color, @gray-color-4);
@rate-disabled-color: var(--td-rate-disabled-color, @text-disabled-color);
@rate-text-active-font-weight: var(--td-rate-text-active-font-weight, 600);
@rate-icon-scale: var(--td-rate-icon-scale, 1.33);

Expand Down Expand Up @@ -48,22 +47,6 @@
&--unselected {
color: @rate-unselected-color;
}

&--disabled {
color: @rate-disabled-color;

&-half {
background: linear-gradient(
to right,
@rate-disabled-color 0%,
@rate-disabled-color 50%,
@rate-unselected-color 51%,
@rate-unselected-color 100%
);
-webkit-background-clip: text;
background-clip: text;
}
}
}

&__text {
Expand Down
6 changes: 3 additions & 3 deletions src/rate/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ export interface TdRateProps {
* @default 8
*/
gap?: {
type: NumberConstructor;
value?: number;
type: null;
value?: string | number;
};
/**
* 自定义评分图标;此时不受 variant 影响
* 自定义评分图标,[选中图标,未选中图标];此时不受 variant 影响
*/
icon?: {
type: null;
Expand Down