@bytebrand/fe-ui-core 4.8.48 → 4.8.50

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.
Files changed (189) hide show
  1. package/.husky/pre-push +4 -0
  2. package/.storybook/addons.js +4 -0
  3. package/.storybook/config.js +64 -0
  4. package/.storybook/postcss.config.js +6 -0
  5. package/.storybook/preview-head.html +10 -0
  6. package/.storybook/webpack.config.js +130 -0
  7. package/__tests__/components/Checkout/OrderOverviewItem/OrderOverviewItem.test.tsx +42 -0
  8. package/__tests__/components/Checkout/PaymentTypeCard/PaymentTypeCard.test.tsx +50 -0
  9. package/__tests__/components/Checkout/RadioGroup.test.tsx +95 -0
  10. package/__tests__/components/Checkout/ServiceCardWrapper.test.tsx +53 -0
  11. package/__tests__/components/Checkout/Switcher.test.tsx +43 -0
  12. package/__tests__/components/UserDasboardPage/sections/CheckoutSection/CheckoutSection.test.tsx +613 -0
  13. package/__tests__/components/UserDasboardPage/sections/FavoriteSection/FavoriteSection.test.tsx +335 -0
  14. package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/AdditionalOrderInfo.test.tsx +127 -0
  15. package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusCar.test.tsx +58 -0
  16. package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusCard.test.tsx +74 -0
  17. package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusSection.test.tsx +62 -0
  18. package/__tests__/components/UserDasboardPage/sections/RequestedCarsSection/RequestedCarsSection.test.tsx +117 -0
  19. package/__tests__/components/Vehicle/VehicleFormattedPrice/VehicleFormattedPrice.test.tsx +58 -0
  20. package/__tests__/components/VehicleSmallCard/VehicleInfo.test.tsx +88 -0
  21. package/__tests__/components/VehicleSmallCard/VehicleTitle.test.tsx +91 -0
  22. package/__tests__/components/_common/Badge/Badge.test.tsx +15 -0
  23. package/__tests__/components/_common/IconSVG/IconSVG.test.tsx +23 -0
  24. package/__tests__/components/_common/Image/Image.test.tsx +82 -0
  25. package/__tests__/components/_common/MaterialAutocomplete/MaterialAutocomplete.test.tsx +49 -0
  26. package/__tests__/components/_common/MaterialDatePicker/MaterialDatePicker.test.tsx +54 -0
  27. package/__tests__/components/_common/MaterialField/MaterialField.test.tsx +58 -0
  28. package/__tests__/components/_common/StarButton/StarButton.test.tsx +46 -0
  29. package/__tests__/mockedData/financingConfig.js +202 -0
  30. package/__tests__/mockedData/mockedPendingRequestedCar.js +69 -0
  31. package/__tests__/utils/CommonUtils/addPrefixToKeys.test.ts +18 -0
  32. package/__tests__/utils/CommonUtils/arrToObj.test.js +32 -0
  33. package/__tests__/utils/CommonUtils/checkRangeValuesOnEqual.test.ts +17 -0
  34. package/__tests__/utils/CommonUtils/fixNumber.test.ts +20 -0
  35. package/__tests__/utils/CommonUtils/formatMileage.test.ts +8 -0
  36. package/__tests__/utils/CommonUtils/getChipFilterValue.test.ts +22 -0
  37. package/__tests__/utils/CommonUtils/getFormattedNumber.test.ts +19 -0
  38. package/__tests__/utils/CommonUtils/getFormattedPrice.test.ts +19 -0
  39. package/__tests__/utils/CommonUtils/getGroupValuesForQuery.test.ts +51 -0
  40. package/__tests__/utils/CommonUtils/getOfferSliders.test.ts +64 -0
  41. package/__tests__/utils/CommonUtils/getPriceRating.test.ts +26 -0
  42. package/__tests__/utils/CommonUtils/getPriceRatingConfig.test.ts +33 -0
  43. package/__tests__/utils/CommonUtils/preloadNearbyImages.test.ts +9 -0
  44. package/__tests__/utils/CommonUtils/sliceLessThan.test.ts +23 -0
  45. package/__tests__/utils/CommonUtils/sliceMoreThan.test.ts +23 -0
  46. package/media/locales/de/promoSlider.json +1 -0
  47. package/media/locales/en/promoSlider.json +1 -0
  48. package/package.json +3 -5
  49. package/source/components/AccordionWidget/AccordionWidget.styl +1 -0
  50. package/source/components/AccordionWidget/AccordionWidget.tsx +8 -4
  51. package/source/components/AdvantageItem/AdvantageItem.story.js +23 -0
  52. package/source/components/Alternative/Dealer.story.js +32 -0
  53. package/source/components/Alternative/Dealer.story.styl +3 -0
  54. package/source/components/Breadcrumbs/Breadcrumbs.story.js +40 -0
  55. package/source/components/Breadcrumbs/FirstInfoBlock/FirstInfoBlock.story.js +45 -0
  56. package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.story.js +243 -0
  57. package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.story.styl +21 -0
  58. package/source/components/Checkout/RadioCards/RadioGroupCheckout.story.js +105 -0
  59. package/source/components/Checkout/RadioCards/RadioGroupCheckout.story.styl +37 -0
  60. package/source/components/Checkout/Switcher/Switcher.story.js +41 -0
  61. package/source/components/Checkout/Switcher/Switcher.story.styl +2 -0
  62. package/source/components/CompactSearchWidget/CompactSearchWidget.story.js +187 -0
  63. package/source/components/ContactForm/ContactForm.story.js +94 -0
  64. package/source/components/ContactForm/ContactForm.story.styl +0 -0
  65. package/source/components/ContactInfo/ContactInfo.story.js +58 -0
  66. package/source/components/CustomerQuote/CustomerQuote.story.js +41 -0
  67. package/source/components/CustomerQuotesSlider/CustomerQuotesSlider.story.js +73 -0
  68. package/source/components/CustomerQuotesSlider/CustomerQuotesSlider.story.styl +5 -0
  69. package/source/components/FormattedNumber/FormattedNumber.story.js +114 -0
  70. package/source/components/InfoBlocks/InfoBlockWrapper.story.js +101 -0
  71. package/source/components/InfoBlocks/InfoBlockWrapper.story.styl +46 -0
  72. package/source/components/OfferPanel/AboAccordion/AboFaq/AboFaq.story.js +97 -0
  73. package/source/components/OfferPanel/OfferPanel.story.js +139 -0
  74. package/source/components/OfferPanel/RangeGroup/RangeGroup.story.js +35 -0
  75. package/source/components/OfferPanel/RangeGroup/RangeGroup.story.styl +3 -0
  76. package/source/components/PriceRating/PriceRating.story.js +39 -0
  77. package/source/components/PriceRating/PriceRating.story.styl +2 -0
  78. package/source/components/PriceRatingDetailed/PriceRatingDetailed.story.js +78 -0
  79. package/source/components/PriceRatingDetailed/PriceRatingDetailed.story.styl +11 -0
  80. package/source/components/RateSearchValue/RateSearchValue.story.js +78 -0
  81. package/source/components/RateSearchValue/RateSearchValue.story.styl +2 -0
  82. package/source/components/RateSearchWidget/RateSearchWidget.story.js +57 -0
  83. package/source/components/RateSearchWidget/RateSearchWidget.story.styl +12 -0
  84. package/source/components/SearchFilters/FiltersFactory.story.js +273 -0
  85. package/source/components/SearchPage/Filters/MakeModel/MakeModel.story.js +12 -0
  86. package/source/components/SearchWidget/BasicDataWidget/BasicDataWidget.story.js +834 -0
  87. package/source/components/SearchWidget/BasicDataWidget/BasicDataWidget.story.styl +40 -0
  88. package/source/components/SearchWidget/SearchWidget.story.js +191 -0
  89. package/source/components/SearchWidget/SearchWidget.story.styl +6 -0
  90. package/source/components/Stepper/Stepper.story.js +119 -0
  91. package/source/components/Stepper/Stepper.story.styl +41 -0
  92. package/source/components/Theme.story.js +36 -0
  93. package/source/components/Theme.story.styl +85 -0
  94. package/source/components/TickerText/TickerText.story.js +17 -0
  95. package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusSection.story.js +95 -0
  96. package/source/components/UserDashboardPage/sections/RequestedCarsSection/RequestedCarsSection.story.js +97 -0
  97. package/source/components/Vehicle/VehicleConsumption/VehicleConsumption.story.js +31 -0
  98. package/source/components/Vehicle/VehicleFormattedPrice/VehicleFormattedPrice.story.js +247 -0
  99. package/source/components/VehicleCompared/CompareGeneral/CompareGeneral.story.js +30 -0
  100. package/source/components/VehicleCompared/ComparePrice/ComparePrice.story.js +18 -0
  101. package/source/components/VehicleCompared/CompareTitle/CompareTitle.story.js +19 -0
  102. package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.story.js +44 -0
  103. package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.tsx +23 -11
  104. package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.story.js +120 -0
  105. package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.tsx +1 -0
  106. package/source/components/VehicleDetailedSlider/partials/PriceData.tsx +48 -45
  107. package/source/components/VehiclePromoSlider/VehiclePromoInfo/VehiclePromoInfo.story.js +42 -0
  108. package/source/components/VehiclePromoSlider/VehiclePromoSlide/VehiclePromoSlide.story.js +62 -0
  109. package/source/components/VehiclePromoSlider/VehiclePromoSlider.story.js +42 -0
  110. package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.styl +5 -0
  111. package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.tsx +3 -1
  112. package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.styl +1 -1
  113. package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.tsx +24 -11
  114. package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.styl +3 -2
  115. package/source/components/VehicleSmallCard/VehicleData/VehicleProperty/VehicleProperty.styl +4 -1
  116. package/source/components/VehicleSmallCard/VehicleData/VehicleProperty/VehicleProperty.tsx +3 -2
  117. package/source/components/VehicleSmallCard/VehicleData/VehicleTitle/VehicleTitle.tsx +1 -1
  118. package/source/components/VehicleSmallCard/VehicleSmallCard.story.js +412 -0
  119. package/source/components/VehicleSmallCard/VehicleSmallCard.story.styl +56 -0
  120. package/source/components/VehicleSmallCard/VehicleSmallCard.tsx +14 -3
  121. package/source/components/VehicleSmallCardForDealerships/VehicleSmallCardForDealerships.story.js +199 -0
  122. package/source/components/VehicleSmallCardForDealerships/VehicleSmallCardForDealerships.story.styl +40 -0
  123. package/source/components/_common/Accordion/Accordion.story.js +36 -0
  124. package/source/components/_common/Badge/Badge.story.js +27 -0
  125. package/source/components/_common/Badge/Badge.story.styl +5 -0
  126. package/source/components/_common/Bubble/Bubble.story.js +52 -0
  127. package/source/components/_common/Button/Button.story.js +52 -0
  128. package/source/components/_common/Button/Button.story.styl +5 -0
  129. package/source/components/_common/ButtonOld/Button.story.js +54 -0
  130. package/source/components/_common/ButtonOld/Button.story.styl +5 -0
  131. package/source/components/_common/Checkbox/Checkbox.story.js +85 -0
  132. package/source/components/_common/Checkbox/Checkbox.story.styl +14 -0
  133. package/source/components/_common/CheckboxMaterial/CheckboxMaterial.story.js +126 -0
  134. package/source/components/_common/CheckboxMaterial/CheckboxMaterial.story.styl +14 -0
  135. package/source/components/_common/Chip/Chip.story.js +43 -0
  136. package/source/components/_common/ChipList/ChipList.story.js +36 -0
  137. package/source/components/_common/DropDown/DropDown.story.js +35 -0
  138. package/source/components/_common/ExpandablePanel/ExpandablePanel.story.js +41 -0
  139. package/source/components/_common/Histogram/Histogram.story.js +51 -0
  140. package/source/components/_common/IconSVG/IconSVG.story.js +21 -0
  141. package/source/components/_common/IconSVG/IconSVG.story.styl +25 -0
  142. package/source/components/_common/Image/Image.story.js +142 -0
  143. package/source/components/_common/Image/Image.story.styl +18 -0
  144. package/source/components/_common/ImagesSet/ImagesSet.story.js +34 -0
  145. package/source/components/_common/ImagesSet/ImagesSet.story.styl +4 -0
  146. package/source/components/_common/Loader/Loader.story.js +21 -0
  147. package/source/components/_common/MaterialAccordionGroup/MaterialAccordionGroup.story.js +49 -0
  148. package/source/components/_common/MaterialAccordionGroup/MaterialAccordionGroup.styled.tsx +4 -1
  149. package/source/components/_common/MaterialDatePicker/MaterialDatePicker.story.js +45 -0
  150. package/source/components/_common/MaterialDatePicker/MaterialDatePicker.story.styl +6 -0
  151. package/source/components/_common/MaterialField/MaterialField.story.js +87 -0
  152. package/source/components/_common/MaterialField/MaterialField.story.styl +34 -0
  153. package/source/components/_common/MaterialSelect/MaterialSelect.story.js +52 -0
  154. package/source/components/_common/MaterialSelect/MaterialSelect.story.styl +6 -0
  155. package/source/components/_common/MaterialStepButton/MaterialStepButton.story.js +47 -0
  156. package/source/components/_common/MaterialStepButton/MaterialStepButton.story.styl +6 -0
  157. package/source/components/_common/MaterialSwitch/MaterialSwitch.story.js +17 -0
  158. package/source/components/_common/MaterialTooltip/MaterialTooltip.story.js +10 -0
  159. package/source/components/_common/Modal/Modal.story.js +37 -0
  160. package/source/components/_common/MuiGroupedSelect/MuiGroupedSelect.story.js +21 -0
  161. package/source/components/_common/PropertySelector/PSGroup.story.js +93 -0
  162. package/source/components/_common/PropertySelector/PSGroup.story.styl +25 -0
  163. package/source/components/_common/PropertySelector/ProperySelector.story.js +83 -0
  164. package/source/components/_common/Radio/FormRadioGroup.story.js +28 -0
  165. package/source/components/_common/Radio/FormRadioGroup.story.styl +2 -0
  166. package/source/components/_common/Radio/Radio.story.js +54 -0
  167. package/source/components/_common/Radio/RadioGroup.story.js +90 -0
  168. package/source/components/_common/Radio/RadioGroup.story.styl +39 -0
  169. package/source/components/_common/Range/Range.story.js +46 -0
  170. package/source/components/_common/Range/Range.story.styl +5 -0
  171. package/source/components/_common/SliderArrow/SliderArrow.story.js +18 -0
  172. package/source/components/_common/Tabs/Tabs.story.js +56 -0
  173. package/source/components/_common/TimePicker/TimePicker.story.js +37 -0
  174. package/source/components/_common/Tooltip/Tooltip.story.js +28 -0
  175. package/source/components/_common/UserMenu/MaterialMenu.story.js +73 -0
  176. package/source/components/_common/VehicleSlider/VehicleSlider.story.js +99 -0
  177. package/source/components/_common/VehicleSlider/VehicleSlider.story.styl +0 -0
  178. package/source/components/_common/withLabel/withLabel.story.js +62 -0
  179. package/source/components/_common/withPopover/withPopover.story.js +48 -0
  180. package/source/components/_common/withPopover/withPopover.story.styl +54 -0
  181. package/source/components/_common/withStats/withStats.story.js +75 -0
  182. package/source/components/_common/withStats/withStats.tsx +1 -1
  183. package/source/framework/DataTransformers.ts +1 -0
  184. package/source/framework/constants/common.ts +8 -4
  185. package/source/framework/types/types.ts +1 -0
  186. package/source/framework/vehiclesProps/decoratedLightProps.tsx +48 -12
  187. package/source/framework/vehiclesProps/decoratedProps.tsx +35 -8
  188. package/source/locales/data.ts +3 -0
  189. package/bytebrand-fe-ui-core-4.8.47.tgz +0 -0
