| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- import { Button, View, Text } from "@tarojs/components";
- import './Buttons.scss'
- import { ButtonType, ComponentStatus } from "../../utils/types";
- import { Button as RNButton } from 'react-native';
- /*
- export default function Buttons(props: { title: string, type?: ButtonType, status?: ComponentStatus,onClick?:()=>void,style?:any }) {
-
- const myStyle = props.status == ComponentStatus.disable ? { opacity: 0.4 } : {}
- return (
- <View style={{...myStyle}}>
- <Button className={props.type == ButtonType.outline ? 'outline_btn' : 'btn'} style={{...props.style}} onClick={props.onClick}>{props.title}</Button>
- </View>
- )
- }*/
- export default function Buttons(props: {
- title: string,
- type?: ButtonType,
- onClick: () => void,
- disabled?: boolean,
- lowLight?: boolean,
- openType?: string,
- btnStyle?: any,
- }) {
- function onClick() {
- if (props.disabled) return
- props.onClick()
- }
- var mainClass = 'elevated'
- var textClass = 'elevated_text'
- if (props.type == ButtonType.outline) {
- mainClass = 'outlined'
- textClass = 'outlined_text'
- return (
- <View className={mainClass} style={{ ...props.btnStyle,opacity:props.lowLight?0.4:1 }}>
- <Text
- onClick={onClick}
- style={{
- color: props.btnStyle.color,
- fontSize: props.btnStyle.fontSize
- }}>{props.title}</Text>
- </View>
- )
- }
- else {
- mainClass = 'puretext'
- textClass = 'puretext_text'
- }
- return (
- <View className={mainClass} style={{ ...props.btnStyle }}>
- <Text
- onClick={onClick}
- style={{
- color: props.btnStyle.color,
- fontSize: props.btnStyle.fontSize
- }}>{props.title}</Text>
- </View>
- // <View onClick={onClick}>
- // <Text
- // style={{
- // height: props.btnStyle.height,
- // lineHeight: props.btnStyle.height,
- // color: props.btnStyle.color,
- // fontSize: props.btnStyle.fontSize
- // }}>{props.title}</Text>
- // </View>
- )
- }
|