-
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
33 changed files
with
1,332 additions
and
112 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import Taro from "@tarojs/taro" | ||
import { View, Image, Text } from "@tarojs/components" | ||
import PropTypes from 'prop-types'; | ||
|
||
import './index.scss' | ||
|
||
const SIZE_CLASS = { | ||
large: 'large', | ||
normal: 'normal', | ||
small: 'small', | ||
} | ||
|
||
// const TYPE_CLASS = { | ||
// primary: 'primary', | ||
// } | ||
|
||
|
||
export default class Atarticle extends Taro.Component { | ||
constructor() { | ||
super(...arguments) | ||
this.state = { | ||
|
||
} | ||
} | ||
|
||
onClick() { | ||
} | ||
|
||
render(){ | ||
let { | ||
} = this.props | ||
let rootClassName = ['at-article'] | ||
let sizeClass = SIZE_CLASS[size] || '' | ||
let circleClass = circle? 'at-article--circle': '' | ||
|
||
rootClassName.push(`at-article--${sizeClass}`, circleClass) | ||
rootClassName = rootClassName.filter(str => str != '') | ||
console.log('=====', this.props.children) | ||
|
||
let {children} = this.props | ||
let letter; | ||
if (typeof children == 'string') { | ||
letter = children[0] | ||
} | ||
return ( | ||
<View className={rootClassName}> | ||
<View className="at-article__h1"></View> | ||
<View className="at-article__info"> | ||
<Text className="at-article__info-date"></Text><Text className="at-article__info-author"></Text> | ||
</View> | ||
<View className="at-article__content"> | ||
<View className="at-article__section"> | ||
<View className="at-article__h2"></View> | ||
|
||
<View className="at-article__h3"></View> | ||
<View className="at-article__paragraph"></View> | ||
<Image className="at-article__image" src="" /> | ||
|
||
<View className="at-article__h3"></View> | ||
<View className="at-article__paragraph"></View> | ||
<Image className="at-article__image" src="" /> | ||
</View> | ||
</View> | ||
|
||
|
||
</View> | ||
) | ||
} | ||
} | ||
|
||
Atarticle.defaultProps = { | ||
size: 'normal', | ||
circle: false, | ||
image: '', | ||
} | ||
|
||
Atarticle.propTypes = { | ||
size: PropTypes.oneOf(['large', 'normal', 'small']), | ||
circle: PropTypes.bool, | ||
image: PropTypes.string, | ||
}; |
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,33 @@ | ||
|
||
.at-avatar { | ||
height: 100px; | ||
width: 100px; | ||
overflow: hidden; | ||
box-shadow: 0 0 50px 0 rgba(0,0,0,0.05); | ||
border-radius: 8px; | ||
font-size: 40px; | ||
line-height: 100px; | ||
color: #fff; | ||
background: #D8D8D8; | ||
&__img { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
&--large { | ||
width: 120px; | ||
height: 120px; | ||
font-size: 48px; | ||
line-height: 120px; | ||
} | ||
&--small { | ||
height: 80px; | ||
width: 80px; | ||
font-size: 32px; | ||
line-height: 80px; | ||
} | ||
&--circle { | ||
border-radius: 100px; | ||
overflow: hidden; | ||
background-clip: border-box; | ||
} | ||
} |
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,67 @@ | ||
import Taro from "@tarojs/taro" | ||
import { View, Image, Text } from "@tarojs/components" | ||
import PropTypes from 'prop-types'; | ||
|
||
import './index.scss' | ||
|
||
const SIZE_CLASS = { | ||
large: 'large', | ||
normal: 'normal', | ||
small: 'small', | ||
} | ||
|
||
// const TYPE_CLASS = { | ||
// primary: 'primary', | ||
// } | ||
|
||
|
||
export default class AtAvatar extends Taro.Component { | ||
constructor() { | ||
super(...arguments) | ||
this.state = { | ||
|
||
} | ||
} | ||
|
||
onClick() { | ||
} | ||
|
||
render(){ | ||
let { | ||
size, | ||
circle, | ||
image, | ||
} = this.props | ||
let rootClassName = ['at-avatar'] | ||
let sizeClass = SIZE_CLASS[size] || '' | ||
let circleClass = circle? 'at-avatar--circle': '' | ||
|
||
rootClassName.push(`at-avatar--${sizeClass}`, circleClass) | ||
rootClassName = rootClassName.filter(str => str != '') | ||
console.log('=====', this.props.children) | ||
|
||
let {children} = this.props | ||
let letter; | ||
if (typeof children == 'string') { | ||
letter = children[0] | ||
} | ||
return ( | ||
<View className={rootClassName}> | ||
{letter ? <Text className="at-avatar__text">{letter}</Text>: <Image className="at-avatar__img" src={image} />} | ||
|
||
</View> | ||
) | ||
} | ||
} | ||
|
||
AtAvatar.defaultProps = { | ||
size: 'normal', | ||
circle: false, | ||
image: '', | ||
} | ||
|
||
AtAvatar.propTypes = { | ||
size: PropTypes.oneOf(['large', 'normal', 'small']), | ||
circle: PropTypes.bool, | ||
image: PropTypes.string, | ||
}; |
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,33 @@ | ||
|
||
.at-avatar { | ||
height: 100px; | ||
width: 100px; | ||
overflow: hidden; | ||
box-shadow: 0 0 50px 0 rgba(0,0,0,0.05); | ||
border-radius: 8px; | ||
font-size: 40px; | ||
line-height: 100px; | ||
color: #fff; | ||
background: #D8D8D8; | ||
&__img { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
&--large { | ||
width: 120px; | ||
height: 120px; | ||
font-size: 48px; | ||
line-height: 120px; | ||
} | ||
&--small { | ||
height: 80px; | ||
width: 80px; | ||
font-size: 32px; | ||
line-height: 80px; | ||
} | ||
&--circle { | ||
border-radius: 100px; | ||
overflow: hidden; | ||
background-clip: border-box; | ||
} | ||
} |
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,50 @@ | ||
|
||
import PropTypes from 'prop-types'; | ||
import Taro from "@tarojs/taro" | ||
import { View, Text } from "@tarojs/components" | ||
|
||
import './index.scss' | ||
|
||
|
||
export default class AtBadge extends Taro.Component { | ||
constructor() { | ||
super(...arguments) | ||
this.state = {} | ||
} | ||
|
||
formatValue(value, maxValue) { | ||
if (isNaN(value)) { | ||
return value | ||
} else { | ||
let numValue = +value | ||
return numValue > maxValue? `${maxValue}+`: numValue | ||
} | ||
} | ||
|
||
render(){ | ||
let { | ||
dot, | ||
value, | ||
maxValue, | ||
} = this.props | ||
let rootClassName = ['at-badge'] | ||
|
||
return ( | ||
<View className={rootClassName}> | ||
{this.props.children} | ||
{dot ? <View className="at-badge__dot"></View>: <View className="at-badge__num">{this.formatValue(value, maxValue)}</View>} | ||
</View> | ||
) | ||
} | ||
} | ||
|
||
AtBadge.defaultProps = { | ||
dot: false, | ||
value: '', | ||
maxValue: 99, | ||
} | ||
|
||
AtBadge.propTypes = { | ||
dot: PropTypes.bool, | ||
maxValue: PropTypes.number, | ||
}; |
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,35 @@ | ||
|
||
@import "../../style/mixins.scss"; | ||
|
||
.at-badge { | ||
position: relative; | ||
display: inline-block; | ||
font-size: 0; | ||
vertical-align: middle; | ||
&__dot { | ||
position: absolute; | ||
right: -10px; | ||
top: -10px; | ||
width: 20px; | ||
height: 20px; | ||
border-radius: 20px; | ||
overflow: hidden; | ||
background: #FF4949; | ||
box-shadow: 0 4px 8px 0 rgba(233,59,61,0.20); | ||
} | ||
&__num { | ||
font-size: 20px; | ||
color: #fff; | ||
height: 28px; | ||
line-height: 28px; | ||
position: absolute; | ||
right: 0; | ||
top: -14px; | ||
transform: translate(50%, 0); | ||
padding: 0 10px; | ||
border-radius: 20px 20px 20px 0; | ||
overflow: hidden; | ||
background: #FF4949; | ||
box-shadow: 0 4px 8px 0 rgba(233,59,61,0.20); | ||
} | ||
} |
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
Oops, something went wrong.