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(avatar): add avatar default css #116

Merged
merged 4 commits into from
Jan 18, 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
82 changes: 14 additions & 68 deletions example/pages/avatar/avatar.less
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ page {
width: 100%;
margin: 20rpx 0;

.default-user {
background-color: #e7e7e7;
color: #c5c5c5;
font-size: 60rpx;
}

.avatar-example {
text-align: center;
font-size: 24rpx;
Expand Down Expand Up @@ -65,80 +59,32 @@ page {
text-align: center;
}

.alt-example {
color: #fff;
background-color: #0052d9;
font-weight: 400;
}

.alt-example1 {
.font-size-20 {
font-size: 40rpx;
}

.alt-example2 {
font-size: 32rpx;
}

.alt-example3 {
font-size: 32rpx;
}

.alt-example4 {
font-size: 24rpx;
}

.alt-example5 {
font-size: 24rpx;
}

.border-example-show,
.border-example-operate {
font-size: 46rpx;

.small {
margin-right: -12rpx;
}

.img-small {
background-color: #e7e7e7;
font-size: 36rpx;
border: 4rpx solid white;
box-sizing: border-box;
}

.medium {
margin-right: -16rpx;
.border-size {
&-2 {
border: 4rpx solid #fff;
}

.img-medium {
background-color: #e7e7e7;
border: 6rpx solid white;
box-sizing: border-box;
font-size: 48rpx;
&-3 {
border: 6rpx solid #fff;
}

.large {
margin-right: -16rpx;
font-size: 54rpx;
}

.img-large {
background-color: #e7e7e7;
border: 8rpx solid white;
box-sizing: border-box;
&-4 {
border: 8rpx solid #fff;
}
}

.border-example-3 {
background-color: #e7e7e7;
border: 4rpx solid white;
box-sizing: border-box;
.excursion-right-8 {
margin-right: -16rpx;
}

.icon-example {
background-color: #e5e5e5;
color: #bbb;
font-size: 40rpx;
.alt-example {
color: #fff;
background-color: #0052d9;
font-weight: 400;
}
}

Expand Down
22 changes: 11 additions & 11 deletions example/pages/avatar/avatar.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Page({
data: {
pics6: [
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-1.jpg',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-2.jpg',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-3.jpg',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-4.jpg',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-5.jpg',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-5.jpg',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-v2/1.png',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-v2/2.png',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-v2/3.png',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-v2/4.png',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-v2/5.png',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-v2/1.png',
],
pics: [
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-1.jpg',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-2.jpg',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-3.jpg',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-4.jpg',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-5.jpg',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-v2/1.png',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-v2/2.png',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-v2/3.png',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-v2/4.png',
'https://cdn-we-retail.ym.tencent.com/retail-ui/components-exp/avatar/avatar-v2/5.png',
],
},
onAddTap() {
Expand Down
104 changes: 51 additions & 53 deletions example/pages/avatar/avatar.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
<view class="desc">
<view class="row">
<view class="avatar-example">
<t-avatar icon="user" t-class-icon="default-user" />
<t-avatar icon="user" />
<text class="avatar-word">默认</text>
</view>
<view class="gutter-column-24"></view>
<view class="gutter-column-24" />
<view class="avatar-example">
<t-avatar image="{{pics[0]}}" />
<text class="avatar-word">用户</text>
</view>
<view class="gutter-column-24"></view>
<view class="gutter-column-24" />
<view class="avatar-example">
<t-avatar shape="circle" image="{{pics[0]}}" />
<text class="avatar-word">圆形</text>
</view>
<view class="gutter-column-24"></view>
<view class="gutter-column-24" />
<view class="avatar-example">
<t-avatar shape="round" image="{{pics[0]}}" />
<text class="avatar-word">方形</text>
</view>
<view class="gutter-column-24"></view>
<view class="gutter-column-24" />
<view class="avatar-example text">
<t-avatar alt="A" t-class-alt="alt-example" />
<text class="avatar-word">自定义文字</text>
Expand All @@ -38,16 +38,16 @@
max="5"
collapseAvatar="+5"
size="small"
class="border-example-show"
t-class-image="border-size-2"
>
<t-avatar
wx:for="{{pics}}"
wx:for="{{pics6}}"
wx:for-item="pic"
wx:key="index"
image="{{pic}}"
size="small"
t-class-image="img-small"
t-class="small"
t-class-image="border-size-2"
t-class="excursion-right-8"
/>
</t-avatar-group>
</view>
Expand All @@ -57,15 +57,15 @@
cascading="left-up"
collapseAvatar="+5"
size="40px"
class="border-example-show"
t-class-image="border-size-3"
>
<t-avatar
wx:for="{{pics6}}"
wx:for-item="pic"
wx:key="index"
image="{{pic}}"
t-class-image="img-medium"
t-class="medium"
t-class-image="border-size-3"
t-class="excursion-right-8"
/>
</t-avatar-group>
</view>
Expand All @@ -75,15 +75,15 @@
cascading="left-up"
collapseAvatar="+5"
size="medium"
class="border-example-show"
t-class-image="border-size-4"
>
<t-avatar
wx:for="{{pics6}}"
wx:for-item="pic"
wx:key="index"
image="{{pic}}"
t-class-image="img-large"
t-class="large"
t-class-image="border-size-4"
t-class="excursion-right-8"
/>
</t-avatar-group>
</view>
Expand All @@ -92,67 +92,65 @@
<t-demo desc="带操作 从下往上">
<view class="desc">
<view class="row">
<t-avatar-group max="3" size="small" class="border-example-operate">
<t-avatar-group max="5" size="small">
<t-avatar
wx:for="{{pics}}"
wx:for="{{pics6}}"
wx:for-item="pic"
wx:key="index"
image="{{pic}}"
t-class-image="img-small"
t-class="small"
t-class-image="border-size-2"
t-class="excursion-right-8"
/>
<t-avatar
slot="collapseAvatar"
icon="user-add"
t-class-icon="img-small"
t-class-alt="alt-example1"
bindtap="onAddTap"
t-class="small"
t-class-image="border-size-2"
t-class="excursion-right-8"
/>
</t-avatar-group>
</view>
</view>
<view class="desc">
<view class="row">
<t-avatar-group max="3" size="40px" class="border-example-operate">
<t-avatar-group max="5" size="40px">
<t-avatar
wx:for="{{pics}}"
wx:for="{{pics6}}"
wx:for-item="pic"
wx:key="index"
image="{{pic}}"
t-class-image="img-medium"
t-class="medium"
t-class-image="border-size-3"
t-class="excursion-right-8"
/>
<t-avatar
slot="collapseAvatar"
icon="user-add"
t-class-icon="img-medium"
t-class-alt="alt-example1"
bindtap="onAddTap"
t-class="border-example-show-medium"
t-class-image="border-size-3"
t-class-icon="font-size-20"
t-class="excursion-right-8"
/>
</t-avatar-group>
</view>
</view>
<view class="desc">
<view class="row">
<view class="avatar-group">
<t-avatar-group max="3" size="medium" class="border-example-operate">
<t-avatar-group max="5" size="medium">
<t-avatar
wx:for="{{pics}}"
wx:for="{{pics6}}"
wx:for-item="pic"
wx:key="index"
image="{{pic}}"
t-class-image="img-medium"
t-class="medium"
t-class-image="border-size-4"
t-class="excursion-right-8"
/>
<t-avatar
slot="collapseAvatar"
icon="user-add"
t-class-icon="img-medium"
t-class-alt="alt-example1"
bindtap="onAddTap"
t-class="border-example-show-medium"
t-class-image="border-size-4"
t-class="excursion-right-8"
/>
</t-avatar-group>
</view>
Expand All @@ -163,46 +161,46 @@
<view class="desc">
<view class="row" style="margin: 40rpx 0">
<text class="row-text-64 row-text-common">L</text>
<view class="gutter-column-32"></view>
<view class="gutter-column-32" />
<text class="row-text-48 row-text-common">M</text>
<view class="gutter-column-32"></view>
<view class="gutter-column-32" />
<text class="row-text-32 row-text-common">S</text>
</view>
<view class="row">
<view class="avatar-example">
<t-avatar image="{{pics[0]}}" size="large" />
<t-avatar icon="user" size="large" />
</view>
<view class="gutter-column-32"></view>
<view class="gutter-column-32" />
<view class="avatar-example">
<t-avatar image="{{pics[0]}}" size="medium" />
<t-avatar icon="user" size="medium" />
</view>
<view class="gutter-column-32"></view>
<view class="gutter-column-32" />
<view class="avatar-example">
<t-avatar image="{{pics[0]}}" size="small" />
<t-avatar icon="user" size="small" />
</view>
</view>
<view class="row">
<view class="avatar-example">
<t-avatar image="{{pics[0]}}" size="large" badge-props="{{ {count: 2} }}" />
<t-avatar image="{{pics[0]}}" size="large" badge-props="{{ {count: 16} }}" />
</view>
<view class="gutter-column-32"></view>
<view class="gutter-column-32" />
<view class="avatar-example">
<t-avatar image="{{pics[0]}}" size="medium" badge-props="{{ {count: 2} }}" />
<t-avatar image="{{pics[0]}}" size="medium" badge-props="{{ {count: 8} }}" />
</view>
<view class="gutter-column-32"></view>
<view class="gutter-column-32" />
<view class="avatar-example">
<t-avatar image="{{pics[0]}}" size="small" badge-props="{{ {dot: true} }}" />
</view>
</view>
<view class="row">
<view class="avatar-example">
<t-avatar shape="round" image="{{pics[0]}}" badge-props="{{ {count: 2} }}" size="large" />
<t-avatar shape="round" image="{{pics[0]}}" badge-props="{{ {count: 16} }}" size="large" />
</view>
<view class="gutter-column-32"></view>
<view class="gutter-column-32" />
<view class="avatar-example">
<t-avatar shape="round" image="{{pics[0]}}" badge-props="{{ {count: 2} }}" size="medium" />
<t-avatar shape="round" image="{{pics[0]}}" badge-props="{{ {count: 8} }}" size="medium" />
</view>
<view class="gutter-column-32"></view>
<view class="gutter-column-32" />
<view class="avatar-example">
<t-avatar shape="round" image="{{pics[0]}}" badge-props="{{ {dot: true} }}" size="small" />
</view>
Expand All @@ -211,11 +209,11 @@
<view class="avatar-example">
<t-avatar alt="A" t-class-alt="alt-example alt-example2" size="large" />
</view>
<view class="gutter-column-32"></view>
<view class="gutter-column-32" />
<view class="avatar-example">
<t-avatar alt="A" t-class-alt="alt-example alt-example3" size="medium" />
</view>
<view class="gutter-column-32"></view>
<view class="gutter-column-32" />
<view class="avatar-example">
<t-avatar alt="A" t-class-alt="alt-example alt-example4" size="small" />
</view>
Expand Down
Loading