-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Result): support iconProps attr (#1040)
* feat(Result): support iconProps attr * style(Result): use css token
- Loading branch information
Showing
18 changed files
with
221 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Component({ | ||
data: { | ||
resultList: [ | ||
{ | ||
title: '成功状态', | ||
theme: 'success', | ||
description: '描述文字', | ||
}, | ||
{ | ||
title: '失败状态', | ||
theme: 'error', | ||
description: '描述文字', | ||
}, | ||
{ | ||
title: '警示状态', | ||
theme: 'warning', | ||
description: '描述文字', | ||
}, | ||
{ | ||
title: '默认状态', | ||
theme: 'default', | ||
description: '描述文字', | ||
}, | ||
], | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"component": true, | ||
"usingComponents": { | ||
"t-result": "tdesign-miniprogram/result/result" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<view wx:for="{{resultList}}" wx:for-item="item" wx:key="index"> | ||
<view class="demo-section__content"> | ||
<t-result theme="{{item.theme}}" title="{{item.title}}" description="{{item.description}}" /> | ||
</view> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.demo-section__content { | ||
margin-bottom: 96rpx; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
Page({ | ||
data: { | ||
iconProps: { | ||
size: '160rpx', | ||
}, | ||
}, | ||
goBack() { | ||
wx.navigateBack({ delta: 1 }); | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<view class="page"> | ||
<view class="demo-section__wrapper"> | ||
<t-result theme="success" title="成功状态" description="描述文字" /> | ||
<t-result theme="success" title="成功状态" description="描述文字" iconProps="{{iconProps}}" /> | ||
</view> | ||
<view class="demo-section__wrapper"> | ||
<t-button size="large" variant="plain" block bind:tap="goBack">返回</t-button> | ||
<t-button theme="primary" block size="large" variant="outline" bind:tap="goBack">返回</t-button> | ||
</view> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
Component({ | ||
properties: { | ||
theme: { | ||
type: String, | ||
}, | ||
title: { | ||
type: String, | ||
}, | ||
description: { | ||
type: String, | ||
}, | ||
data: { | ||
resultList: [ | ||
{ | ||
title: '成功状态', | ||
theme: 'success', | ||
}, | ||
{ | ||
title: '失败状态', | ||
theme: 'error', | ||
}, | ||
{ | ||
title: '警示状态', | ||
theme: 'warning', | ||
}, | ||
{ | ||
title: '默认状态', | ||
theme: 'default', | ||
}, | ||
], | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
<t-result theme="{{theme}}" title="{{title}}" description="{{description}}" /> | ||
<view wx:for="{{resultList}}" wx:for-item="item" wx:key="index"> | ||
<view class="demo-section__content"> | ||
<t-result theme="{{item.theme}}" title="{{item.title}}" description="{{item.description}}" /> | ||
</view> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.demo-section__content { | ||
margin-bottom: 96rpx; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,64 @@ | ||
@import '../common/style/index.less'; | ||
|
||
@result-title-font: @font-size-l; | ||
@result-title-font-size: @font-size-l; | ||
@result-title-line-height: @font-size * 2.8; | ||
@result-title-color: rgba(0, 0, 0, 0.9); | ||
@result-title-color: @font-gray-1; | ||
|
||
@result-description-font: @font-size * 1.4; | ||
@result-description-font-size: @font-size-base; | ||
@result-description-line-height: @font-size * 2.2; | ||
@result-description-color: rgba(0, 0, 0, 0.6); | ||
@result-description-color: @font-gray-2; | ||
|
||
@result-default-color: #0052d9; | ||
@result-success-color: #00a870; | ||
@result-warning-color: #ed7b2f; | ||
@result-error-color: #e34d59; | ||
@result-icon-default-color: @primary-color; | ||
@result-icon-success-color: @success-color; | ||
@result-icon-warning-color: @warning-color; | ||
@result-icon-error-color: @error-color; | ||
|
||
@result-title-margin-top: @spacer; | ||
@result-description-margin-top: @spacer * 1.5; | ||
|
||
.@{prefix}-result { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
|
||
&__title { | ||
line-height: @result-title-line-height; | ||
font-size: @result-title-font; | ||
line-height: var(--td-result-title-line-height, @result-title-line-height); // 标题行高 | ||
font-size: var(--td-result-title-font-size, @result-title-font-size); // 标题文字大小 | ||
font-weight: 700; | ||
color: @result-title-color; | ||
} | ||
|
||
&__icon { | ||
font-size: 80px; | ||
color: var(--td-result-title-color, @result-title-color); // 标题颜色 | ||
} | ||
|
||
&__thumb + &__title:not(:empty) { | ||
margin-top: @spacer; | ||
margin-top: var(--td-result-title-margin-top, @result-title-margin-top); // 标题内容上边距 | ||
} | ||
|
||
&__description { | ||
text-align: center; | ||
color: @result-description-color; | ||
font-size: @result-description-font; | ||
line-height: @result-description-line-height; | ||
color: var(--td-result-description-color, @result-description-color); // 描述颜色 | ||
font-size: var(--td-result-description-font-size, @result-description-font-size); // 描述文字大小 | ||
line-height: var(--td-result-description-line-height, @result-description-line-height); // 描述行高 | ||
} | ||
|
||
&__title + &__description:not(:empty) { | ||
margin-top: @spacer * 1.5; | ||
margin-top: var(--td-result-description-margin-top, @result-description-margin-top); // 描述内容上边距 | ||
} | ||
|
||
// theme | ||
&--theme { | ||
&-default { | ||
color: @result-default-color; | ||
color: var(--td-result-icon-default-color, @result-icon-default-color); // 默认状态图标颜色 | ||
} | ||
|
||
&-success { | ||
color: @result-success-color; | ||
color: var(--ts-result-icon-success-color, @result-icon-success-color); // 成功状态图标颜色 | ||
} | ||
|
||
&-warning { | ||
color: @result-warning-color; | ||
color: var(--ts-result-icon-warning-color, @result-icon-warning-color); // 警示状态图标颜色 | ||
} | ||
|
||
&-error { | ||
color: @result-error-color; | ||
color: var(--td-result-icon-error-color, @result-icon-error-color); // 失败状态图标颜色 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters