-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
38 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,42 @@ | ||
import Taro from '@tarojs/taro' | ||
import PropTypes from 'prop-types' | ||
import { View } from '@tarojs/components' | ||
import './index.scss' | ||
|
||
class AtLoading extends Taro.Component { | ||
render () { | ||
const style = { | ||
'border': `1px solid ${this.props.color}`, | ||
'border-color': `${this.props.color} transparent transparent transparent` | ||
const { color, size } = this.props | ||
const sizeStyle = { | ||
width: `${size}px`, | ||
height: `${size}px` | ||
} | ||
const colorStyle = { | ||
'border': `1px solid ${color}`, | ||
'border-color': `${color} transparent transparent transparent` | ||
} | ||
const ringStyle = Object.assign({}, colorStyle, sizeStyle) | ||
return ( | ||
<View className='at-loading'> | ||
<View className='at-loading__ring' style={style}></View> | ||
<View className='at-loading__ring' style={style}></View> | ||
<View className='at-loading__ring' style={style}></View> | ||
<View className='at-loading' style={sizeStyle}> | ||
<View className='at-loading__ring' style={ringStyle}></View> | ||
<View className='at-loading__ring' style={ringStyle}></View> | ||
<View className='at-loading__ring' style={ringStyle}></View> | ||
</View> | ||
) | ||
} | ||
} | ||
|
||
AtLoading.defaultProps = { | ||
size: '18', | ||
color: '#fff' | ||
} | ||
AtLoading.propTypes = { | ||
size: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.number | ||
]), | ||
color: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.number | ||
]) | ||
} | ||
export default AtLoading |
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