Skip to content

Commit

Permalink
fix(taro-ui): 修复问题
Browse files Browse the repository at this point in the history
  • Loading branch information
cos2004 committed Aug 7, 2018
1 parent e24340a commit df1ada1
Show file tree
Hide file tree
Showing 11 changed files with 124 additions and 96 deletions.
10 changes: 5 additions & 5 deletions src/components/button/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import Taro from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
import { View } from '@tarojs/components'
import PropTypes from 'prop-types'
import AtIcon from '../icon/index'

Expand Down Expand Up @@ -35,9 +35,9 @@ export default class AtButton extends Taro.Component {
const {
size = 'normal',
type = '',
circle = false,
loading = false,
disabled = false,
circle,
loading,
disabled,
} = this.props
let rootClassName = ['at-button']
const sizeClass = SIZE_CLASS[size] || ''
Expand All @@ -61,7 +61,7 @@ export default class AtButton extends Taro.Component {

return (
<View className={rootClassName} onClick={this.onClick.bind(this)}>
{component}<Text className='at-button__text'>{this.props.children}</Text>
{component}<View className='at-button__text'>{this.props.children}</View>
</View>
)
}
Expand Down
19 changes: 15 additions & 4 deletions src/components/drawer/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Taro from '@tarojs/taro'
import { View } from '@tarojs/components'
import PropTypes from 'prop-types'
import AtIcon from '../icon/index'
import AtList from '../list/index'
import AtListItem from '../list/item/index'

import './index.scss'

Expand Down Expand Up @@ -72,9 +73,19 @@ export default class AtDrawer extends Taro.Component {
<View className='at-drawer__mask' style={maskStyle} onClick={this.onMaskClick.bind(this)}></View>

<View className='at-drawer__content' style={listStyle}>
<View className='at-drawer__list'>
{items.map((name, index) => <View className='at-drawer__list-item' key={index} data-index={index} onClick={this.onItemClick.bind(this, index)}>{name}<View className='at-drawer__list-icon'><AtIcon value='chevron-right' size='20' color='#C7C7CC'></AtIcon></View></View>)}
</View>
<AtList>
{
items.map((name, index) =>
<AtListItem
key={index}
data-index={index}
onClick={this.onItemClick.bind(this, index)}
title={name}
arrow='right'
>
</AtListItem>)
}
</AtList>
</View>
</View>
)
Expand Down
38 changes: 19 additions & 19 deletions src/components/drawer/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,27 @@
opacity: 0;
}

&__list {
margin: 0 0 0 18px;
max-height: 100%;
overflow-y: scroll;
// &__list {
// margin: 0 0 0 18px;
// max-height: 100%;
// overflow-y: scroll;

&-icon {
position: absolute;
right: 20px;
top: 50%;
transform: translateY(-50%);
}
// &-icon {
// position: absolute;
// right: 20px;
// top: 50%;
// transform: translateY(-50%);
// }

&-item {
height: 90px;
line-height: 90px;
font-size: 34px;
color: $color-black-0;
border-bottom: 1px solid #ddd;
position: relative;
}
}
// &-item {
// height: 90px;
// line-height: 90px;
// font-size: 34px;
// color: $color-black-0;
// border-bottom: 1px solid #ddd;
// position: relative;
// }
// }