@@ -0,0 +1,40 @@
1
+ @import '../../../theme/theme.styl';
2
+
3
+ .wrapper
4
+ // position: fixed
5
+ width: 100%
6
+ height: 100%
7
+ left: 0px
8
+ background-color: red;
9
+ top: 0px
10
+ display: flex
11
+ background-color #CBCBCB
12
+ font-family: $font-style-arial
13
+
14
+ .resizable
15
+ margin-top: 0;
16
+ width: 375px;
17
+ padding: 100px;
18
+
19
+ .propsContainer
20
+ overflow-y: auto
21
+
22
+ .title
23
+ text-align: center
24
+ font-size: 22px
25
+ font-weight: bold
26
+
27
+ .input
28
+ display: inline-block !important
29
+ margin-left: 10px
30
+ position: absolute
31
+ right: 0
32
+
33
+ :global
34
+ .react-checkbox-tree
35
+ width: 550px
36
+ margin-right: 10px
37
+ padding-right: 10px
38
+ .rct-node
39
+ margin: 10px 0
40
+ position: relative
@@ -0,0 +1,191 @@
1
+ import React from 'react';
2
+ import { storiesOf } from '@storybook/react';
3
+
4
+ // Components
5
+ import SearchWidget from './SearchWidget';
6
+
7
+ // utils
8
+ import { getRequestOptions } from '../../framework/utils/RequestUtils';
9
+ import { buildBodyForRequest, buildQueryForSearch, changeLocation, checkRangeValuesOnEqual } from '../../framework/utils/CommonUtils';
10
+ import { transformManufacturers, transformModelsGeneral } from '../../framework/DataTransformers';
11
+ import { MANUFACTURER, MODEL, THROTTLE_DELAY, RATE_DEFAULT } from '../../framework/constants/SearchWidget';
12
+ import { BODY_TYPES } from '../../framework/constants/selectors';
13
+
14
+ import styles from './SearchWidget.story.styl';
15
+
16
+ const containerStyles = {
17
+ position: 'relative',
18
+ width: '600px',
19
+ height: '550px',
20
+ backgroundImage: 'url("https://dev.autode-static.de/wp-content/uploads/2019/02/startseite_br_tor_AXEL.png")'
21
+ };
22
+
23
+ const widget = {
24
+ position: 'absolute',
25
+ top: '5%',
26
+ left: '50%',
27
+ transform: 'translateX(-50%)'
28
+ };
29
+
30
+ const getCarsCounterUrl = 'https://www.autode-dev.de/service/car-search-endpoint/api/v1/count/car';
31
+ const getManufacturersUrl = 'https://www.autode-dev.de/service/car-makemodel-mapping/api/v1/information/makers';
32
+ const getModelsUrl = 'https://www.autode-dev.de/service/car-makemodel-mapping/api/v1/information/models?maker=';
33
+
34
+ let timeout = null;
35
+
36
+ class WidgetContainer extends React.Component {
37
+ constructor(props) {
38
+ super(props);
39
+
40
+ this.state = {
41
+ counter: 0,
42
+ counterLoading: true,
43
+ manufacturers: [],
44
+ models: [],
45
+ activeTab: 0,
46
+ filters: {
47
+ MANUFACTURER: '',
48
+ MODEL: '',
49
+ BODY_TYPE: [],
50
+ FIRST_REGISTRATION: '',
51
+ MILEAGE: '',
52
+ PRICE: { from: '', to: '' },
53
+ RATE: RATE_DEFAULT
54
+ }
55
+ };
56
+ }
57
+
58
+ componentDidMount() {
59
+ this.getCarsCounter();
60
+ this.getManufacturers();
61
+ }
62
+
63
+ componentWillUnmount() {
64
+ timeout = null;
65
+ }
66
+
67
+ onChangeTab = (index) => this.setState(() => ({
68
+ activeTab: index
69
+ }));
70
+
71
+ onFilterChange = (value, name) => {
72
+ if (!name) return false;
73
+ const newState = Object.assign({}, this.state);
74
+ newState.filters[name] = value;
75
+
76
+ if (name === MANUFACTURER) {
77
+ newState.filters[MODEL] = '';
78
+ this.getModels(value.value);
79
+ }
80
+
81
+ this.setState(() => (newState), () => {
82
+ clearTimeout(timeout);
83
+ timeout = setTimeout(this.getCarsCounter, THROTTLE_DELAY);
84
+ });
85
+ };
86
+
87
+ onSearchButtonClick = () => {
88
+ const { filters } = this.state;
89
+ const query = buildQueryForSearch(filters);
90
+ const resolvePrefix = query ? `search?${query}` : 'search';
91
+
92
+ this.onChangeLocation(resolvePrefix);
93
+ };
94
+
95
+ onChangeLocation = (path) =>
96
+ changeLocation(path);
97
+
98
+ onBrandPanelClick = () => {
99
+ console.log(this.state.filters[MANUFACTURER]);
100
+ };
101
+
102
+ getManufacturers = () =>
103
+ fetch(getManufacturersUrl, getRequestOptions('get'))
104
+ .then((res) => res.json())
105
+ .then((res) => {
106
+ const manufacturers = transformManufacturers(res.data);
107
+ this.updateManufacturersList(manufacturers);
108
+ })
109
+ .catch((error) => {
110
+ throw error;
111
+ });
112
+
113
+ getModels = (maker) =>
114
+ fetch(`${getModelsUrl}${maker}`, getRequestOptions('get'))
115
+ .then((res) => res.json())
116
+ .then((res) => {
117
+ const models = transformModelsGeneral(res.data);
118
+ this.setState(() => ({
119
+ models
120
+ }));
121
+ })
122
+ .catch((error) => {
123
+ throw error;
124
+ });
125
+
126
+ getCarsCounter = () => {
127
+ const { filters } = this.state;
128
+ const data = buildBodyForRequest(filters);
129
+ const obj = getRequestOptions('post', data);
130
+ this.setState(() => ({ counterLoading: true }));
131
+
132
+ fetch(getCarsCounterUrl, obj)
133
+ .then((res) => res.json())
134
+ .then((res) => {
135
+ this.updateCarCounter(res.count);
136
+ })
137
+ .catch((error) => {
138
+ throw error;
139
+ });
140
+ };
141
+
142
+ updateManufacturersList = (manufacturers) =>
143
+ this.setState(() => ({
144
+ manufacturers
145
+ }));
146
+
147
+ updateCarCounter = (counter) =>
148
+ this.setState(() => ({
149
+ counter,
150
+ counterLoading: false
151
+ }));
152
+
153
+ render() {
154
+ const { counter, counterLoading, activeTab, manufacturers, models, filters } = this.state;
155
+
156
+ const searchWidgetProps = {
157
+ counter,
158
+ counterLoading,
159
+ activeTab,
160
+ manufacturers,
161
+ models,
162
+ bodyTypes: BODY_TYPES,
163
+ filters,
164
+ showBottomLinks: false,
165
+ rateWidgetClassName: styles.rateWidget,
166
+ onChangeTab: this.onChangeTab,
167
+ onFilterChange: this.onFilterChange,
168
+ onSearchButtonClick: this.onSearchButtonClick,
169
+ onDetailedSearchClick: () => console.log('detailed'),
170
+ onBrandPanelClick: this.onBrandPanelClick,
171
+ rateWidgetPosition: 'left'
172
+ };
173
+
174
+ return (
175
+ <div>
176
+ <SearchWidget {...searchWidgetProps} />
177
+ </div>
178
+ )
179
+ }
180
+ }
181
+
182
+ // For testing with api you need run storybook with custom port and host:
183
+ // yarn storybook -p 8080 -h local.autode-dev.de
184
+ storiesOf('SearchWidget', module)
185
+ .add('default', () => (
186
+ <div style={containerStyles}>
187
+ <div style={widget}>
188
+ <WidgetContainer />
189
+ </div>
190
+ </div>
191
+ ));
@@ -0,0 +1,6 @@
1
+ @import '../../theme/theme.styl';
2
+
3
+ .rateWidget
4
+ background-color: $grey-f2
5
+ &::before
6
+ background-color: $grey-f2 !important
@@ -0,0 +1,119 @@
1
+ import React from 'react';
2
+ import classnames from 'classnames';
3
+ import {storiesOf} from '@storybook/react';
4
+
5
+ import Stepper from './Stepper';
6
+ import Step from "./Step/Step";
7
+ import IconSVG from "../_common/IconSVG/IconSVG";
8
+ import Button from "../_common/Button/Button";
9
+
10
+ import styles from './Stepper.story.styl';
11
+ import stepStyles from './Step/Step.styl';
12
+
13
+ const maxSteps = 4;
14
+
15
+ const CustomStep = ({index, title, active, completed, description, onClick}) => {
16
+ const circleClassName = React.useMemo(() => {
17
+ return classnames(stepStyles.circle, styles.customCircle, {
18
+ [styles.active]: active,
19
+ [styles.completed]: completed
20
+ });
21
+ }, [active, completed]);
22
+
23
+ const titleClassName = React.useMemo(() => {
24
+ return classnames(styles.customTitle, {
25
+ [styles.active]: active,
26
+ [styles.completed]: completed
27
+ })
28
+ }, [active, completed]);
29
+
30
+ const descriptionClassName = React.useMemo(() => {
31
+ return classnames(styles.customDescription, {
32
+ [styles.active]: active,
33
+ [styles.completed]: completed
34
+ })
35
+ }, [active, completed]);
36
+
37
+ return (
38
+ <div className={stepStyles.container}>
39
+ <div className={circleClassName} onClick={onClick}>
40
+ <div className={stepStyles.index}>{index + 1}</div>
41
+ </div>
42
+ <div className={titleClassName}>{title}</div>
43
+ <div className={descriptionClassName}>{description}</div>
44
+ </div>
45
+ );
46
+ };
47
+
48
+ const LinearStepper = () => {
49
+ const [currentStep, setStep] = React.useState(0);
50
+ const nextStep = React.useCallback(() => {
51
+ setStep(currentStep + 1);
52
+ }, [currentStep]);
53
+
54
+ const prevStep = React.useCallback(() => {
55
+ setStep(currentStep - 1);
56
+ }, [currentStep]);
57
+
58
+ return (
59
+ <div className={styles.linearStepper}>
60
+ <div className={styles.title}>Linear stepper</div>
61
+ <Stepper currentStep={currentStep}>
62
+ <Step title='First step'/>
63
+ <Step title='Second step'/>
64
+ <CustomStep title='Custom step' description={'Description'}/>
65
+ <Step title='Star step' icon={
66
+ <IconSVG className={styles.icon} name='star' width='30px' height='30px' customDimensions/>
67
+ }/>
68
+ </Stepper>
69
+ <div className={styles.buttonContainer}>
70
+ <Button className={styles.button} disabled={currentStep < 1} onClick={prevStep}>Prev</Button>
71
+ <Button className={styles.button} disabled={currentStep >= maxSteps - 1} onClick={nextStep}>Next</Button>
72
+ </div>
73
+ </div>
74
+ );
75
+ };
76
+
77
+ const NonLinearStepper = () => {
78
+ const [currentStep, setStep] = React.useState(0);
79
+ const [completed, setCompleted] = React.useState(Array(maxSteps).fill(false));
80
+ const changeCompleted = React.useCallback((complete) => {
81
+ const array = completed.slice();
82
+ array[currentStep] = complete;
83
+ setCompleted(array);
84
+ }, [currentStep, completed]);
85
+
86
+ const complete = React.useCallback(() => {
87
+ changeCompleted(true);
88
+ }, [changeCompleted]);
89
+
90
+ const reset = React.useCallback(() => {
91
+ changeCompleted(false);
92
+ }, [changeCompleted]);
93
+
94
+ return (
95
+ <div>
96
+ <div className={styles.title}>Non linear stepper</div>
97
+ <Stepper currentStep={currentStep} nonLinear onStepChange={setStep}>
98
+ <Step title='First step' completed={completed[0]}/>
99
+ <Step title='Second step' completed={completed[1]}/>
100
+ <CustomStep title='Custom step' description={'Description'} completed={completed[2]}/>
101
+ <Step title='Star step' completed={completed[3]} icon={
102
+ <IconSVG className={styles.icon} name='star' width='30px' height='30px' customDimensions/>
103
+ }/>
104
+ </Stepper>
105
+ <div className={styles.buttonContainer}>
106
+ <Button className={styles.button} disabled={completed[currentStep]} onClick={complete}>Complete</Button>
107
+ <Button className={styles.button} disabled={!completed[currentStep]} onClick={reset}>Reset</Button>
108
+ </div>
109
+ </div>
110
+ );
111
+ };
112
+
113
+ storiesOf('Stepper', module)
114
+ .add('default', () => (
115
+ <div style={{width: 720, height: 576, background: 'white', padding: 20}}>
116
+ <LinearStepper/>
117
+ <NonLinearStepper/>
118
+ </div>
119
+ ));
@@ -0,0 +1,41 @@
1
+ .customCircle
2
+ background: #FCE4EC
3
+
4
+ &.completed
5
+ background: #F48FB1
6
+
7
+ &.active
8
+ background: #F06292
9
+
10
+ .customTitle
11
+ color: #999
12
+ font-weight: 600
13
+
14
+ &.completed
15
+ color: #F48FB1
16
+
17
+ &.active
18
+ color: #F06292
19
+
20
+ .customDescription
21
+ composes customTitle
22
+ font-size: 14px
23
+ font-weight: 400
24
+
25
+ .linearStepper
26
+ margin-bottom: 60px
27
+
28
+ .title
29
+ margin-bottom: 40px
30
+ font-size: 20px
31
+ text-align: center
32
+
33
+ .icon
34
+ fill: white
35
+
36
+ .buttonContainer
37
+ text-align: center
38
+
39
+ .button
40
+ display: inline-block
41
+ margin: 20px 10px
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import classnames from 'classnames';
3
+ import { storiesOf } from '@storybook/react';
4
+
5
+ import styles from './Theme.story.styl';
6
+
7
+ storiesOf('_Theme', module).
8
+ add('typography', () => (
9
+ <div className={styles.baseFont}>
10
+ <p className={styles.paragraph} style={{ width: '200px' }}>Lorem ipsum — класичний варіант умовного беззмістовного тексту, що вставляється в макет сторінки.</p>
11
+ <h1 className={styles.heading1}>Lorem ipsum heading 1</h1>
12
+ <h2 className={styles.heading2}>Lorem ipsum heading 2</h2>
13
+ <h3 className={styles.heading3}>Lorem ipsum heading 3</h3>
14
+ <h4 className={styles.heading4}>Lorem ipsum heading 4</h4>
15
+ <h5 className={styles.heading5}>Lorem ipsum heading 5</h5>
16
+ <h6 className={styles.heading6}>Lorem ipsum heading 6</h6>
17
+ </div>
18
+ ))
19
+ .add('colors', () => (
20
+ <div className={styles.baseColor}>
21
+ <h3 className={styles.heading3}>Primary colors</h3>
22
+ <div className={styles.container}>
23
+ <div className={classnames(styles.plate, styles.primaryColor100)} />
24
+ <div className={classnames(styles.plate, styles.primaryColor70)} />
25
+ <div className={classnames(styles.plate, styles.primaryColor40)} />
26
+ <div className={classnames(styles.plate, styles.primaryColor15)} />
27
+ </div>
28
+ <h3 className={styles.heading3}>Secondary colors</h3>
29
+ <div className={styles.container}>
30
+ <div className={classnames(styles.plate, styles.secondaryColor100)} />
31
+ <div className={classnames(styles.plate, styles.secondaryColor70)} />
32
+ <div className={classnames(styles.plate, styles.secondaryColor40)} />
33
+ <div className={classnames(styles.plate, styles.secondaryColor15)} />
34
+ </div>
35
+ </div>
36
+ ));
@@ -0,0 +1,85 @@
1
+ @import '../theme/theme.styl'
2
+
3
+ .baseFont
4
+ font-family: $font-style-arial
5
+ color: $grey-1
6
+ font-size: $font-size-default
7
+
8
+ .paragraph
9
+ composes: baseFont
10
+ font-weight: $font-weight-thin
11
+ font-size: $font-size-paragraph
12
+
13
+ .heading1
14
+ composes: baseFont
15
+ font-size: $font-size-h1
16
+ font-weight: $font-weight-bolder
17
+
18
+ .heading2
19
+ composes: baseFont
20
+ font-size: $font-size-h2
21
+ font-weight: $font-weight-bold
22
+
23
+ .heading3
24
+ composes: baseFont
25
+ font-size: $font-size-h3
26
+ font-weight: $font-weight-bold
27
+
28
+ .heading4
29
+ composes: baseFont
30
+ font-size: $font-size-h4
31
+ font-weight: $font-weight-medium
32
+
33
+ .heading5
34
+ composes: baseFont
35
+ font-size: $font-size-h5
36
+ font-weight: $font-weight-normal
37
+
38
+ .heading6
39
+ composes: baseFont
40
+ font-size: $font-size-h6
41
+ font-weight: $font-weight-normal
42
+
43
+
44
+ .baseColor
45
+ position: relative
46
+
47
+ .primaryColor100
48
+ background-color: $primary
49
+
50
+ .primaryColor70
51
+ background-color: $primary70
52
+
53
+ .primaryColor40
54
+ background-color: $primary40
55
+
56
+ .primaryColor15
57
+ background-color: $primary15
58
+
59
+ .secondaryColor100
60
+ background-color: $secondary
61
+
62
+ .secondaryColor70
63
+ background-color: $secondary70
64
+
65
+ .secondaryColor40
66
+ background-color: $secondary40
67
+
68
+ .secondaryColor15
69
+ background-color: $secondary15
70
+
71
+
72
+ .plate
73
+ width: 100px
74
+ height: 70px
75
+
76
+ .container
77
+ display: flex
78
+ flex-direction: row
79
+ align-items: center
80
+
81
+
82
+
83
+
84
+
85
+
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { storiesOf } from '@storybook/react';
3
+ // import { action } from '@storybook/addon-actions';
4
+
5
+ import TickerText from './TickerText';
6
+
7
+ const props = {
8
+ text: '+++ Wir sind unverändert für Sie da! +++ Autos bequeme von zu Hause aus kaufen. +++ Wir beraten gern telefonisch und unterstützen Sie dabei das richtige Auto zu finden. +++ Jetzt die großen Rabatte nutzen! +++ Bleiben Sie gesund, wir stehen Ihnen weiterhin mit Rat und Tat zur Seite.',
9
+ link: 'https://www.auto.de/magazin/online-kauf-in-zeiten-von-covid-19'
10
+ };
11
+
12
+ storiesOf('TickerText', module)
13
+ .add('Ticker Text', () => (
14
+ <div style={{ display: 'flex', justifyContent: 'center', width: '900px' }}>
15
+ <TickerText {...props} />
16
+ </div>
17
+ ));
@@ -0,0 +1,95 @@
1
+ import React from 'react';
2
+ import { storiesOf } from '@storybook/react';
3
+
4
+ import OrderStatusSection from './OrderStatusSection';
5
+
6
+ const orderedCars = [
7
+ {
8
+ car: {
9
+ _id: '1234567890',
10
+ mainData: {
11
+ make: 'Volvo',
12
+ model: 'CX90',
13
+ subModel: 'sub model',
14
+ },
15
+ metaData: {
16
+ mainImageId: 'main image id'
17
+ }
18
+ },
19
+ buyingType: 'leasing',
20
+ selfPickup: true,
21
+ paybackPeriod: 24,
22
+ monthlyInstallment: 1000,
23
+ status: 'selector_status_preparation',
24
+ request: '010203',
25
+ registration: true,
26
+ currentSalesPrice: 20000
27
+ },
28
+ {
29
+ car: {
30
+ _id: '1234567890',
31
+ mainData: {
32
+ make: 'Volvo',
33
+ model: 'CX90',
34
+ subModel: 'sub model',
35
+ },
36
+ metaData: {
37
+ mainImageId: 'main image id'
38
+ }
39
+ },
40
+ buyingType: 'leasing',
41
+ selfPickup: false,
42
+ paybackPeriod: 24,
43
+ monthlyInstallment: 1000,
44
+ status: 'selector_status_registration',
45
+ request: '010203',
46
+ registration: false,
47
+ currentSalesPrice: 20000
48
+ }
49
+ ];
50
+
51
+ const translates = {
52
+ 'orderStatus.title': 'Order status',
53
+ 'orderStatus.selector_status_order_received': 'order received',
54
+ 'orderStatus.selector_status_preparation': 'preparation',
55
+ 'orderStatus.selector_status_registration': 'registration',
56
+ 'orderStatus.selector_status_pick_up': 'pickup',
57
+ 'orderStatus.selector_status_handing_over': 'handing over',
58
+ 'orderStatus.selector_status_delivery': 'delivery',
59
+ 'orderStatus.independentRegistration': 'independent registration',
60
+ 'orderStatus.selector_status_order_received_desc': 'order received description',
61
+ 'orderStatus.selector_status_preparation_desc': 'preparation description',
62
+ 'orderStatus.selector_status_registration_desc': 'registration description',
63
+ 'orderStatus.selector_status_pick_up_desc': 'pickup description',
64
+ 'orderStatus.selector_status_handing_over_desc': 'handing over description',
65
+ 'orderStatus.selector_status_delivery_desc': 'delivery description',
66
+ 'buyingType.buy': 'buy',
67
+ 'buyingType.leasing': 'leasing',
68
+ 'buyingType.financing': 'financing',
69
+ 'paybackPeriod': 'payback period',
70
+ 'currentSalesPrice': 'current sales price',
71
+ 'monthlyInstallment': 'monthly installment'
72
+ }
73
+
74
+ const t = (phrase, options) => {
75
+ if (options) {
76
+ console.log('qqqq options ====', options);
77
+ const value = Object.values(options).map((option) => option)
78
+ return `${translates[phrase]} ${value}`;
79
+ }
80
+ return translates[phrase];
81
+ }
82
+
83
+ const props = {
84
+ t,
85
+ redirectToCar: (id) => console.log(`redirect to car with id: ${id}`),
86
+ getSupportedImageFormat: (id, mainImageId, size) => 'https://images.autode-dev.de/carimage/28121b1a-398c-4e9c-9097-51be545817c5/RQ_mHNek5hIk/small-cached.webp',
87
+ isFetching: false,
88
+ withAdditionalInfo: false,
89
+ orderedCars
90
+ };
91
+
92
+ storiesOf('userDashboard', module)
93
+ .add('OrderStatusSection', () => (
94
+ <OrderStatusSection {...props} />
95
+ ));