-
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
10 changed files
with
236 additions
and
6 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,8 +1,51 @@ | ||
import Taro from "@tarojs/taro" | ||
import { Button } from "@tarojs/components" | ||
import { View } from "@tarojs/components" | ||
|
||
import './index.scss' | ||
|
||
const SIZE_CLASS = { | ||
normal: 'normal', | ||
large: 'large', | ||
small: 'small', | ||
} | ||
|
||
const TYPE_CLASS = { | ||
primary: 'primary', | ||
} | ||
|
||
|
||
export default class AtButton extends Taro.Component { | ||
constructor() { | ||
super(...arguments) | ||
this.state = { | ||
|
||
} | ||
} | ||
|
||
onClick() { | ||
console.log('ddasddas') | ||
} | ||
|
||
render(){ | ||
return <Button className='at_button'>AtButton</Button> | ||
let { | ||
size = 'normal', | ||
type = 'primary', | ||
icon = '', | ||
loading = false, | ||
disabled = false, | ||
} = this.props | ||
let rootClassName = ['at-button'] | ||
let sizeClass = SIZE_CLASS[size] || '' | ||
let disabledClass = disabled? 'at-button--disabled': '' | ||
let typeClass = TYPE_CLASS[type]? `at-button--${type}`: '' | ||
|
||
rootClassName.push(`at-button--${sizeClass}`, disabledClass, typeClass) | ||
rootClassName = rootClassName.filter(str => str != '') | ||
console.log(this.props, this.state) | ||
return ( | ||
<View className={rootClassName} onClick={this.onClick}> | ||
测试按钮 | ||
</View> | ||
) | ||
} | ||
} |
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,27 @@ | ||
|
||
.at-button { | ||
width: 710px; | ||
height: 92px; | ||
line-height: 92px; | ||
text-align: center; | ||
border-radius: 8px; | ||
font-size: 32px; | ||
margin: 0 auto; | ||
|
||
border: 2px solid #6190E8; | ||
background-color: #fff; | ||
color: #6190E8; | ||
box-sizing: border-box; | ||
&--active { | ||
opacity: .8; | ||
} | ||
&--disabled { | ||
opacity: .5; | ||
} | ||
&--primary { | ||
background-color: rgba(92, 137, 228, 1); | ||
color: #fff; | ||
border: none; | ||
|
||
} | ||
} |
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,27 @@ | ||
import Taro from '@tarojs/taro' | ||
import { View } from '@tarojs/components' | ||
|
||
import './index.scss' | ||
|
||
export default class AtIcon extends Taro.Component { | ||
constructor() { | ||
super(...arguments) | ||
} | ||
|
||
render() { | ||
let { value, size = 24, color = '#000'} = this.props | ||
|
||
const rootStyle = { | ||
// width: `${+size}px`, | ||
// height: `${+size}px`, | ||
fontSize: `${size}px`, | ||
color, | ||
} | ||
|
||
let rootClassName = ['at-icon', `at-icon-${value}`] | ||
|
||
return ( | ||
<View className={rootClassName} style={rootStyle}></View> | ||
) | ||
} | ||
} |
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,31 @@ | ||
|
||
|
||
@font-face { | ||
font-family: 'fontello'; | ||
src: url('https://wq.360buyimg.com/data/ppms/others/fontello.ttf') format('truetype'); | ||
font-weight: normal; | ||
font-style: normal; | ||
} | ||
.at-icon { | ||
display: inline-block; | ||
font-size: 24px; | ||
color: #000; | ||
&::after { | ||
font-family: fontello; | ||
color: currentColor; | ||
text-transform: none; | ||
} | ||
} | ||
|
||
.at-icon-arrow-left { | ||
&::after { | ||
content: '\e801'; | ||
} | ||
} | ||
|
||
.at-icon-arrow-down-left { | ||
&::after { | ||
content: '\e800'; | ||
} | ||
} | ||
|
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,45 @@ | ||
import Taro from '@tarojs/taro' | ||
import { View, Text } from '@tarojs/components' | ||
|
||
import AtButton from '../../../components/button/index' | ||
|
||
import './index.scss' | ||
|
||
export default class ButtonPage extends Taro.Component { | ||
config = { | ||
navigationBarTitleText: 'Button Page' | ||
} | ||
|
||
constructor() { | ||
super(...arguments) | ||
this.state = { | ||
// icons: [ | ||
// 'arrow-left', | ||
// 'arrow-down-left', | ||
// ] | ||
} | ||
} | ||
|
||
render() { | ||
// let {icons} = this.state | ||
return ( | ||
<View className='page'> | ||
<View className='example'> | ||
<AtButton>测试按钮</AtButton> | ||
</View> | ||
<View className='example'> | ||
<AtButton>测试按钮</AtButton> | ||
</View> | ||
<View className='example'> | ||
<AtButton disabled>测试按钮</AtButton> | ||
</View> | ||
<View className='example'> | ||
<AtButton type="secondary">测试按钮</AtButton> | ||
</View> | ||
<View className='example'> | ||
<AtButton type="secondary" disabled>测试按钮</AtButton> | ||
</View> | ||
</View> | ||
) | ||
} | ||
} |
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,10 @@ | ||
@import "../../../style/variables"; | ||
|
||
.page { | ||
background-color: #fff; | ||
} | ||
|
||
|
||
.example { | ||
margin-bottom: 15px; | ||
} |
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,39 @@ | ||
import Taro from '@tarojs/taro' | ||
import { View, Text } from '@tarojs/components' | ||
|
||
import AtIcon from '../../../components/icon/index' | ||
|
||
import './index.scss' | ||
|
||
export default class IconPage extends Taro.Component { | ||
config = { | ||
navigationBarTitleText: 'Icon Page' | ||
} | ||
|
||
constructor() { | ||
super(...arguments) | ||
this.state = { | ||
icons: [ | ||
'arrow-left', | ||
'arrow-down-left', | ||
] | ||
} | ||
} | ||
|
||
render() { | ||
let {icons} = this.state | ||
return ( | ||
<View className='page'> | ||
<View className='example'> | ||
{icons.map((icon) => { | ||
return ( | ||
<AtIcon value={icon} color='#f00' size={30}> | ||
</AtIcon> | ||
) | ||
})} | ||
|
||
</View> | ||
</View> | ||
) | ||
} | ||
} |
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,9 @@ | ||
@import "../../../style/variables"; | ||
|
||
.page { | ||
background-color: #fff; | ||
} | ||
|
||
.at-icon { | ||
margin: 0 10px; | ||
} |