&.at-drawer--left {
.at-drawer__content {
Expand Down
8 changes: 5 additions & 3 deletions src/components/list/item/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import AtIcon from '../../icon/index'
import './index.scss'

export default class AtListItem extends Component {
onClick () {
this.props.onClick(...arguments)
}
render () {
const {
note,
arrow,
title,
thumb,
onClick,
isSwitch,
extraText,
extraThumb
Expand All @@ -32,7 +34,7 @@ export default class AtListItem extends Component {
}

return (
<View className={rootClass} onClick={onClick}>
<View className={rootClass} onClick={this.onClick.bind(this)}>
{thumb && (
<View className='at-list__item-thumb item-thumb'>
<Image className='item-thumb-info' mode='scaleToFill' src={thumb} />
Expand Down Expand Up @@ -68,7 +70,7 @@ export default class AtListItem extends Component {

{arrow && (
<View className='item-extra__icon'>
<AtIcon value='narrow' color='#c7c7cc' />
<AtIcon value={`chevron-${arrow}`} color='#c7c7cc' />
</View>
)}
</View>
Expand Down
4 changes: 2 additions & 2 deletions src/components/noticebar/index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

@import "../../style/theme/default.scss";
@import "../../style/mixins.scss";

.at-noticebar {
Expand Down Expand Up @@ -34,7 +34,7 @@
}

&__more {
color: #999;
color: $color-grey-2;
position: absolute;
right: 18px;
top: 15px;
Expand Down
19 changes: 11 additions & 8 deletions src/components/pagination/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Taro from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
import PropTypes from 'prop-types'
import AtButton from '../button/index'
import AtIcon from '../icon/index'

import './index.scss'

Expand Down Expand Up @@ -42,12 +43,12 @@ export default class AtPagination extends Taro.Component {
const {
current,
icon,
simple,
// simple,
maxPage,
} = this.state

let rootClassName = ['at-pagination']
if (simple) rootClassName.push('at-pagination--simple')
// if (simple) rootClassName.push('at-pagination--simple')
if (icon) rootClassName.push('at-pagination--icon')
rootClassName = rootClassName.filter(str => str !== '')

Expand All @@ -56,16 +57,18 @@ export default class AtPagination extends Taro.Component {
<View className='at-pagination__operate'>
<View className='at-pagination__btns'>
<View className='at-pagination__btns-prev'>
<AtButton onClick={this.onPrev.bind(this)} size='small' icon={icon ? 'chevron-left' : ''} _disabled={current === 1}>{icon ? '' : '上一页'}</AtButton>
{icon && <AtButton onClick={this.onPrev.bind(this)} size='small' disabled={current === 1}><AtIcon value='chevron-left' color='#000' size='20'></AtIcon></AtButton>}
{!icon && <AtButton onClick={this.onPrev.bind(this)} size='small' disabled={current === 1}>上一页</AtButton>}
</View>
<View className='at-pagination__btns-next'>
<AtButton onClick={this.onNext.bind(this)} size='small' icon={icon ? 'chevron-right' : ''} _disabled={current === maxPage}>{icon ? '' : '下一页'}</AtButton>
{icon && <AtButton onClick={this.onNext.bind(this)} size='small' disabled={current === maxPage}><AtIcon value='chevron-right' color='#000' size='20'></AtIcon></AtButton>}
{!icon && <AtButton onClick={this.onNext.bind(this)} size='small' disabled={current === maxPage}>下一页</AtButton>}
</View>
</View>
</View>
{!simple && <View className='at-pagination__number'>
<View className='at-pagination__number'>
<Text className='at-pagination__number-current'>{current}</Text>/{ maxPage }
</View>}
</View>

</View>
)
Expand All @@ -77,13 +80,13 @@ AtPagination.defaultProps = {
total: 0,
pageSize: 20,
icon: false,
simple: false,
// simple: false,
}

AtPagination.propTypes = {
current: PropTypes.number,
total: PropTypes.number,
pageSize: PropTypes.number,
icon: PropTypes.bool,
simple: PropTypes.bool,
// simple: PropTypes.bool,
}
3 changes: 2 additions & 1 deletion src/components/pagination/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import "../../style/theme/default.scss";

.at-pagination {
font-size: 0;
Expand Down Expand Up @@ -34,7 +35,7 @@
transform: translateX(-50%);

&-current {
color: #6190E8;
color: $color-brand;
}
}
}
Expand Down
79 changes: 42 additions & 37 deletions src/components/tag/index.scss
Original file line number Diff line number Diff line change
@@ -1,40 +1,45 @@
@import '../../style/theme/default.scss';

.at-tag {
height: 60px;
line-height: 60px;
padding: 0 30px;
text-align: center;
border-radius: 8px;
font-size: 28px;
display: inline-block;

border: 2px solid #F7F7F7;
background-color: #F7F7F7;
color: #666;
box-sizing: border-box;
vertical-align: middle;
&--active {
border: 2px solid #77A1F7;
background-color: #fff;
color: #77A1F7;
&.at-tag--primary {
background-color: #769EFA;
color: #fff;
border: 2px solid #769EFA;;
}
}
&--disabled {
opacity: .3;
}
&--small {
height: 40px;
line-height: 40px;
padding: 0 15px;
font-size: 20px;
}
&--circle {
border-radius: 100px;
overflow: hidden;
background-clip: border-box;
height: 60px;
line-height: 56px;
padding: 0 $spacing-h-lg;
text-align: center;
border-radius: $border-radius-md;
font-size: $font-size-base;
display: inline-block;
border: 2px solid $color-grey-6;
background-color: $color-bg-grey;
color: $color-grey-1;
box-sizing: border-box;
vertical-align: middle;

&--active {
border: 2px solid #77A1F7;
background-color: $color-bg;
color: #77A1F7;

&.at-tag--primary {
background-color: #769EFA;
color: $color-text-base-inverse;
border: 2px solid #769EFA;
}
}
}

&--disabled {
opacity: $opacity-disabled;
}

&--small {
height: 40px;
line-height: 36px;
padding: 0 $spacing-h-md;
font-size: $font-size-xs;
}

&--circle {
border-radius: 100px;
overflow: hidden;
background-clip: border-box;
}
}
11 changes: 6 additions & 5 deletions src/components/timeline/index.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
@import '../../style/theme/default.scss';

.at-timelineitem {
position: relative;
padding: 0 0 12px;

&__content {
font-size: 28px;
color: #333;
font-size: $font-size-base;
color: $color-black-1;
text-align: left;
margin-left: 36px;
height: 50px;
Expand All @@ -29,12 +30,12 @@
&::after {
content: '';
width: 20px;
height: 18px;
height: 20px;
display: inline-block;
box-sizing: border-box;
border: 2px solid transparent;
border-radius: 50%;
border-color: #78A4FA;
border-color: $color-info;
margin-top: 5px;
}

Expand All @@ -48,7 +49,7 @@
&__icon {
left: -5px;
// top: 7px;
color: #78A4FA;
color: $color-info;
// padding-top: 2px;
}

Expand Down
9 changes: 0 additions & 9 deletions src/pages/navigation/pagination/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,6 @@ export default class PaginationPage extends Taro.Component {
</View>
</View>
</View>

<View className='panel'>
<View className='panel__title'>隐藏页码</View>
<View className='panel__content'>
<View className='example-item'>
<AtPagination icon total='50' pageSize='10' current='1' simple></AtPagination>
</View>
</View>
</View>
</View>
</View>
)
Expand Down
Loading

0 comments on commit df1ada1

Please sign in to comment.