@procraft/widget-order 2.29.0 → 2.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CourseItem/FieldValues/index.js +13 -44
- package/dist/CourseItem/FieldValues/index.js.map +1 -1
- package/dist/CourseItem/FieldValues/interfaces.d.ts +4 -0
- package/dist/CourseItem/FieldValuesByType/index.js +12 -11
- package/dist/CourseItem/FieldValuesByType/index.js.map +1 -1
- package/dist/CourseItem/FieldValuesByType/interfaces.d.ts +4 -0
- package/dist/CourseItem/Materials/index.js +15 -5
- package/dist/CourseItem/Materials/index.js.map +1 -1
- package/dist/CourseItem/Materials/interfaces.d.ts +2 -0
- package/dist/CourseItem/OrderButton/index.js +17 -5
- package/dist/CourseItem/OrderButton/index.js.map +1 -1
- package/dist/CourseItem/OrderButton/interfaces.d.ts +5 -1
- package/dist/CourseItem/OrderButton/styles.js +2 -2
- package/dist/CourseItem/OrderButton/styles.js.map +1 -1
- package/dist/CourseItem/PlacesLeft/index.js +10 -8
- package/dist/CourseItem/PlacesLeft/index.js.map +1 -1
- package/dist/CourseItem/PlacesLeft/interfaces.d.ts +2 -0
- package/dist/CourseItem/Reviews/index.js +7 -6
- package/dist/CourseItem/Reviews/index.js.map +1 -1
- package/dist/CourseItem/Reviews/interfaces.d.ts +1 -0
- package/dist/CourseItem/Sales/Sale/index.js +16 -38
- package/dist/CourseItem/Sales/Sale/index.js.map +1 -1
- package/dist/CourseItem/Sales/Sale/interfaces.d.ts +4 -0
- package/dist/CourseItem/Sales/Sale/styles.d.ts +3 -1
- package/dist/CourseItem/Sales/Sale/styles.js +1 -0
- package/dist/CourseItem/Sales/Sale/styles.js.map +1 -1
- package/dist/CourseItem/Sales/index.js +11 -3
- package/dist/CourseItem/Sales/index.js.map +1 -1
- package/dist/CourseItem/Sales/interfaces.d.ts +4 -0
- package/dist/CourseItem/index.js +27 -15
- package/dist/CourseItem/index.js.map +1 -1
- package/dist/CourseItem/styles.js +0 -2
- package/dist/CourseItem/styles.js.map +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Container/styles.d.ts +1 -0
- package/dist/components/Container/styles.js +2 -0
- package/dist/components/Container/styles.js.map +1 -1
- package/dist/components/RadioGroup/index.js +3 -6
- package/dist/components/RadioGroup/index.js.map +1 -1
- package/dist/components/RadioGroup/interfaces.d.ts +2 -0
- package/dist/components/RadioGroup/styles.d.ts +2 -0
- package/dist/components/RadioGroup/styles.js +4 -3
- package/dist/components/RadioGroup/styles.js.map +1 -1
- package/dist/components/Typography/styles.js +1 -1
- package/dist/constants/colors.d.ts +6 -2
- package/dist/constants/colors.js +7 -3
- package/dist/constants/colors.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/CourseItem/FieldValues/index.tsx +52 -89
- package/src/CourseItem/FieldValues/interfaces.ts +4 -1
- package/src/CourseItem/FieldValuesByType/index.tsx +18 -4
- package/src/CourseItem/FieldValuesByType/interfaces.tsx +4 -0
- package/src/CourseItem/Materials/index.tsx +24 -5
- package/src/CourseItem/Materials/interfaces.ts +2 -0
- package/src/CourseItem/OrderButton/index.tsx +36 -6
- package/src/CourseItem/OrderButton/interfaces.ts +6 -3
- package/src/CourseItem/OrderButton/styles.ts +2 -2
- package/src/CourseItem/PlacesLeft/index.tsx +27 -17
- package/src/CourseItem/PlacesLeft/interfaces.ts +2 -0
- package/src/CourseItem/Reviews/index.tsx +14 -8
- package/src/CourseItem/Reviews/interfaces.ts +1 -2
- package/src/CourseItem/Sales/Sale/index.tsx +23 -45
- package/src/CourseItem/Sales/Sale/interfaces.ts +4 -2
- package/src/CourseItem/Sales/Sale/styles.ts +4 -1
- package/src/CourseItem/Sales/index.tsx +17 -2
- package/src/CourseItem/Sales/interfaces.ts +4 -4
- package/src/CourseItem/index.tsx +47 -14
- package/src/CourseItem/styles.ts +0 -2
- package/src/components/Button/index.tsx +2 -2
- package/src/components/Container/styles.ts +3 -0
- package/src/components/RadioGroup/index.tsx +6 -22
- package/src/components/RadioGroup/interfaces.ts +2 -0
- package/src/components/RadioGroup/styles.ts +9 -3
- package/src/components/Typography/styles.ts +1 -1
- package/src/constants/colors.ts +6 -2
|
@@ -2,13 +2,16 @@ import React, { useMemo } from 'react'
|
|
|
2
2
|
import NumberFormat from 'react-number-format'
|
|
3
3
|
import Button from '../../../components/Button'
|
|
4
4
|
import OldPrice from '../../../components/OldPrice'
|
|
5
|
+
import {
|
|
6
|
+
TITLE_BG_DEFAULT_COLOR,
|
|
7
|
+
TITLE_TEXT_DEFAULT_COLOR,
|
|
8
|
+
} from '../../../constants/colors'
|
|
5
9
|
import { useOrderLink } from '../../../hooks/useOrderLink'
|
|
6
|
-
// import { getCatalogItemData } from '../../../helpers/getCatalogItemData'
|
|
7
10
|
import { CatalogItemSale } from '../../../interfaces'
|
|
8
11
|
import { CatalogFieldValue } from '../../../modules/gql/generated/types'
|
|
12
|
+
import { getCurrencyPrefix, getCurrencySuffix } from '../../../utils'
|
|
9
13
|
import { SaleProps } from './interfaces'
|
|
10
14
|
import { SaleStyled } from './styles'
|
|
11
|
-
import {getCurrencyPrefix, getCurrencySuffix} from "../../../utils";
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* Считаем стоимость с учетом скидки
|
|
@@ -47,7 +50,10 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
47
50
|
sale,
|
|
48
51
|
orderLink,
|
|
49
52
|
fieldsValueSelected,
|
|
50
|
-
|
|
53
|
+
bgColor,
|
|
54
|
+
buttonColor,
|
|
55
|
+
buttonTextColor,
|
|
56
|
+
titleTextColor,
|
|
51
57
|
...other
|
|
52
58
|
}) => {
|
|
53
59
|
const {
|
|
@@ -76,12 +82,6 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
76
82
|
const items: JSX.Element[] = []
|
|
77
83
|
|
|
78
84
|
sale.benefitItems.forEach((n, index) => {
|
|
79
|
-
// console.log('items n', n)
|
|
80
|
-
|
|
81
|
-
// if (!n.fieldValues?.length) {
|
|
82
|
-
// return
|
|
83
|
-
// }
|
|
84
|
-
|
|
85
85
|
/**
|
|
86
86
|
* В каждом элементе есть свой набор fieldValues.
|
|
87
87
|
* Из этого набора надо выбрать те, что указаны в fieldsValueSelected.
|
|
@@ -93,20 +93,14 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
93
93
|
(i) => fieldsValueSelected.findIndex((f) => f.uid === i.uid) !== -1
|
|
94
94
|
) || []
|
|
95
95
|
|
|
96
|
-
// console.log('itemFieldValues', itemFieldValues)
|
|
97
|
-
|
|
98
96
|
/**
|
|
99
97
|
* Если не был получен ни один элемент, то берем дефолтные
|
|
100
98
|
*/
|
|
101
99
|
if (!itemFieldValues.length) {
|
|
102
100
|
const itemFieldValueDefault = n.fieldValues?.find(
|
|
103
101
|
(f) => f.isSelected === true
|
|
104
|
-
// f.isSelected === true &&
|
|
105
|
-
// (f.availableCount === null || (f.availableCount || 0) > 0)
|
|
106
102
|
)
|
|
107
103
|
|
|
108
|
-
// console.log('itemFieldValues 2', itemFieldValues)
|
|
109
|
-
|
|
110
104
|
if (itemFieldValueDefault) {
|
|
111
105
|
/**
|
|
112
106
|
* Если есть дефолтный элемент и в нем нет свободных мест, то пропускаем его
|
|
@@ -114,7 +108,6 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
114
108
|
if (itemFieldValueDefault.availableCount !== 0) {
|
|
115
109
|
itemFieldValues.push(itemFieldValueDefault)
|
|
116
110
|
}
|
|
117
|
-
// console.log('itemFieldValues 2.2', itemFieldValues)
|
|
118
111
|
} else {
|
|
119
112
|
/**
|
|
120
113
|
* Если не был найден ни один элемент, то берем дефолтный селектед и находим любой
|
|
@@ -138,8 +131,6 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
138
131
|
}
|
|
139
132
|
}
|
|
140
133
|
|
|
141
|
-
// console.log('itemFieldValues 3', itemFieldValues)
|
|
142
|
-
|
|
143
134
|
/**
|
|
144
135
|
* Если нет ни одного итогового филда, то пропускаем элемент
|
|
145
136
|
*/
|
|
@@ -176,14 +167,9 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
176
167
|
saleFieldsValueSelected.push(fieldValue)
|
|
177
168
|
})
|
|
178
169
|
|
|
179
|
-
const priceWithDiscount = calcPriceWithDiscount(
|
|
180
|
-
// n.unitPrice || n.unitPriceOriginal || 0,
|
|
181
|
-
price,
|
|
182
|
-
sale
|
|
183
|
-
)
|
|
170
|
+
const priceWithDiscount = calcPriceWithDiscount(price, sale)
|
|
184
171
|
|
|
185
172
|
totalPrice += priceWithDiscount
|
|
186
|
-
// totalPriceOriginal += n.unitPriceOriginal || n.unitPrice || 0
|
|
187
173
|
totalPriceOriginal += priceOrigin
|
|
188
174
|
|
|
189
175
|
items.push(
|
|
@@ -214,8 +200,6 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
214
200
|
}
|
|
215
201
|
}, [fieldsValueSelected, sale])
|
|
216
202
|
|
|
217
|
-
// console.log('saleFieldsValueSelected', saleFieldsValueSelected)
|
|
218
|
-
|
|
219
203
|
const uri = useOrderLink({
|
|
220
204
|
catalogItem,
|
|
221
205
|
orderLink,
|
|
@@ -239,23 +223,8 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
239
223
|
return null
|
|
240
224
|
}
|
|
241
225
|
|
|
242
|
-
/**
|
|
243
|
-
* Проверяем каждый элемент скидки, и если какой-либо не доступен для покупки,
|
|
244
|
-
* не выводим виджет
|
|
245
|
-
*/
|
|
246
|
-
// TODO Надо перепроверить и если надо, восстановить
|
|
247
|
-
// if (
|
|
248
|
-
// sale.benefitItems.find((n) => {
|
|
249
|
-
// const item = getCatalogItemData(n, course)
|
|
250
|
-
|
|
251
|
-
// return item?.available !== true
|
|
252
|
-
// })
|
|
253
|
-
// ) {
|
|
254
|
-
// return null
|
|
255
|
-
// }
|
|
256
|
-
|
|
257
226
|
return (
|
|
258
|
-
<SaleStyled {...other}>
|
|
227
|
+
<SaleStyled bgColor={bgColor} {...other}>
|
|
259
228
|
<div>
|
|
260
229
|
<svg
|
|
261
230
|
width="30"
|
|
@@ -271,7 +240,7 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
271
240
|
</svg>
|
|
272
241
|
</div>
|
|
273
242
|
<div className="content">
|
|
274
|
-
<p className="title">
|
|
243
|
+
<p style={{ color: titleTextColor }} className="title">
|
|
275
244
|
Дополнительно Скидка {sale.benefitAmount}
|
|
276
245
|
{sale.benefitUnit === 'Percent' ? `%` : `₽`}
|
|
277
246
|
</p>
|
|
@@ -283,9 +252,14 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
283
252
|
<OldPrice price={totalPriceOriginal} />
|
|
284
253
|
</div>
|
|
285
254
|
|
|
286
|
-
{/* <a href={`${orderLink}/${catalogItem.uid}?sale=${sale.id}`}> */}
|
|
287
255
|
<a href={uri.toString()}>
|
|
288
|
-
<Button
|
|
256
|
+
<Button
|
|
257
|
+
style={{
|
|
258
|
+
backgroundColor: buttonColor ?? TITLE_BG_DEFAULT_COLOR,
|
|
259
|
+
color: buttonTextColor ?? TITLE_TEXT_DEFAULT_COLOR,
|
|
260
|
+
}}
|
|
261
|
+
className="buy-link"
|
|
262
|
+
>
|
|
289
263
|
Купить за{' '}
|
|
290
264
|
<NumberFormat
|
|
291
265
|
value={totalPrice}
|
|
@@ -310,6 +284,10 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
310
284
|
totalPriceOriginal,
|
|
311
285
|
uri,
|
|
312
286
|
totalPrice,
|
|
287
|
+
bgColor,
|
|
288
|
+
buttonColor,
|
|
289
|
+
buttonTextColor,
|
|
290
|
+
titleTextColor,
|
|
313
291
|
])
|
|
314
292
|
}
|
|
315
293
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { CatalogItem, CatalogItemSale } from '../../../interfaces'
|
|
2
2
|
import { CatalogFieldValue } from '../../../modules/gql/generated/types'
|
|
3
|
-
// import { CourseFragment } from '../../../interfaces/CourseFragment'
|
|
4
3
|
|
|
5
4
|
export type SaleProps = {
|
|
6
5
|
catalogItem: CatalogItem
|
|
7
6
|
sale: CatalogItemSale
|
|
8
7
|
orderLink: string
|
|
9
|
-
|
|
8
|
+
bgColor?: string
|
|
9
|
+
buttonColor?: string
|
|
10
|
+
buttonTextColor?: string
|
|
11
|
+
titleTextColor?: string
|
|
10
12
|
fieldsValueSelected: CatalogFieldValue[]
|
|
11
13
|
}
|
|
@@ -2,7 +2,10 @@ import styled from 'styled-components'
|
|
|
2
2
|
import { ButtonStyled } from '../../../components/Button/styles'
|
|
3
3
|
import { OldPriceStyled } from '../../../components/OldPrice/styles'
|
|
4
4
|
|
|
5
|
-
export const SaleStyled = styled.div
|
|
5
|
+
export const SaleStyled = styled.div<{
|
|
6
|
+
bgColor?: string
|
|
7
|
+
}>`
|
|
8
|
+
background-color: ${({ bgColor }) => bgColor ?? '#FFFFFF'};
|
|
6
9
|
border: 1px solid #dae7f4;
|
|
7
10
|
border-radius: 16px;
|
|
8
11
|
width: 100%;
|
|
@@ -6,6 +6,10 @@ const Sales: React.FC<SalesProps> = ({
|
|
|
6
6
|
catalogItem,
|
|
7
7
|
orderLink,
|
|
8
8
|
fieldsValueSelected,
|
|
9
|
+
bgColor,
|
|
10
|
+
buttonColor,
|
|
11
|
+
buttonTextColor,
|
|
12
|
+
titleTextColor,
|
|
9
13
|
}) => {
|
|
10
14
|
return useMemo(() => {
|
|
11
15
|
if (!catalogItem.sales?.length) {
|
|
@@ -21,12 +25,23 @@ const Sales: React.FC<SalesProps> = ({
|
|
|
21
25
|
sale={n}
|
|
22
26
|
orderLink={orderLink}
|
|
23
27
|
fieldsValueSelected={fieldsValueSelected}
|
|
24
|
-
|
|
28
|
+
bgColor={bgColor}
|
|
29
|
+
buttonColor={buttonColor}
|
|
30
|
+
buttonTextColor={buttonTextColor}
|
|
31
|
+
titleTextColor={titleTextColor}
|
|
25
32
|
/>
|
|
26
33
|
))}
|
|
27
34
|
</>
|
|
28
35
|
)
|
|
29
|
-
}, [
|
|
36
|
+
}, [
|
|
37
|
+
catalogItem,
|
|
38
|
+
orderLink,
|
|
39
|
+
fieldsValueSelected,
|
|
40
|
+
bgColor,
|
|
41
|
+
buttonColor,
|
|
42
|
+
buttonTextColor,
|
|
43
|
+
titleTextColor,
|
|
44
|
+
])
|
|
30
45
|
}
|
|
31
46
|
|
|
32
47
|
export default Sales
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
// import { WidgetOrderCourseItem } from '../../interfaces'
|
|
2
1
|
import {
|
|
3
2
|
CatalogFieldValue,
|
|
4
3
|
OrderCatalogItemFragment,
|
|
5
4
|
} from '../../modules/gql/generated/types'
|
|
6
|
-
// import { SaleProps } from './Sale/interfaces'
|
|
7
5
|
|
|
8
6
|
export type SalesProps = {
|
|
9
|
-
// item: WidgetOrderCourseItem
|
|
10
7
|
catalogItem: OrderCatalogItemFragment
|
|
11
8
|
orderLink: string
|
|
12
|
-
|
|
9
|
+
bgColor?: string
|
|
10
|
+
buttonColor?: string
|
|
13
11
|
fieldsValueSelected: CatalogFieldValue[]
|
|
12
|
+
buttonTextColor?: string
|
|
13
|
+
titleTextColor?: string
|
|
14
14
|
}
|
package/src/CourseItem/index.tsx
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useState } from 'react'
|
|
2
2
|
import Typography from '../components/Typography'
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
COLORED_TEXT_DEFAULT_COLOR,
|
|
5
|
+
CONTENT_BG_DEFAULT_COLOR,
|
|
6
|
+
CONTENT_TEXT_DEFAULT_COLOR,
|
|
7
|
+
EXTRA_BG_DEFAULT_COLOR,
|
|
5
8
|
MAIN_BG_DEFAULT_COLOR,
|
|
6
|
-
|
|
9
|
+
TITLE_BG_DEFAULT_COLOR,
|
|
10
|
+
TITLE_TEXT_DEFAULT_COLOR,
|
|
7
11
|
} from '../constants/colors'
|
|
8
12
|
import { usePrices } from '../hooks/usePrices'
|
|
9
13
|
import {
|
|
@@ -29,6 +33,16 @@ const CourseItem: React.FC<CourseItemComponentProps> = (props) => {
|
|
|
29
33
|
style,
|
|
30
34
|
} = props
|
|
31
35
|
|
|
36
|
+
const colors = style?.['colors']
|
|
37
|
+
|
|
38
|
+
const titleBgColor = colors?.['titleBg'] ?? TITLE_BG_DEFAULT_COLOR
|
|
39
|
+
const mainBgColor = colors?.['mainBg'] ?? MAIN_BG_DEFAULT_COLOR
|
|
40
|
+
const contentBgColor = colors?.['contentBg'] ?? CONTENT_BG_DEFAULT_COLOR
|
|
41
|
+
const extraBgColor = colors?.['extraBg'] ?? EXTRA_BG_DEFAULT_COLOR
|
|
42
|
+
const titleTextColor = colors?.['titleText'] ?? TITLE_TEXT_DEFAULT_COLOR
|
|
43
|
+
const contentTextColor = colors?.['contentText'] ?? CONTENT_TEXT_DEFAULT_COLOR
|
|
44
|
+
const coloredTextColor = colors?.['coloredText'] ?? COLORED_TEXT_DEFAULT_COLOR
|
|
45
|
+
|
|
32
46
|
/**
|
|
33
47
|
* Текущий элемент
|
|
34
48
|
*/
|
|
@@ -56,8 +70,6 @@ const CourseItem: React.FC<CourseItemComponentProps> = (props) => {
|
|
|
56
70
|
item.course?.tariffId,
|
|
57
71
|
])
|
|
58
72
|
|
|
59
|
-
// console.log('useEffect fieldsValueSelected', [...fieldsValueSelected]);
|
|
60
|
-
|
|
61
73
|
const fieldValuesInfo = usePrices({
|
|
62
74
|
fieldValues: item.fieldValues || [],
|
|
63
75
|
fieldsValueSelected,
|
|
@@ -98,12 +110,23 @@ const CourseItem: React.FC<CourseItemComponentProps> = (props) => {
|
|
|
98
110
|
fieldsValueSelectedSetter={fieldsValueSelectedSetter}
|
|
99
111
|
fieldValuesInfo={fieldValuesInfo}
|
|
100
112
|
type={type}
|
|
113
|
+
checkedBgColor={titleBgColor}
|
|
114
|
+
checkedTextColor={titleTextColor}
|
|
115
|
+
placesLeftBgColor={extraBgColor}
|
|
116
|
+
placesLeftTextColor={coloredTextColor}
|
|
101
117
|
/>
|
|
102
118
|
)
|
|
103
119
|
})
|
|
104
120
|
|
|
105
121
|
return content
|
|
106
|
-
}, [
|
|
122
|
+
}, [
|
|
123
|
+
fieldValuesInfo,
|
|
124
|
+
fieldsValueSelected,
|
|
125
|
+
titleBgColor,
|
|
126
|
+
titleTextColor,
|
|
127
|
+
coloredTextColor,
|
|
128
|
+
extraBgColor,
|
|
129
|
+
])
|
|
107
130
|
|
|
108
131
|
return useMemo(() => {
|
|
109
132
|
if (!item) {
|
|
@@ -128,15 +151,15 @@ const CourseItem: React.FC<CourseItemComponentProps> = (props) => {
|
|
|
128
151
|
break
|
|
129
152
|
}
|
|
130
153
|
|
|
131
|
-
const titleColor = style?.['titleColor'] ?? TITLE_DEFAULT_COLOR
|
|
132
|
-
const mainBgColor = style?.['mainBgColor'] ?? MAIN_BG_DEFAULT_COLOR
|
|
133
|
-
const infoBgColor = style?.['infoBgColor'] ?? INFO_BG_DEFAULT_COLOR
|
|
134
|
-
|
|
135
154
|
return (
|
|
136
155
|
<>
|
|
137
156
|
<WidgetStyled style={{ backgroundColor: mainBgColor }}>
|
|
138
|
-
<NavigationStyled style={{ backgroundColor:
|
|
139
|
-
<Typography>
|
|
157
|
+
<NavigationStyled style={{ backgroundColor: titleBgColor }}>
|
|
158
|
+
<Typography>
|
|
159
|
+
<span style={{ color: titleTextColor }}>
|
|
160
|
+
{flowBehaviourTitle}
|
|
161
|
+
</span>
|
|
162
|
+
</Typography>
|
|
140
163
|
</NavigationStyled>
|
|
141
164
|
|
|
142
165
|
<BoxStyled>
|
|
@@ -147,12 +170,14 @@ const CourseItem: React.FC<CourseItemComponentProps> = (props) => {
|
|
|
147
170
|
</Typography>
|
|
148
171
|
|
|
149
172
|
{ratesVisible && item.reviewsCount ? (
|
|
150
|
-
<Reviews reviewsCount={item.reviewsCount} item={item} />
|
|
173
|
+
<Reviews textColor={coloredTextColor} reviewsCount={item.reviewsCount} item={item} />
|
|
151
174
|
) : null}
|
|
152
175
|
|
|
153
176
|
{tariff ? (
|
|
154
177
|
<Materials
|
|
155
|
-
backgroundColor={
|
|
178
|
+
backgroundColor={contentBgColor}
|
|
179
|
+
textColor={contentTextColor}
|
|
180
|
+
linkColor={coloredTextColor}
|
|
156
181
|
benefits={tariff.marketingBenefits}
|
|
157
182
|
extraBenefits={extraBenefits}
|
|
158
183
|
limit={materialsLimit}
|
|
@@ -168,7 +193,11 @@ const CourseItem: React.FC<CourseItemComponentProps> = (props) => {
|
|
|
168
193
|
orderLink={orderLink}
|
|
169
194
|
course={course}
|
|
170
195
|
fieldsValueSelected={fieldsValueSelected}
|
|
171
|
-
|
|
196
|
+
buttonBgColor={titleBgColor}
|
|
197
|
+
buttonTextColor={titleTextColor}
|
|
198
|
+
containerBgColor={contentBgColor}
|
|
199
|
+
dateTextColor={coloredTextColor}
|
|
200
|
+
selectedDateTextColor={titleTextColor}
|
|
172
201
|
/>
|
|
173
202
|
</BoxStyled>
|
|
174
203
|
</WidgetStyled>
|
|
@@ -177,6 +206,10 @@ const CourseItem: React.FC<CourseItemComponentProps> = (props) => {
|
|
|
177
206
|
catalogItem={item}
|
|
178
207
|
orderLink={orderLink}
|
|
179
208
|
fieldsValueSelected={fieldsValueSelected}
|
|
209
|
+
bgColor={mainBgColor}
|
|
210
|
+
buttonColor={titleBgColor}
|
|
211
|
+
buttonTextColor={titleTextColor}
|
|
212
|
+
titleTextColor={coloredTextColor}
|
|
180
213
|
/>
|
|
181
214
|
</>
|
|
182
215
|
)
|
package/src/CourseItem/styles.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { TITLE_BG_DEFAULT_COLOR } from '../../constants/colors'
|
|
3
3
|
import { ButtonProps } from './interfaces'
|
|
4
4
|
import { ButtonStyled } from './styles'
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ const Button: React.FC<ButtonProps> = (props) => {
|
|
|
7
7
|
return (
|
|
8
8
|
<ButtonStyled
|
|
9
9
|
style={{
|
|
10
|
-
backgroundColor: props.backgroundColor ??
|
|
10
|
+
backgroundColor: props.backgroundColor ?? TITLE_BG_DEFAULT_COLOR,
|
|
11
11
|
}}
|
|
12
12
|
{...props}
|
|
13
13
|
/>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import styled from 'styled-components'
|
|
2
|
+
import { CONTENT_BG_DEFAULT_COLOR } from '../../constants/colors'
|
|
2
3
|
|
|
3
4
|
export type ContainerStyledProps = {
|
|
4
5
|
variant?: 'transparent' | 'white'
|
|
6
|
+
bgColor?: string
|
|
5
7
|
}
|
|
6
8
|
|
|
7
9
|
export const ContainerStyled = styled.div<ContainerStyledProps>`
|
|
8
10
|
background: ${({ variant }) => variant || 'transparent'};
|
|
11
|
+
background-color: ${({ bgColor }) => bgColor ?? CONTENT_BG_DEFAULT_COLOR};
|
|
9
12
|
border-radius: 8px;
|
|
10
13
|
padding: 10px;
|
|
11
14
|
width: 100%;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from 'react'
|
|
2
|
-
import { RadioGroupRowStyled, RadioGroupStyled } from './styles'
|
|
3
2
|
import { RadioGroupProps } from './interfaces'
|
|
3
|
+
import { RadioGroupRowStyled, RadioGroupStyled } from './styles'
|
|
4
4
|
|
|
5
5
|
export * from './interfaces'
|
|
6
6
|
|
|
@@ -11,11 +11,10 @@ export const RadioGroup: React.FC<RadioGroupProps> = ({
|
|
|
11
11
|
items,
|
|
12
12
|
value,
|
|
13
13
|
onChangeIndex,
|
|
14
|
+
checkedBgColor,
|
|
15
|
+
checkedTextColor,
|
|
14
16
|
...other
|
|
15
17
|
}) => {
|
|
16
|
-
// console.log('RadioGroup items', items);
|
|
17
|
-
// console.log('RadioGroup value', value);
|
|
18
|
-
|
|
19
18
|
/**
|
|
20
19
|
* Это просто заглушка, так как на клик изменения навешаны
|
|
21
20
|
*/
|
|
@@ -27,7 +26,6 @@ export const RadioGroup: React.FC<RadioGroupProps> = ({
|
|
|
27
26
|
(event: React.MouseEvent<HTMLDivElement>) => {
|
|
28
27
|
const value = event.currentTarget.dataset.value
|
|
29
28
|
|
|
30
|
-
// value && tariffIdSetter(parseInt(value))
|
|
31
29
|
onChangeIndex(value)
|
|
32
30
|
},
|
|
33
31
|
[onChangeIndex]
|
|
@@ -50,29 +48,15 @@ export const RadioGroup: React.FC<RadioGroupProps> = ({
|
|
|
50
48
|
data-value={n.uid}
|
|
51
49
|
onClick={onRowClick}
|
|
52
50
|
checked={checked}
|
|
51
|
+
checkedBgColor={checkedBgColor}
|
|
52
|
+
checkedTextColor={checkedTextColor}
|
|
53
53
|
>
|
|
54
54
|
<input type="radio" checked={checked} onChange={onChange} />{' '}
|
|
55
55
|
{n.label}
|
|
56
|
-
{/* <Typography
|
|
57
|
-
variant="grey-sm"
|
|
58
|
-
component="label"
|
|
59
|
-
className="altItemText"
|
|
60
|
-
>
|
|
61
|
-
{n.course?.prolongationDays
|
|
62
|
-
? `Продление на ${n.course?.prolongationDays} дней`
|
|
63
|
-
: n.name}{' '}
|
|
64
|
-
-{' '}
|
|
65
|
-
<NumberFormat
|
|
66
|
-
value={n.unitPrice}
|
|
67
|
-
displayType="text"
|
|
68
|
-
thousandSeparator={' '}
|
|
69
|
-
/>{' '}
|
|
70
|
-
₽
|
|
71
|
-
</Typography> */}
|
|
72
56
|
</RadioGroupRowStyled>
|
|
73
57
|
)
|
|
74
58
|
})}
|
|
75
59
|
</RadioGroupStyled>
|
|
76
60
|
)
|
|
77
|
-
}, [items, onChange, onRowClick, other, value])
|
|
61
|
+
}, [items, onChange, onRowClick, other, value, checkedBgColor])
|
|
78
62
|
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components'
|
|
2
|
+
import {
|
|
3
|
+
TITLE_BG_DEFAULT_COLOR,
|
|
4
|
+
TITLE_TEXT_DEFAULT_COLOR,
|
|
5
|
+
} from '../../constants/colors'
|
|
2
6
|
import { WidgetOrderStyled } from '../../styles'
|
|
3
7
|
|
|
4
8
|
export const RadioGroupRowStyled = styled.div<{
|
|
5
9
|
checked: boolean
|
|
10
|
+
checkedBgColor?: string
|
|
11
|
+
checkedTextColor?: string
|
|
6
12
|
}>`
|
|
7
13
|
/*
|
|
8
14
|
Добавляем вложенность для жесткости стилей
|
|
@@ -33,14 +39,14 @@ export const RadioGroupRowStyled = styled.div<{
|
|
|
33
39
|
/*
|
|
34
40
|
JS-логика не работает во вложенности WidgetOrderStyled &
|
|
35
41
|
*/
|
|
36
|
-
${({ checked }) => {
|
|
42
|
+
${({ checked, checkedBgColor, checkedTextColor }) => {
|
|
37
43
|
if (checked) {
|
|
38
44
|
return css`
|
|
39
|
-
background:
|
|
45
|
+
background-color: ${checkedBgColor ?? TITLE_BG_DEFAULT_COLOR};
|
|
40
46
|
border-radius: 5px;
|
|
41
47
|
|
|
42
48
|
label {
|
|
43
|
-
color:
|
|
49
|
+
color: ${checkedTextColor ?? TITLE_TEXT_DEFAULT_COLOR};
|
|
44
50
|
}
|
|
45
51
|
`
|
|
46
52
|
}
|
package/src/constants/colors.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const TITLE_BG_DEFAULT_COLOR = '#233D78'
|
|
2
2
|
export const MAIN_BG_DEFAULT_COLOR = '#F1F5F9'
|
|
3
|
-
export const
|
|
3
|
+
export const CONTENT_BG_DEFAULT_COLOR = '#FFFFFF'
|
|
4
|
+
export const EXTRA_BG_DEFAULT_COLOR = '#233D78'
|
|
5
|
+
export const TITLE_TEXT_DEFAULT_COLOR = '#FFFFFF'
|
|
6
|
+
export const CONTENT_TEXT_DEFAULT_COLOR = '#1D3247'
|
|
7
|
+
export const COLORED_TEXT_DEFAULT_COLOR = '#233d78'
|