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(backtop): correct classname #35

Merged
merged 1 commit into from
Dec 22, 2021
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
41 changes: 21 additions & 20 deletions src/back-top/back-top.less
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// @import (css) '../common/index.wxss';
@import '../common/style/index.less';

@backtop: ~"@{prefix}-back-top";
@back-top-text-font-size: @font-size;
@back-top-icon-font-size: 32rpx;
@back-top-default-color: #666;

.@{prefix}-back-top {
.@{backtop} {
display: flex;
flex-direction: column;
align-items: center;
Expand All @@ -16,83 +17,83 @@
transition: height .2s;
height: auto;

&.fixed {
&.@{prefix}-is-fixed {
position: fixed;
right: 32rpx;
bottom: 133rpx;
}

&.round,
&.round-dark {
&.@{prefix}-is-round,
&.@{prefix}-is-round-dark {
width: 96rpx;
height: 96rpx;
border-radius: 50%;

.icon {
.@{backtop}__icon {
margin: 0;
// border: none;
border-radius: 0;
background-color: transparent;
}

.text {
.@{backtop}__text {
padding: 0;
margin-top: 0;
}
}

&.round,
&.half-round {
&.@{prefix}-is-round,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@{prefix}--round

&.@{prefix}-is-half-round {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@{prefix}--half-round

background-color: rgb(255, 255, 255);
color: #333;
border: 1rpx solid;
border-color: #ddd;

.icon,
.text {
.@{backtop}__icon,
.@{backtop}__text {
color: #333;
}
}

&.round-dark,
&.half-round-dark {
&.@{prefix}-is-round-dark,
&.@{prefix}-is-half-round-dark {
background-color: #000;
color: #fff;

.icon,
.text {
.@{backtop}__icon,
.@{backtop}__text {
color: #fff;
}
}

&.half-round,
&.half-round-dark {
&.@{prefix}-is-half-round,
&.@{prefix}-is-half-round-dark {
width: 120rpx;
height: 80rpx;
border-radius: 120rpx 0 0 120rpx;
flex-direction: row;
right: 0;

.icon {
.@{backtop}__icon {
margin: 0;
border-radius: 0;
background-color: transparent;
}

.text {
.@{backtop}__text {
padding: 0;
margin-left: 8rpx;
width: 2em;
}
}

.text {
&__text {
font-size: @back-top-text-font-size;
color: @back-top-default-color;
line-height: 24rpx;
}

.icon {
&__icon {
display: flex;
justify-content: center;
align-items: center;
Expand Down
1 change: 1 addition & 0 deletions src/back-top/back-top.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default class BackTop extends SuperComponent {
* Component initial data
*/
data = {
prefix,
classPrefix: name,
};

Expand Down
9 changes: 6 additions & 3 deletions src/back-top/back-top.wxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<view class="t-class {{classPrefix}} {{fixed && 'fixed'}} {{theme}}" bindtap="toTop">
<t-icon wx:if="{{!!icon}}" class="icon t-class-icon" name="{{icon}}" />
<view wx:if="{{ !!text }}" class="text t-class-text"> {{ text }} </view>
<view
class="{{prefix}}-class {{classPrefix}} {{fixed ? prefix + '-is-fixed' : ''}} {{prefix + '-is-' + theme}}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{{classPrefix + '--' + theme}}

bindtap="toTop"
>
<t-icon wx:if="{{!!icon}}" class="{{classPrefix}}__icon {{prefix}}-class-icon" name="{{icon}}" />
<view wx:if="{{!!text}}" class="{{classPrefix}}__text {{prefix}}-class-text"> {{text}} </view>
<slot />
</view>