From 4d29bef67bf757f41765c738e0080c8cd4816604 Mon Sep 17 00:00:00 2001 From: DmitriyB Date: Fri, 12 Aug 2022 15:01:04 +0500 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B0=D0=BD=D0=B0=D0=BB=D0=BE=D0=B3=D0=B8=D1=87?= =?UTF-8?q?=D0=BD=D0=B0=D1=8F=20=D1=8D=D0=BC=D1=83=D0=BB=D1=8F=D1=86=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B8=20=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=B4=D0=B0=D1=87=D0=B8=20=D0=BA=D0=BE=D0=BD=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=BB=D1=8F,=20fix=20control=20button=20height=20i?= =?UTF-8?q?n=20mobile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobileAddPart/addPartUserItem.tsx | 72 ++++++++++++++++--- .../mainScreen/toolbar/buttonContainer.tsx | 14 ++-- src/components/mainScreen/toolbar/toolbar.css | 6 +- src/components/mainScreen/toolbar/toolbar.tsx | 5 ++ 4 files changed, 81 insertions(+), 16 deletions(-) diff --git a/src/components/mainScreen/mobileAddPart/addPartUserItem.tsx b/src/components/mainScreen/mobileAddPart/addPartUserItem.tsx index 3161ab1..2043af5 100644 --- a/src/components/mainScreen/mobileAddPart/addPartUserItem.tsx +++ b/src/components/mainScreen/mobileAddPart/addPartUserItem.tsx @@ -1,8 +1,9 @@ -import React from "react"; +import React, { useState } from "react"; import { ToolbarButton } from "../toolbar/toolbarButton"; import { TypeToolbarButtons } from "../toolbar/typeButtons"; import { BorderLine } from "./borderLine"; import { CaptionToolbarButtons } from "../toolbar/typeCaptionButtons"; +import { ControlButton } from "../toolbar/controlButton"; type TProps = { typeUser: TypeToolbarButtons @@ -12,6 +13,16 @@ type TProps = { } export const AddPartUserItem:React.FC = React.memo((props) => { + const controlStates = ['default', 'questing', 'return', 'questing'];// temp + const [currentControlState, setCurrentControlState] = useState(0); // temp + + // temp + function nextControlState() { + if(currentControlState + 1 < controlStates.length) + setCurrentControlState(currentControlState + 1); + else setCurrentControlState(0); + } + return
props?.onClickItem ? props?.onClickItem() : null}> = React.memo((props) => { caption='' isCaption={false} onClick={() => props?.onClickMicro ? props?.onClickMicro() : null} - /> - props?.onClickControl ? props?.onClickControl() : null } - /> + /> + { + // temp + currentControlState === 0 + ? nextControlState()} + state={"default"} + userType={'admin'} + /> + : currentControlState === 1 + ? <> + nextControlState()} + type={"no"} + caption={''} + isCaption={false} + size={"medium"} + /> + nextControlState()} + type={"yes"} + caption={''} + isCaption={false} + size={"medium"} + /> + + : currentControlState === 2 + ? nextControlState()} + state={"waiting"} + userType={'admin'} + /> + : currentControlState === 3 + ? <> + nextControlState()} + type={"no"} + caption={''} + isCaption={false} + size={"medium"} + /> + nextControlState()} + type={"yes"} + caption={''} + isCaption={false} + size={"medium"} + /> + + : null + }
: null } diff --git a/src/components/mainScreen/toolbar/buttonContainer.tsx b/src/components/mainScreen/toolbar/buttonContainer.tsx index 33738d2..302ae7e 100644 --- a/src/components/mainScreen/toolbar/buttonContainer.tsx +++ b/src/components/mainScreen/toolbar/buttonContainer.tsx @@ -15,15 +15,17 @@ type TProps = { active?: boolean, isSelected?: boolean }> + isOpenToolbar: boolean isBorderLineTop?: 'hide' | 'show' isBorderLineBottom?: 'hide' | 'show' } export const ButtonContainer:React.FC = React.memo((props) => { + const windowHeight = useContext(ContextWindowHeight); const [openedAddButtons, setOpenedAddButtons] = useState(''); const controlStates = ['default', 'questing', 'return', 'questing'];// temp const [currentControlState, setCurrentControlState] = useState(0); // temp - const windowHeight = useContext(ContextWindowHeight); + const typeUser = 'admin' // 'user' // temp // temp function nextControlState() { @@ -63,7 +65,7 @@ export const ButtonContainer:React.FC = React.memo((props) => { /> { button.type.includes('user') && windowHeight > 700 ? -
+
onClick()} @@ -86,7 +88,7 @@ export const ButtonContainer:React.FC = React.memo((props) => { ? nextControlState()} state={"default"} - userType={'admin'} + userType={typeUser} /> : currentControlState === 1 ? <> @@ -108,8 +110,8 @@ export const ButtonContainer:React.FC = React.memo((props) => { : currentControlState === 2 ? nextControlState()} - state={"return"} - userType={'admin'} + state={"waiting"} + userType={typeUser} /> : currentControlState === 3 ? <> @@ -136,7 +138,7 @@ export const ButtonContainer:React.FC = React.memo((props) => { } { button.type.includes('language') && windowHeight > 700 ? -
+
{onClick(); button.onClick()}} type={button.type} diff --git a/src/components/mainScreen/toolbar/toolbar.css b/src/components/mainScreen/toolbar/toolbar.css index 871452a..c4d4247 100644 --- a/src/components/mainScreen/toolbar/toolbar.css +++ b/src/components/mainScreen/toolbar/toolbar.css @@ -367,7 +367,7 @@ box-sizing: border-box; display: flex; width: 196px; - height: 44px; + height: 40px; border-radius: 50px; justify-content: center; align-items: center; @@ -446,4 +446,8 @@ .toolbar-button:active { opacity: .7; } + + .control-button { + height: 44px; + } } \ No newline at end of file diff --git a/src/components/mainScreen/toolbar/toolbar.tsx b/src/components/mainScreen/toolbar/toolbar.tsx index 2a45a0b..eb4f87d 100644 --- a/src/components/mainScreen/toolbar/toolbar.tsx +++ b/src/components/mainScreen/toolbar/toolbar.tsx @@ -48,6 +48,7 @@ export const Toolbar:React.FC = React.memo((props) => { isSelected: props?.isOpenUsersMobilePart } ]} + isOpenToolbar={props.isOpen} />
@@ -66,6 +67,7 @@ export const Toolbar:React.FC = React.memo((props) => { isCaption: false } ]} + isOpenToolbar={props.isOpen} /> {/* */} = React.memo((props) => { isCaption: true } ]} + isOpenToolbar={props.isOpen} />
@@ -140,6 +143,7 @@ export const Toolbar:React.FC = React.memo((props) => { isCaption: true } ]} + isOpenToolbar={props.isOpen} /> = React.memo((props) => { } ]} isBorderLineTop={"hide"} + isOpenToolbar={props.isOpen} /> {/*