From 77b3ac8369b75c21b954151316704b091425cef4 Mon Sep 17 00:00:00 2001 From: Tamara Date: Thu, 8 Dec 2022 03:21:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BE=D0=B3=D1=80=D0=B0=D0=BD=D0=B8=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B2=D0=B2=D0=BE=D0=B4=D0=B0=20?= =?UTF-8?q?=D0=BE=D1=82=D1=80=D0=B8=D1=86=D0=B0=D1=82=D0=B5=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D1=8B=D1=85=20=D1=87=D0=B8=D1=81=D0=B5=D0=BB=20=D0=B8=20?= =?UTF-8?q?=D0=BC=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=BF=D0=BE=20=D1=81=D1=82=D0=B8=D0=BB=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LoggedIn/Content/Discounts/index.tsx | 55 +++++++++---------- .../LoggedIn/Content/Promocode/index.tsx | 36 ++++++------ .../Content/Tariffs/DataGridElement/index.tsx | 12 +++- src/Components/Sections/index.tsx | 11 +--- src/theme.ts | 28 ++++++++++ 5 files changed, 85 insertions(+), 57 deletions(-) diff --git a/src/Components/LoggedIn/Content/Discounts/index.tsx b/src/Components/LoggedIn/Content/Discounts/index.tsx index 1f1553e..66923a1 100644 --- a/src/Components/LoggedIn/Content/Discounts/index.tsx +++ b/src/Components/LoggedIn/Content/Discounts/index.tsx @@ -217,11 +217,11 @@ const Discounts: React.FC = () => { const toTime = React.useRef(null); const toCapacity = React.useRef(null); - const cleraAddedMore = () => { - if (fieldAddedMore.current) { - fieldAddedMore.current.value = ""; - } - } + // const cleraAddedMore = () => { + // if (fieldAddedMore.current) { + // fieldAddedMore.current.value = ""; + // } + // } const checkFields = () => { if( fieldName.current != null @@ -268,6 +268,12 @@ const Discounts: React.FC = () => { discountsArraySet( discountsArray ); } + const PositiveInput = (event:any) => { + const numberInput = parseInt(event.target.value); + if(isNaN(numberInput) || numberInput < 0) {event.target.value = '0'} + } + + return ( @@ -285,33 +291,22 @@ const Discounts: React.FC = () => { СКИДКИ - - - Название: - + display: "flex", + flexDirection: "column", + justifyContent: "left", + alignItems: "left", + marginTop: "15px", + }} + > { height: "40px", fontWeight: "normal", color: theme.palette.grayDisabled.main, - marginTop: "75px" + marginTop: "75px", + paddingLeft: '10px', }}> Условия: @@ -400,6 +396,7 @@ const Discounts: React.FC = () => { color: theme.palette.secondary.main } }} inputRef={ fieldAddedMore } + onChange={PositiveInput} /> { InputLabelProps={{ style: { color: theme.palette.secondary.main - } }} + } }} inputRef={ basketMore } - onChange={ () => cleraAddedMore() } + onChange={ PositiveInput } /> { color: theme.palette.secondary.main } }} inputRef={ toTime } + onChange={ PositiveInput } /> { color: theme.palette.secondary.main } }} inputRef={ toCapacity } + onChange={PositiveInput} /> { alignItems: "left", marginTop: "15px", }}> - - Название: - + {/**/} + {/* Название:*/} + {/**/} { Дата действия: - + = ({ openModal }) => { setSelectedPromocode( codeNumber ); } + const PositiveInput = (event:any) => { + const numberInput = parseInt(event.target.value); + if(isNaN(numberInput) || numberInput < 0) {event.target.value = '0'} + } + const fieldAdded = React.useRef(null); const [ fieldAddedValue, setFieldAddedValue ] = React.useState(""); - const changeAdded = () => { + const changeAdded = (event:any) => { if( fieldAdded.current != null ) { if( fieldAdded.current.value != null ) { setFieldAddedValue( fieldAdded.current.value ); } + } + PositiveInput(event) }; const separator = (amount: number) => { @@ -296,6 +303,7 @@ console.log(amount) return discounts.map(e => `${(e*100).toFixed(2)}%`).join(' × ') + ` = ${(100 - discounts.reduce((a : number,cv : number) => a*(1-cv), 100)) .toFixed(2)}%`; } + return ( @@ -512,7 +520,7 @@ console.log(amount) color: theme.palette.secondary.main } }} inputRef={ fieldAdded } - onChange={ () => changeAdded() } + onChange={ changeAdded } /> diff --git a/src/Components/Sections/index.tsx b/src/Components/Sections/index.tsx index cc1ba8d..270452a 100644 --- a/src/Components/Sections/index.tsx +++ b/src/Components/Sections/index.tsx @@ -50,15 +50,8 @@ const Authorization: React.FC = () => { diff --git a/src/theme.ts b/src/theme.ts index 80d892a..53cdbf4 100644 --- a/src/theme.ts +++ b/src/theme.ts @@ -1,6 +1,12 @@ import { createTheme, PaletteColorOptions } from "@mui/material"; //import { createTheme } from "./types"; +declare module '@mui/material/Button' { + interface ButtonPropsVariantOverrides { + enter: true; + } +} + const fontFamily: string = "GilroyRegular"; const fontWeight: string = "600"; @@ -81,6 +87,28 @@ const theme = createTheme({ fontSize: 16 } }, + + components: { + MuiButton: { + variants: [ + { + props: { + variant: 'enter' }, + style: { + backgroundColor: "#26272c", + padding: '12px 48px', + "&:hover": { + backgroundColor: "#2f3339" + } + + }, + }, + ], + }, + }, + + + });