| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- import Buttons from "@/components/basic/Buttons"
- import { ButtonType } from "@/utils/types"
- import { View, Text } from "@tarojs/components"
- import { useState } from "react"
- import PostBtn from "./PostBtn"
- import './SpecBtns.scss'
- import Taro from "@tarojs/taro"
- import { useTranslation } from "react-i18next"
- import { ColorType } from "@/context/themes/color"
- export const rpxToPx = (n: number) => {
- var rate = Taro.getSystemInfoSync().windowWidth / 750;
- return n * rate;
- }
- export const StartFastBtn = (props: { onClick: Function, isLoading?: boolean }) => {
- const { t } = useTranslation()
- return (
- <PostBtn title={t('feature.track_time_duration.console.fast_start')} type={ButtonType.elevated}
- onClick={() => { props.onClick() }}
- btnStyle={{
- height: rpxToPx(100),
- borderRadius: rpxToPx(50),
- backgroundColor: global.fastColor ? global.fastColor : ColorType.fast,
- width: rpxToPx(320),
- // paddingLeft: 40,
- // paddingRight: 40,
- color: 'black',
- fontSize: 20,
- fontWeight: 'bold',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- // lineHeight:20
- }} />
- )
- }
- export const StartSleepBtn = (props: { onClick: Function, lowLight?: boolean, isLoading?: boolean }) => {
- const { t } = useTranslation()
- return (
- <PostBtn title={t('feature.track_time_duration.console.sleep_start')} type={ButtonType.elevated}
- onClick={() => { props.onClick() }}
- lowLight={props.lowLight ? props.lowLight : false}
- btnStyle={{
- height: rpxToPx(100),
- borderRadius: rpxToPx(50),
- backgroundColor: global.sleepColor ? global.sleepColor : ColorType.sleep,
- width: rpxToPx(320),
- // paddingLeft: 40,
- // paddingRight: 40,
- color: 'black',
- fontWeight: 'bold',
- fontSize: 20,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- // lineHeight:20
- }}
- />
- )
- }
- export const EndSleepBtn = (props: { onClick: Function, lowLight?: boolean, isLoading?: boolean }) => {
- const { t } = useTranslation()
- return (
- <PostBtn title={t('feature.track_time_duration.console.sleep_end')} type={ButtonType.outline}
- onClick={() => { props.onClick() }}
- lowLight={props.lowLight ? props.lowLight : false}
- lightLoading={true}
- btnStyle={{
- height: rpxToPx(100),
- borderRadius: rpxToPx(50),
- borderColor: global.sleepColor ? global.sleepColor : ColorType.sleep,
- borderWidth: 2,
- borderStyle: 'solid',
- width: rpxToPx(320),
- // paddingLeft: 40,
- // paddingRight: 40,
- color: global.sleepColor ? global.sleepColor : ColorType.sleep,
- fontWeight: 'bold',
- fontSize: 20,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- // lineHeight:20
- }}
- />
- )
- }
- export const EndFastBtn = (props: { onClick: Function, lowLight?: boolean, isLoading?: boolean }) => {
- const { t } = useTranslation()
- return (
- <PostBtn title={t('feature.track_time_duration.console.fast_end')} type={ButtonType.outline}
- onClick={() => { props.onClick() }}
- lowLight={props.lowLight ? props.lowLight : false}
- lightLoading={true}
- btnStyle={{
- height: rpxToPx(100),
- borderRadius: rpxToPx(50),
- borderColor: global.fastColor ? global.fastColor : ColorType.fast,
- borderWidth: 2,
- borderStyle: 'solid',
- width: rpxToPx(320),
- // paddingLeft: 40,
- // paddingRight: 40,
- color: global.fastColor ? global.fastColor : ColorType.fast,
- fontSize: 20,
- fontWeight: 'bold',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- // lineHeight:20
- }}
- />
- )
- }
- export const SetScheduleBtn = (props: { onClick: Function, title: string, isFast?: boolean, lowLight?: boolean, disable?: boolean }) => {
- return (
- <Buttons title={props.title} type={ButtonType.elevated}
- onClick={() => { props.onClick() }}
- lowLight={props.lowLight ? props.lowLight : false}
- disabled={props.disable}
- btnStyle={{
- height: 50,
- width: 300,
- boxSizing: 'border-box',
- borderRadius: 25,
- backgroundColor: props.isFast ? global.fastColor ? global.fastColor : ColorType.fast : global.sleepColor ? global.sleepColor : ColorType.sleep,
- paddingLeft: 40,
- paddingRight: 40,
- color: 'black',
- fontSize: 20,
- fontWeight: 'bold',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- }}
- />
- )
- }
- export const ChooseScenarioBtn = (props: { onClick: Function, title: string, background: string }) => {
- return (
- <Buttons title={props.title} type={ButtonType.elevated}
- onClick={() => { props.onClick() }}
- btnStyle={{
- height: 50,
- width: 300,
- boxSizing: 'border-box',
- borderRadius: 25,
- backgroundColor: props.background,
- paddingLeft: 40,
- paddingRight: 40,
- color: 'black',
- fontSize: 20,
- fontWeight: 'bold',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- }}
- />
- )
- }
- export const RecordMetricBtn = (props: { onClick: Function, title: string, themeColor: string, isDisable?: boolean }) => {
- return (
- <PostBtn title={props.title} type={ButtonType.elevated}
- onClick={() => { props.onClick() }}
- lowLight={props.isDisable}
- btnStyle={{
- height: 42,
- // width: 100,
- boxSizing: 'border-box',
- borderRadius: 21,
- backgroundColor: props.themeColor,
- color: 'black',
- fontSize: 20,
- fontWeight: 'bold',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- }}
- />
- )
- }
|