@bytebrand/fe-ui-core 4.8.111 → 4.8.113
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/.husky/pre-push +4 -0
- package/.storybook/addons.js +4 -0
- package/.storybook/config.js +64 -0
- package/.storybook/postcss.config.js +6 -0
- package/.storybook/preview-head.html +10 -0
- package/.storybook/webpack.config.js +130 -0
- package/__tests__/components/Checkout/OrderOverviewItem/OrderOverviewItem.test.tsx +42 -0
- package/__tests__/components/Checkout/PaymentTypeCard/PaymentTypeCard.test.tsx +50 -0
- package/__tests__/components/Checkout/RadioGroup.test.tsx +95 -0
- package/__tests__/components/Checkout/ServiceCardWrapper.test.tsx +53 -0
- package/__tests__/components/Checkout/Switcher.test.tsx +43 -0
- package/__tests__/components/UserDasboardPage/sections/CheckoutSection/CheckoutSection.test.tsx +613 -0
- package/__tests__/components/UserDasboardPage/sections/FavoriteSection/FavoriteSection.test.tsx +335 -0
- package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/AdditionalOrderInfo.test.tsx +127 -0
- package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusCar.test.tsx +58 -0
- package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusCard.test.tsx +74 -0
- package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusSection.test.tsx +62 -0
- package/__tests__/components/UserDasboardPage/sections/RequestedCarsSection/RequestedCarsSection.test.tsx +117 -0
- package/__tests__/components/Vehicle/VehicleFormattedPrice/VehicleFormattedPrice.test.tsx +58 -0
- package/__tests__/components/VehicleSmallCard/VehicleInfo.test.tsx +88 -0
- package/__tests__/components/VehicleSmallCard/VehicleTitle.test.tsx +91 -0
- package/__tests__/components/_common/Badge/Badge.test.tsx +15 -0
- package/__tests__/components/_common/IconSVG/IconSVG.test.tsx +23 -0
- package/__tests__/components/_common/Image/Image.test.tsx +82 -0
- package/__tests__/components/_common/MaterialAutocomplete/MaterialAutocomplete.test.tsx +49 -0
- package/__tests__/components/_common/MaterialDatePicker/MaterialDatePicker.test.tsx +54 -0
- package/__tests__/components/_common/MaterialField/MaterialField.test.tsx +58 -0
- package/__tests__/components/_common/StarButton/StarButton.test.tsx +46 -0
- package/__tests__/mockedData/financingConfig.js +202 -0
- package/__tests__/mockedData/mockedPendingRequestedCar.js +69 -0
- package/__tests__/utils/CommonUtils/addPrefixToKeys.test.ts +18 -0
- package/__tests__/utils/CommonUtils/arrToObj.test.js +32 -0
- package/__tests__/utils/CommonUtils/checkRangeValuesOnEqual.test.ts +17 -0
- package/__tests__/utils/CommonUtils/fixNumber.test.ts +20 -0
- package/__tests__/utils/CommonUtils/formatMileage.test.ts +8 -0
- package/__tests__/utils/CommonUtils/getChipFilterValue.test.ts +22 -0
- package/__tests__/utils/CommonUtils/getFormattedNumber.test.ts +19 -0
- package/__tests__/utils/CommonUtils/getFormattedPrice.test.ts +19 -0
- package/__tests__/utils/CommonUtils/getGroupValuesForQuery.test.ts +51 -0
- package/__tests__/utils/CommonUtils/getOfferSliders.test.ts +64 -0
- package/__tests__/utils/CommonUtils/getPriceRating.test.ts +26 -0
- package/__tests__/utils/CommonUtils/getPriceRatingConfig.test.ts +33 -0
- package/__tests__/utils/CommonUtils/preloadNearbyImages.test.ts +9 -0
- package/__tests__/utils/CommonUtils/sliceLessThan.test.ts +23 -0
- package/__tests__/utils/CommonUtils/sliceMoreThan.test.ts +23 -0
- package/media/locales/de/promoSlider.json +1 -0
- package/media/locales/en/promoSlider.json +1 -0
- package/package.json +118 -120
- package/source/components/AccordionWidget/AccordionWidget.styl +13 -1
- package/source/components/AccordionWidget/AccordionWidget.tsx +49 -8
- package/source/components/AdvantageItem/AdvantageItem.story.js +23 -0
- package/source/components/Alternative/Dealer.story.js +32 -0
- package/source/components/Alternative/Dealer.story.styl +3 -0
- package/source/components/Breadcrumbs/Breadcrumbs.story.js +40 -0
- package/source/components/Breadcrumbs/FirstInfoBlock/FirstInfoBlock.story.js +45 -0
- package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.story.js +243 -0
- package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.story.styl +21 -0
- package/source/components/Checkout/RadioCards/RadioGroupCheckout.story.js +105 -0
- package/source/components/Checkout/RadioCards/RadioGroupCheckout.story.styl +37 -0
- package/source/components/Checkout/Switcher/Switcher.story.js +41 -0
- package/source/components/Checkout/Switcher/Switcher.story.styl +2 -0
- package/source/components/CompactSearchWidget/CompactSearchWidget.story.js +187 -0
- package/source/components/ContactForm/ContactForm.story.js +94 -0
- package/source/components/ContactForm/ContactForm.story.styl +0 -0
- package/source/components/ContactInfo/ContactInfo.story.js +58 -0
- package/source/components/CustomerQuote/CustomerQuote.story.js +41 -0
- package/source/components/CustomerQuotesSlider/CustomerQuotesSlider.story.js +73 -0
- package/source/components/CustomerQuotesSlider/CustomerQuotesSlider.story.styl +5 -0
- package/source/components/FormattedNumber/FormattedNumber.story.js +114 -0
- package/source/components/InfoBlocks/InfoBlockWrapper.story.js +101 -0
- package/source/components/InfoBlocks/InfoBlockWrapper.story.styl +46 -0
- package/source/components/OfferPanel/AboAccordion/AboFaq/AboFaq.story.js +97 -0
- package/source/components/OfferPanel/OfferCheckboxGroup/CheckboxContainer.tsx +2 -2
- package/source/components/OfferPanel/OfferCheckboxGroup/OfferCheckboxGroup.styl +24 -0
- package/source/components/OfferPanel/OfferCheckboxGroup/OfferCheckboxGroup.tsx +1 -2
- package/source/components/OfferPanel/OfferPanel.story.js +139 -0
- package/source/components/OfferPanel/OfferPanel.tsx +1 -1
- package/source/components/OfferPanel/RangeGroup/RangeGroup.story.js +35 -0
- package/source/components/OfferPanel/RangeGroup/RangeGroup.story.styl +3 -0
- package/source/components/PriceRating/PriceRating.story.js +39 -0
- package/source/components/PriceRating/PriceRating.story.styl +2 -0
- package/source/components/PriceRatingDetailed/PriceRatingDetailed.story.js +78 -0
- package/source/components/PriceRatingDetailed/PriceRatingDetailed.story.styl +11 -0
- package/source/components/RateSearchValue/RateSearchValue.story.js +78 -0
- package/source/components/RateSearchValue/RateSearchValue.story.styl +2 -0
- package/source/components/RateSearchWidget/RateSearchWidget.story.js +57 -0
- package/source/components/RateSearchWidget/RateSearchWidget.story.styl +12 -0
- package/source/components/SearchFilters/FiltersFactory.story.js +273 -0
- package/source/components/SearchPage/Filters/MakeModel/MakeModel.story.js +12 -0
- package/source/components/SearchWidget/BasicDataWidget/BasicDataWidget.story.js +834 -0
- package/source/components/SearchWidget/BasicDataWidget/BasicDataWidget.story.styl +40 -0
- package/source/components/SearchWidget/SearchWidget.story.js +191 -0
- package/source/components/SearchWidget/SearchWidget.story.styl +6 -0
- package/source/components/Stepper/Stepper.story.js +119 -0
- package/source/components/Stepper/Stepper.story.styl +41 -0
- package/source/components/Theme.story.js +36 -0
- package/source/components/Theme.story.styl +85 -0
- package/source/components/TickerText/TickerText.story.js +17 -0
- package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusSection.story.js +95 -0
- package/source/components/UserDashboardPage/sections/RequestedCarsSection/RequestedCarsSection.story.js +97 -0
- package/source/components/Vehicle/VehicleConsumption/VehicleConsumption.story.js +31 -0
- package/source/components/Vehicle/VehicleFormattedPrice/VehicleFormattedPrice.story.js +247 -0
- package/source/components/VehicleCompared/CompareGeneral/CompareGeneral.story.js +30 -0
- package/source/components/VehicleCompared/ComparePrice/ComparePrice.story.js +18 -0
- package/source/components/VehicleCompared/CompareTitle/CompareTitle.story.js +19 -0
- package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.story.js +44 -0
- package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.tsx +3 -0
- package/source/components/VehicleDetailedSidebar/partials/Properties.styl +5 -0
- package/source/components/VehicleDetailedSidebar/partials/Properties.tsx +56 -18
- package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.story.js +120 -0
- package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.tsx +2 -6
- package/source/components/VehiclePromoSlider/VehiclePromoInfo/VehiclePromoInfo.story.js +42 -0
- package/source/components/VehiclePromoSlider/VehiclePromoSlide/VehiclePromoSlide.story.js +62 -0
- package/source/components/VehiclePromoSlider/VehiclePromoSlider.story.js +42 -0
- package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.styl +42 -0
- package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.tsx +23 -11
- package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.styl +60 -5
- package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.tsx +29 -11
- package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.styl +3 -2
- package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.tsx +18 -7
- package/source/components/VehicleSmallCard/VehicleData/VehicleProperty/VehicleProperty.styl +4 -1
- package/source/components/VehicleSmallCard/VehicleData/VehicleProperty/VehicleProperty.tsx +3 -2
- package/source/components/VehicleSmallCard/VehicleData/VehicleTitle/VehicleTitle.tsx +1 -1
- package/source/components/VehicleSmallCard/VehicleSmallCard.story.js +412 -0
- package/source/components/VehicleSmallCard/VehicleSmallCard.story.styl +56 -0
- package/source/components/VehicleSmallCard/VehicleSmallCard.styl +67 -2
- package/source/components/VehicleSmallCard/VehicleSmallCard.tsx +39 -1
- package/source/components/VehicleSmallCardForDealerships/VehicleSmallCardForDealerships.story.js +199 -0
- package/source/components/VehicleSmallCardForDealerships/VehicleSmallCardForDealerships.story.styl +40 -0
- package/source/components/_common/Accordion/Accordion.story.js +36 -0
- package/source/components/_common/Badge/Badge.story.js +27 -0
- package/source/components/_common/Badge/Badge.story.styl +5 -0
- package/source/components/_common/Bubble/Bubble.story.js +52 -0
- package/source/components/_common/Button/Button.story.js +52 -0
- package/source/components/_common/Button/Button.story.styl +5 -0
- package/source/components/_common/ButtonOld/Button.story.js +54 -0
- package/source/components/_common/ButtonOld/Button.story.styl +5 -0
- package/source/components/_common/Checkbox/Checkbox.story.js +85 -0
- package/source/components/_common/Checkbox/Checkbox.story.styl +14 -0
- package/source/components/_common/CheckboxMaterial/CheckboxMaterial.story.js +126 -0
- package/source/components/_common/CheckboxMaterial/CheckboxMaterial.story.styl +14 -0
- package/source/components/_common/Chip/Chip.story.js +43 -0
- package/source/components/_common/ChipList/ChipList.story.js +36 -0
- package/source/components/_common/DropDown/DropDown.story.js +35 -0
- package/source/components/_common/ExpandablePanel/ExpandablePanel.story.js +41 -0
- package/source/components/_common/Histogram/Histogram.story.js +51 -0
- package/source/components/_common/IconSVG/IconSVG.story.js +21 -0
- package/source/components/_common/IconSVG/IconSVG.story.styl +25 -0
- package/source/components/_common/Image/Image.story.js +142 -0
- package/source/components/_common/Image/Image.story.styl +18 -0
- package/source/components/_common/ImagesSet/ImagesSet.story.js +34 -0
- package/source/components/_common/ImagesSet/ImagesSet.story.styl +4 -0
- package/source/components/_common/Loader/Loader.story.js +21 -0
- package/source/components/_common/MaterialAccordionGroup/MaterialAccordionGroup.story.js +49 -0
- package/source/components/_common/MaterialAccordionGroup/MaterialAccordionGroup.styled.tsx +4 -1
- package/source/components/_common/MaterialDatePicker/MaterialDatePicker.story.js +45 -0
- package/source/components/_common/MaterialDatePicker/MaterialDatePicker.story.styl +6 -0
- package/source/components/_common/MaterialField/MaterialField.story.js +87 -0
- package/source/components/_common/MaterialField/MaterialField.story.styl +34 -0
- package/source/components/_common/MaterialSelect/MaterialSelect.story.js +52 -0
- package/source/components/_common/MaterialSelect/MaterialSelect.story.styl +6 -0
- package/source/components/_common/MaterialStepButton/MaterialStepButton.story.js +47 -0
- package/source/components/_common/MaterialStepButton/MaterialStepButton.story.styl +6 -0
- package/source/components/_common/MaterialSwitch/MaterialSwitch.story.js +17 -0
- package/source/components/_common/MaterialTooltip/MaterialTooltip.story.js +10 -0
- package/source/components/_common/MaterialTooltip/MaterialTooltip.tsx +4 -3
- package/source/components/_common/Modal/Modal.story.js +37 -0
- package/source/components/_common/MuiGroupedSelect/MuiGroupedSelect.story.js +21 -0
- package/source/components/_common/PropertySelector/PSGroup.story.js +93 -0
- package/source/components/_common/PropertySelector/PSGroup.story.styl +25 -0
- package/source/components/_common/PropertySelector/ProperySelector.story.js +83 -0
- package/source/components/_common/Radio/FormRadioGroup.story.js +28 -0
- package/source/components/_common/Radio/FormRadioGroup.story.styl +2 -0
- package/source/components/_common/Radio/Radio.story.js +54 -0
- package/source/components/_common/Radio/RadioGroup.story.js +90 -0
- package/source/components/_common/Radio/RadioGroup.story.styl +39 -0
- package/source/components/_common/Range/Range.story.js +46 -0
- package/source/components/_common/Range/Range.story.styl +5 -0
- package/source/components/_common/SliderArrow/SliderArrow.story.js +18 -0
- package/source/components/_common/Tabs/Tabs.story.js +56 -0
- package/source/components/_common/TimePicker/TimePicker.story.js +37 -0
- package/source/components/_common/Tooltip/Tooltip.story.js +28 -0
- package/source/components/_common/UserMenu/MaterialMenu.story.js +73 -0
- package/source/components/_common/VehicleSlider/VehicleSlider.story.js +99 -0
- package/source/components/_common/VehicleSlider/VehicleSlider.story.styl +0 -0
- package/source/components/_common/withLabel/withLabel.story.js +62 -0
- package/source/components/_common/withPopover/withPopover.story.js +48 -0
- package/source/components/_common/withPopover/withPopover.story.styl +54 -0
- package/source/components/_common/withStats/withStats.story.js +75 -0
- package/source/components/_common/withStats/withStats.styl +10 -0
- package/source/framework/DataTransformers.ts +2 -0
- package/source/framework/constants/common.ts +8 -4
- package/source/framework/types/types.ts +1 -0
- package/source/framework/vehiclesProps/decoratedLightProps.tsx +109 -18
- package/source/framework/vehiclesProps/decoratedProps.tsx +68 -9
- package/source/framework/vehiclesProps/vehicleDetails.ts +3 -1
- package/source/locales/data.ts +13 -3
- package/bytebrand-fe-ui-core-4.8.110.tgz +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { memo, FunctionComponent, ReactNode, MouseEvent, createElement } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import _get from 'lodash/get';
|
|
4
|
+
import getCardDecoratedProps from '../../framework/vehiclesProps/decoratedLightProps';
|
|
4
5
|
import LazyLoad from 'react-lazyload';
|
|
5
6
|
import withLabel from '../_common/withLabel/withLabel';
|
|
6
7
|
import withStats, { IStatsWrapperProps } from '../_common/withStats/withStats';
|
|
@@ -12,6 +13,7 @@ import VehicleTitle from './VehicleData/VehicleTitle/VehicleTitle';
|
|
|
12
13
|
import SeoText from './SeoText/SeoText';
|
|
13
14
|
import VehicleInfo from './VehicleData/VehicleInfo/VehicleInfo';
|
|
14
15
|
import VehiclePrice from './VehicleData/VehiclePrice/VehiclePrice';
|
|
16
|
+
import { PLACEHOLDER_IMAGE_SMALL_URL } from '../../framework/constants/common';
|
|
15
17
|
import {
|
|
16
18
|
IVehicleInfo,
|
|
17
19
|
IPrice,
|
|
@@ -149,6 +151,32 @@ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
|
|
|
149
151
|
|
|
150
152
|
const combineRefAlternative = isAlternative || isReferenceSearch;
|
|
151
153
|
|
|
154
|
+
// ADV-88: on the narrow landing/main recommendation cards the long plug-in consumption line
|
|
155
|
+
// doesn't fit the slim `info` column — render it as its own full-width row below the price
|
|
156
|
+
// block (under "Zum Angebot") instead, and suppress it inside VehicleInfo to avoid duplication.
|
|
157
|
+
// ADV-88: ANY plug-in hybrid (new or used) carries the long weighted+discharged consumption/CO2
|
|
158
|
+
// line — externalise it to a full-width row so it doesn't overflow the narrow info column. Gated
|
|
159
|
+
// on hybridPlugin only, no condition check.
|
|
160
|
+
// ADV-88: "is a hybrid car" is determined by fuel type (hybrid electric + diesel/petrol), not hybridPlugin.
|
|
161
|
+
const cardFuel = consumption ? (consumption as any).fuel : undefined;
|
|
162
|
+
const isPlugin = cardFuel === 'selector_fuel_hybridElectricalDiesel'
|
|
163
|
+
|| cardFuel === 'selector_fuel_hybridElectricalPetrol';
|
|
164
|
+
const externalizeConsumption = isPlugin
|
|
165
|
+
&& (vehicleComponentName === 'landing' || vehicleComponentName === 'main'
|
|
166
|
+
|| vehicleComponentName === 'search' || vehicleComponentName === 'comparable'
|
|
167
|
+
|| vehicleComponentName === 'favorite');
|
|
168
|
+
let pluginConsumptionNode: ReactNode = null;
|
|
169
|
+
if (externalizeConsumption) {
|
|
170
|
+
const decoCar = {
|
|
171
|
+
consumption,
|
|
172
|
+
environmentEmissions,
|
|
173
|
+
engineData,
|
|
174
|
+
mainData: { condition: _get(info, 'condition') }
|
|
175
|
+
};
|
|
176
|
+
const deco = getCardDecoratedProps(decoCar, t, language) as any;
|
|
177
|
+
pluginConsumptionNode = _get(deco, 'consumptionCombinedAlternateView.value', null);
|
|
178
|
+
}
|
|
179
|
+
|
|
152
180
|
const label = {
|
|
153
181
|
labelVisible: isTop,
|
|
154
182
|
labelWrapperClassName: styles.labelWrapper
|
|
@@ -163,6 +191,7 @@ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
|
|
|
163
191
|
{ [styles.vehicleWrapMyVeicles]: vehicleComponentName === 'myVehicles' },
|
|
164
192
|
{ [styles.vehicleWrapFavorite]: vehicleComponentName === 'favorite' },
|
|
165
193
|
{ [styles.vehicleWrapRecently]: vehicleComponentName === 'recently' },
|
|
194
|
+
{ [styles.vehicleWrapNewPlugin]: externalizeConsumption },
|
|
166
195
|
{ [styles.topVehicle]: isTop },
|
|
167
196
|
{ [styles.disableBorder]: minimizeData },
|
|
168
197
|
{ [styles.isFirstReferenceCar]: isReferenceSearch && index === 0 },
|
|
@@ -217,6 +246,7 @@ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
|
|
|
217
246
|
target,
|
|
218
247
|
rel,
|
|
219
248
|
engineData,
|
|
249
|
+
suppressConsumption: externalizeConsumption,
|
|
220
250
|
...price,
|
|
221
251
|
...info
|
|
222
252
|
};
|
|
@@ -243,6 +273,9 @@ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
|
|
|
243
273
|
typeAlternative,
|
|
244
274
|
isAlternative,
|
|
245
275
|
showCompareCheckboxes,
|
|
276
|
+
// ADV-88: hide the "monatlich z.B." price-column header on exactly the cards that show
|
|
277
|
+
// the externalised consumption row (new plug-in hybrids) so the price column rises.
|
|
278
|
+
suppressMonthlyFrom: externalizeConsumption && !!pluginConsumptionNode,
|
|
246
279
|
...price,
|
|
247
280
|
...compareProps
|
|
248
281
|
};
|
|
@@ -285,6 +318,7 @@ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
|
|
|
285
318
|
target,
|
|
286
319
|
rel,
|
|
287
320
|
className: `${styles.redirectClassLink} ${styles.gridAreaTitle}`,
|
|
321
|
+
// ADV-116: opening a CDP from a card defaults to the Financing tab.
|
|
288
322
|
onClick: () => localStorage.setItem('activeTabCDP', t('vehicleProps:title.financing')),
|
|
289
323
|
href: url
|
|
290
324
|
})}
|
|
@@ -338,11 +372,15 @@ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
|
|
|
338
372
|
target,
|
|
339
373
|
rel,
|
|
340
374
|
className: `${styles.redirectClassLink} ${styles.gridAreaImage}`,
|
|
375
|
+
// ADV-116: opening a CDP from a card defaults to the Financing tab.
|
|
341
376
|
onClick: () => localStorage.setItem('activeTabCDP', t('vehicleProps:title.financing')),
|
|
342
377
|
href: url
|
|
343
378
|
})}
|
|
344
379
|
<VehicleInfo {...vehicleInfoProps} />
|
|
345
380
|
<VehiclePrice {...vehiclePriceProps} />
|
|
381
|
+
{externalizeConsumption && pluginConsumptionNode ? (
|
|
382
|
+
<div className={styles.gridAreaConsumption}>{pluginConsumptionNode}</div>
|
|
383
|
+
) : null}
|
|
346
384
|
{seoText ? (
|
|
347
385
|
<a className={`${styles.redirectClassLink} ${styles.gridAreaSeoText}`} href={url}>
|
|
348
386
|
<SeoText seoText={seoText} />
|
|
@@ -370,7 +408,7 @@ VehicleSmallCard.defaultProps = {
|
|
|
370
408
|
baseUrl: '',
|
|
371
409
|
typeAlternative: '',
|
|
372
410
|
offerSource: '',
|
|
373
|
-
src:
|
|
411
|
+
src: PLACEHOLDER_IMAGE_SMALL_URL,
|
|
374
412
|
environmentEmissions: null,
|
|
375
413
|
language: 'en',
|
|
376
414
|
consumption: null,
|
package/source/components/VehicleSmallCardForDealerships/VehicleSmallCardForDealerships.story.js
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import i18next from 'i18next';
|
|
3
|
+
import { Resizable } from 're-resizable';
|
|
4
|
+
// import * as CheckboxTree from 'react-checkbox-tree';
|
|
5
|
+
import { withNamespaces } from 'react-i18next';
|
|
6
|
+
import { storiesOf } from '@storybook/react';
|
|
7
|
+
import { action } from '@storybook/addon-actions';
|
|
8
|
+
|
|
9
|
+
import VehicleSmallCardForDealerships from './VehicleSmallCardForDealerships.tsx';
|
|
10
|
+
import styles from './VehicleSmallCardForDealerships.story.styl';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
i18next.addResourceBundle('de', 'vehicleProps', {
|
|
14
|
+
value: {
|
|
15
|
+
mileage: "{{mileage}} km",
|
|
16
|
+
consumption: "{{consumption}}l/100km",
|
|
17
|
+
consumptionPower: "{{consumption}}kWh/100km",
|
|
18
|
+
consumptionPowerCombined: "{{consumption}}kWh/100km (komb)*",
|
|
19
|
+
consumptionGas: "{{consumption}}kg/100km",
|
|
20
|
+
consumptionCombined: "{{consumption}}l/100km",
|
|
21
|
+
power: "{{powerKW}}\u00A0kW ({{powerPS}}\u00A0PS)",
|
|
22
|
+
powerPS: "{{powerPS}} PS",
|
|
23
|
+
deliveryPeriodMonths: "{{count}} Monat\nab Bestellung",
|
|
24
|
+
deliveryPeriodDays: "{{count}} Tag\nab Bestellung",
|
|
25
|
+
co2Combined: "{{co2}}g CO2/km (komb)*",
|
|
26
|
+
co2: "{{co2}} g/km ",
|
|
27
|
+
na: "N/A"
|
|
28
|
+
},
|
|
29
|
+
priceRating: {
|
|
30
|
+
noRating: 'KEINE BEWERTUNG',
|
|
31
|
+
highPrice: 'HOHER PREIS',
|
|
32
|
+
increasedPrice: 'ERHÖHTER PREIS',
|
|
33
|
+
fairPrice: 'FAIRER PREIS',
|
|
34
|
+
goodPrice: 'GUTER PREIS',
|
|
35
|
+
topPrice: 'TOP PREIS'
|
|
36
|
+
},
|
|
37
|
+
promoSlider: {
|
|
38
|
+
consumptionCombined: `{{consumptionCombined}} l/100km (komb)*`,
|
|
39
|
+
co2: `{{co2}} g CO2/km (komb)*`,
|
|
40
|
+
new: 'neu'
|
|
41
|
+
},
|
|
42
|
+
title: {
|
|
43
|
+
addOfferToMainSlide: 'Zum Schieberegler hinzufügen',
|
|
44
|
+
toOffer: 'zum Angebot',
|
|
45
|
+
monthlyFrom: 'monatlich ab',
|
|
46
|
+
financing: 'Finanzierung',
|
|
47
|
+
leasing: 'Leasing',
|
|
48
|
+
abo: 'Abo',
|
|
49
|
+
buy: 'Kaufen',
|
|
50
|
+
financingDescription: `Bei der Finanzierung zahlen Sie lediglich die Zinsen des Darlehens und einen geringen Tilgungsanteil.
|
|
51
|
+
Zum Vertragsende können Sie entscheiden, ob Sie den Restbetrag ablösen oder weiter finanzieren wollen.`,
|
|
52
|
+
leasingDescription: `Beim Leasing zahlen Sie lediglich die Zinsen des Darlehens und einen geringen
|
|
53
|
+
Tilgungsanteil. Zum Vertragsende geben Sie das Auto einfach wieder zurück.`,
|
|
54
|
+
aboDescription: `Bei diesem Auto-Abo ist bereits alles an Bord. Teil- und
|
|
55
|
+
Vollkasko sowie Haftpflicht sind inklusive, ebenso wie Wartungs- und Verschleißreparaturen.
|
|
56
|
+
Sie zahlen also nur Ihre Rate und Kraftstoff.`,
|
|
57
|
+
buyDescription: `Nach Kaufabschluss haben Sie die sofortigen
|
|
58
|
+
Eigentumsrechte und keine Finanzierungskosten. Als Eigentümer können Sie Ihr Fahrzeug zu
|
|
59
|
+
eigenen Konditionen weiter verkaufen und Änderungen vornehmen.`
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const resizableProps = {
|
|
64
|
+
minWidth: 150,
|
|
65
|
+
defaultSize: { width: 360, height: 'auto' }
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const IMAGE_URL = 'https://picsum.photos/400/300/?random';
|
|
69
|
+
const images = [];
|
|
70
|
+
for (let i = 0; i <= 10; i++) {
|
|
71
|
+
images.push({ url: `${IMAGE_URL}&tag=${Math.random()}`, description: '' });
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const VehicleSmallCardStory = withNamespaces('vehicleProps')(({ t }) => {
|
|
75
|
+
const dealershipsProps = {
|
|
76
|
+
language: 'de',
|
|
77
|
+
vehicleComponentName: 'landing',
|
|
78
|
+
showSlider: true,
|
|
79
|
+
showNewLabel: true,
|
|
80
|
+
src: 'http://placehold.jp/400x300.png?text=mainImage',
|
|
81
|
+
stats: {
|
|
82
|
+
imagesCount: 100,
|
|
83
|
+
isFavoured: true,
|
|
84
|
+
statsData: {
|
|
85
|
+
totalCarImpCount: 10,
|
|
86
|
+
totalFavCount: 20,
|
|
87
|
+
},
|
|
88
|
+
statsSize: 'xs'
|
|
89
|
+
},
|
|
90
|
+
title: {
|
|
91
|
+
make: 'Audi',
|
|
92
|
+
model: 'A4',
|
|
93
|
+
subModel: 'Shooting Brake',
|
|
94
|
+
},
|
|
95
|
+
info: {
|
|
96
|
+
mileage: 10464,
|
|
97
|
+
regDate: 1535760000,
|
|
98
|
+
gearbox: 'selector_gearbox_automatic'
|
|
99
|
+
},
|
|
100
|
+
environmentEmissions: {
|
|
101
|
+
co2: 8.7
|
|
102
|
+
},
|
|
103
|
+
consumption: {
|
|
104
|
+
consumptionCombined: 9.6,
|
|
105
|
+
consumptionPowerCombined: null,
|
|
106
|
+
fuel: 'selector_fuel_hybridElectricalDiesel'
|
|
107
|
+
},
|
|
108
|
+
engineData: {
|
|
109
|
+
cubicCapacity: 1968,
|
|
110
|
+
cylinders: 0,
|
|
111
|
+
particulateFilterDiesel: true,
|
|
112
|
+
powerKW: 140,
|
|
113
|
+
powerPS: 190,
|
|
114
|
+
startStopSystem: true,
|
|
115
|
+
},
|
|
116
|
+
offer : {
|
|
117
|
+
availabilityFrom: null,
|
|
118
|
+
availabilityMode: "selector_availabilityMode_always",
|
|
119
|
+
deliveryPeriod: "selector_unknown"
|
|
120
|
+
},
|
|
121
|
+
price: {
|
|
122
|
+
monthlyInstallment: 29,
|
|
123
|
+
oldMonthlyInstallment: 49,
|
|
124
|
+
isStrikeShown: true,
|
|
125
|
+
currency: "EUR",
|
|
126
|
+
currentSalesPrice: 16160,
|
|
127
|
+
historyPriceDifference: 5629.6,
|
|
128
|
+
historyPriceDifferencePerCent: 26,
|
|
129
|
+
mlCurrentSalesPriceCategory: null,
|
|
130
|
+
mlCurrentSalesPriceDiffPercent: null,
|
|
131
|
+
mlCurrentSalesPricePredicted: 100,
|
|
132
|
+
totalCurrent: 50,
|
|
133
|
+
originalSalesPrice: 13467,
|
|
134
|
+
priceDate: null,
|
|
135
|
+
priceId: null,
|
|
136
|
+
recomendedRetailPrice: null,
|
|
137
|
+
retailToCurrentPriceDifference: 0,
|
|
138
|
+
vatDeductible: null,
|
|
139
|
+
vatRate: 7,
|
|
140
|
+
wasPrice: 10000,
|
|
141
|
+
financing: {
|
|
142
|
+
annualPercentageRate: "",
|
|
143
|
+
bank: "",
|
|
144
|
+
closingCosts: null,
|
|
145
|
+
conditions: null,
|
|
146
|
+
finalInstallment: null,
|
|
147
|
+
financingBank: "",
|
|
148
|
+
firstInstallment: 0,
|
|
149
|
+
grossLoanAmount: "",
|
|
150
|
+
monthlyInstallment: 108,
|
|
151
|
+
netLoanAmount: "",
|
|
152
|
+
nominalInterestRate: "",
|
|
153
|
+
paybackPeriod: "24",
|
|
154
|
+
paymentProtectionInsurance: "",
|
|
155
|
+
platformFinancingId: null,
|
|
156
|
+
transportationCosts: "",
|
|
157
|
+
typeOfNominalInterestRate: null
|
|
158
|
+
},
|
|
159
|
+
leasing: {
|
|
160
|
+
RWG: 10,
|
|
161
|
+
addServicesCost: 799,
|
|
162
|
+
annualMileage: null,
|
|
163
|
+
closingCosts: null,
|
|
164
|
+
financialInstitution: null,
|
|
165
|
+
firstInstallment: null,
|
|
166
|
+
leasingMode: "default",
|
|
167
|
+
maxAge: null,
|
|
168
|
+
maxMileage: null,
|
|
169
|
+
nominalInterestRate: null,
|
|
170
|
+
paybackPeriod: null,
|
|
171
|
+
paymentProtectionInsurance: null,
|
|
172
|
+
purchasePrice: null,
|
|
173
|
+
santanderPayBackMin: 250,
|
|
174
|
+
transportationCost: null
|
|
175
|
+
},
|
|
176
|
+
buy: {
|
|
177
|
+
currentSalesPriceExtra: 16110,
|
|
178
|
+
highestPriceExtra: 19349
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
seoText: 'Small Car, Diesel, Manual, Gear Box, HU 06/2008, Small Car, Diesel, Manual, Gear Box, HU 06/2008, Small Car, Diesel, Manual, Gear Box, HU 06/2008, Small Car, Diesel, Manual, Gear Box, HU 06/2008, Diesel, Manual, Gear Box, HU 06/2008, Diesel, Manual, Gear Box, HU 06/2008, Diesel, Manual, Gear Box, HU 06/2008,Small Car, Diesel, Manual, Gear Box, HU 06/2008, Small Car, Diesel, Manual, Gear Box, HU 06/2008, Small Car, Diesel, Manual, Gear Box, HU 06/2008, Small Car, Diesel, Manual, Gear Box, HU 06/2008, Diesel, Manual, Gear Box, HU 06/2008, Diesel, Manual, Gear Box, HU 06/2008, Diesel, Manual, Gear Box, HU 06/2008',
|
|
182
|
+
onFinancingClick: action('financing click'),
|
|
183
|
+
onContainerClick: action('container click'),
|
|
184
|
+
onFavoriteClick: action('favorite click'),
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<>
|
|
189
|
+
<div className={styles.wrapper}>
|
|
190
|
+
<Resizable {...resizableProps}>
|
|
191
|
+
<VehicleSmallCardForDealerships {...dealershipsProps} />
|
|
192
|
+
</Resizable>
|
|
193
|
+
</div>
|
|
194
|
+
</>
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
storiesOf('VehicleSmallCardForDealerships', module).add('VehicleSmallCardForDealerships', () => <VehicleSmallCardStory />);
|
package/source/components/VehicleSmallCardForDealerships/VehicleSmallCardForDealerships.story.styl
ADDED
|
@@ -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,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
|
|
5
|
+
import Accordion from './Accordion';
|
|
6
|
+
|
|
7
|
+
const Label = ({ opened }) => (
|
|
8
|
+
<div style={{ padding: 10, borderBottom: '1px solid lightgray' }}>
|
|
9
|
+
{opened ? '-' : '+'} Some label here.
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
const Content = ({ opened }) => (
|
|
14
|
+
<div style={{ padding: 10 }}>
|
|
15
|
+
Wow some expandable content.
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const item = {
|
|
20
|
+
content: <Content />,
|
|
21
|
+
title: <Label />
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const props = {
|
|
25
|
+
// toggleMany: true,
|
|
26
|
+
defaultOpened: 0,
|
|
27
|
+
items: [item, item, item],
|
|
28
|
+
accordionName: 'storybookAccordion',
|
|
29
|
+
onPanelFocus: (panelKey) => action(`onPanelFocus ${panelKey}`),
|
|
30
|
+
onToggle: action('state changed')
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
storiesOf('_Common_UI', module)
|
|
34
|
+
.add('Accordion', () => (
|
|
35
|
+
<Accordion {...props} />
|
|
36
|
+
));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
import { ROW_STYLES } from '../../../framework/constants';
|
|
5
|
+
import styles from './Badge.story.styl';
|
|
6
|
+
import Badge from './Badge';
|
|
7
|
+
|
|
8
|
+
storiesOf('_Common_UI', module)
|
|
9
|
+
.add('Badge', () => (
|
|
10
|
+
<div>
|
|
11
|
+
<div style={ROW_STYLES}>
|
|
12
|
+
<Badge>Push me </Badge>
|
|
13
|
+
</div>
|
|
14
|
+
<div style={ROW_STYLES}>
|
|
15
|
+
<Badge type='blue'>And then just</Badge>
|
|
16
|
+
</div>
|
|
17
|
+
<div style={ROW_STYLES}>
|
|
18
|
+
<Badge type='grey'>Touch me</Badge>
|
|
19
|
+
</div>
|
|
20
|
+
<div style={ROW_STYLES}>
|
|
21
|
+
<Badge type='green'>Until i get my</Badge>
|
|
22
|
+
</div>
|
|
23
|
+
<div style={ROW_STYLES}>
|
|
24
|
+
<Badge type='green' className={styles.customClass}>Until i get my</Badge>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
));
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import Bubble from './Bubble';
|
|
5
|
+
|
|
6
|
+
const stories = [
|
|
7
|
+
{
|
|
8
|
+
props: {
|
|
9
|
+
size: 'large',
|
|
10
|
+
type: 'orange',
|
|
11
|
+
children: <div style={{ display: 'flex', flexDirection: 'column' }}>
|
|
12
|
+
<span style={{ fontSize: 40, fontWeight: 700 }}>30 %</span>
|
|
13
|
+
<span style={{ fontSize: 24, fontWeight: 700 }}>SPAREN</span>
|
|
14
|
+
</div>
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
props: {
|
|
19
|
+
size: 'medium',
|
|
20
|
+
type: 'green',
|
|
21
|
+
children: <div style={{ display: 'flex', flexDirection: 'column', textAlign: 'center' }}>
|
|
22
|
+
<span style={{ fontSize: 24, fontWeight: 700 }}>Jahre</span>
|
|
23
|
+
<span style={{ fontSize: 14 }}>GARANTIE</span>
|
|
24
|
+
</div>
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
props: {
|
|
29
|
+
size: 'small',
|
|
30
|
+
type: 'yellow',
|
|
31
|
+
children: <span>0</span>
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
props: {
|
|
36
|
+
size: 'tiny',
|
|
37
|
+
type: 'orange',
|
|
38
|
+
children: <span style={{ fontSize: 12 }}>0</span>
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
storiesOf('_Common_UI', module)
|
|
44
|
+
.add('Bubble', () => (
|
|
45
|
+
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
|
46
|
+
{stories.map(({ props }) => (
|
|
47
|
+
<div>
|
|
48
|
+
<Bubble {...props} />
|
|
49
|
+
</div>
|
|
50
|
+
))}
|
|
51
|
+
</div>
|
|
52
|
+
));
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
import { action } from '@storybook/addon-actions';
|
|
5
|
+
import { ROW_STYLES } from '../../../framework/constants';
|
|
6
|
+
|
|
7
|
+
import Button from './Button.tsx';
|
|
8
|
+
import styles from './Button.story.styl';
|
|
9
|
+
|
|
10
|
+
const btnDefault = {
|
|
11
|
+
loading: false,
|
|
12
|
+
disabled: false,
|
|
13
|
+
|
|
14
|
+
onClick: action('button click'),
|
|
15
|
+
onHover: action('button hover'),
|
|
16
|
+
|
|
17
|
+
onMouseEnter: action('button mouse enter'),
|
|
18
|
+
onMouseLeave: action('button mouse leave')
|
|
19
|
+
};
|
|
20
|
+
const btnSecondary = Object.assign({}, btnDefault, { color: 'primary' });
|
|
21
|
+
const btnDanger = Object.assign({}, btnDefault, { color: 'secondary' });
|
|
22
|
+
const btnGhost = Object.assign({}, btnDefault, { color: 'primary', variant: 'outlined' });
|
|
23
|
+
const btnLoading = Object.assign({}, btnDefault, { loading: true });
|
|
24
|
+
const btnDisabled = Object.assign({}, btnDefault, { disabled: true });
|
|
25
|
+
const btnCustomSize = Object.assign({}, btnDefault, { className: styles.button });
|
|
26
|
+
|
|
27
|
+
storiesOf('_Common_UI', module)
|
|
28
|
+
.add('Button', () => (
|
|
29
|
+
<div>
|
|
30
|
+
<div style={ROW_STYLES}>
|
|
31
|
+
<Button {...btnDefault }>Push me </Button>
|
|
32
|
+
</div>
|
|
33
|
+
<div style={ROW_STYLES}>
|
|
34
|
+
<Button {...btnSecondary}>And then just</Button>
|
|
35
|
+
</div>
|
|
36
|
+
<div style={ROW_STYLES}>
|
|
37
|
+
<Button {...btnDanger} color='secondary'>Touch me</Button>
|
|
38
|
+
</div>
|
|
39
|
+
<div style={ROW_STYLES}>
|
|
40
|
+
<Button {...btnGhost} color='primary' variant='outlined'>Touch me</Button>
|
|
41
|
+
</div>
|
|
42
|
+
<div style={ROW_STYLES}>
|
|
43
|
+
<Button {...btnDisabled}>Until i get my</Button>
|
|
44
|
+
</div>
|
|
45
|
+
<div style={ROW_STYLES}>
|
|
46
|
+
<Button {...btnLoading}>Until i get my</Button>
|
|
47
|
+
</div>
|
|
48
|
+
<div style={ROW_STYLES}>
|
|
49
|
+
<Button {...btnCustomSize}>satisfaction, satisfaction, satisfaction</Button>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
));
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
import { action } from '@storybook/addon-actions';
|
|
5
|
+
import { ROW_STYLES } from '../../../framework/constants';
|
|
6
|
+
|
|
7
|
+
import Button from './Button.tsx';
|
|
8
|
+
import styles from './Button.story.styl';
|
|
9
|
+
|
|
10
|
+
const btnDefault = {
|
|
11
|
+
type: 'primary',
|
|
12
|
+
|
|
13
|
+
loading: false,
|
|
14
|
+
disabled: false,
|
|
15
|
+
|
|
16
|
+
onClick: action('button click'),
|
|
17
|
+
onHover: action('button hover'),
|
|
18
|
+
|
|
19
|
+
onMouseEnter: action('button mouse enter'),
|
|
20
|
+
onMouseLeave: action('button mouse leave')
|
|
21
|
+
};
|
|
22
|
+
const btnSecondary = Object.assign({}, btnDefault, { type: 'secondary' });
|
|
23
|
+
const btnDanger = Object.assign({}, btnDefault, { type: 'danger' });
|
|
24
|
+
const btnGhost = Object.assign({}, btnDefault, { type: 'ghost' });
|
|
25
|
+
const btnLoading = Object.assign({}, btnDefault, { loading: true });
|
|
26
|
+
const btnDisabled = Object.assign({}, btnDefault, { disabled: true });
|
|
27
|
+
const btnCustomSize = Object.assign({}, btnDefault, { className: styles.button });
|
|
28
|
+
|
|
29
|
+
storiesOf('_Common_UI', module)
|
|
30
|
+
.add('ButtonOld', () => (
|
|
31
|
+
<div>
|
|
32
|
+
<div style={ROW_STYLES}>
|
|
33
|
+
<Button {...btnDefault}>Push me </Button>
|
|
34
|
+
</div>
|
|
35
|
+
<div style={ROW_STYLES}>
|
|
36
|
+
<Button {...btnSecondary}>And then just</Button>
|
|
37
|
+
</div>
|
|
38
|
+
<div style={ROW_STYLES}>
|
|
39
|
+
<Button {...btnDanger}>Touch me</Button>
|
|
40
|
+
</div>
|
|
41
|
+
<div style={ROW_STYLES}>
|
|
42
|
+
<Button {...btnGhost}>Touch me</Button>
|
|
43
|
+
</div>
|
|
44
|
+
<div style={ROW_STYLES}>
|
|
45
|
+
<Button {...btnDisabled}>Until i get my</Button>
|
|
46
|
+
</div>
|
|
47
|
+
<div style={ROW_STYLES}>
|
|
48
|
+
<Button {...btnLoading}>Until i get my</Button>
|
|
49
|
+
</div>
|
|
50
|
+
<div style={ROW_STYLES}>
|
|
51
|
+
<Button {...btnCustomSize}>satisfaction, satisfaction, satisfaction</Button>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
));
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
|
|
5
|
+
import { ROW_STYLES } from '../../../framework/constants';
|
|
6
|
+
import Checkbox from './Checkbox';
|
|
7
|
+
import FormCheckbox from './FormCheckbox';
|
|
8
|
+
|
|
9
|
+
import styles from './Checkbox.story.styl';
|
|
10
|
+
|
|
11
|
+
// Props related to FormCheckbox stories
|
|
12
|
+
const basePropsForm = {
|
|
13
|
+
field: { bind: () => { } },
|
|
14
|
+
label: 'Some label here'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const withErrorForm = {
|
|
18
|
+
field: { bind: () => { }, hasError: true, error: 'Something went wrong'},
|
|
19
|
+
label: 'Some label here',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const CheckboxWrap = () => {
|
|
23
|
+
const [checked, setChecked] = useState(false);
|
|
24
|
+
|
|
25
|
+
// Props related to the Checkbox stories
|
|
26
|
+
const baseProps = {
|
|
27
|
+
checked,
|
|
28
|
+
value: 'some bitchy value',
|
|
29
|
+
label: <span>wow, so label!</span>,
|
|
30
|
+
onChange: (e, checked) => {
|
|
31
|
+
setChecked(checked => !checked);
|
|
32
|
+
},
|
|
33
|
+
onFocus: action('checkbox focus'),
|
|
34
|
+
onBlur: action('checkbox blur')
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
const disabledChecked = Object.assign({}, baseProps, { disabled: true });
|
|
39
|
+
const reversedProps = Object.assign({}, baseProps, { reversed: true });
|
|
40
|
+
const disabledUnChecked = Object.assign({}, baseProps, { disabled: true, checked: true });
|
|
41
|
+
const withoutLabel = Object.assign({}, baseProps, { label: false, checked: !checked });
|
|
42
|
+
const errorProps = Object.assign({}, baseProps, { error: true });
|
|
43
|
+
const customLabel = Object.assign({}, baseProps, {
|
|
44
|
+
label: <div className={styles.label}><span className={styles.coupe} />Coupe</div>
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div>
|
|
49
|
+
<div style={ROW_STYLES}>
|
|
50
|
+
<Checkbox {...baseProps} />
|
|
51
|
+
</div>
|
|
52
|
+
<div style={ROW_STYLES}>
|
|
53
|
+
<Checkbox {...reversedProps} />
|
|
54
|
+
</div>
|
|
55
|
+
<div style={ROW_STYLES}>
|
|
56
|
+
<Checkbox {...disabledChecked} />
|
|
57
|
+
</div>
|
|
58
|
+
<div style={ROW_STYLES}>
|
|
59
|
+
<Checkbox {...disabledUnChecked} />
|
|
60
|
+
</div>
|
|
61
|
+
<div style={ROW_STYLES}>
|
|
62
|
+
<Checkbox {...withoutLabel} />
|
|
63
|
+
</div>
|
|
64
|
+
<div style={ROW_STYLES}>
|
|
65
|
+
<Checkbox {...errorProps} />
|
|
66
|
+
</div>
|
|
67
|
+
<div style={ROW_STYLES}>
|
|
68
|
+
<Checkbox {...customLabel} />
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
storiesOf('_Common_UI', module)
|
|
75
|
+
.add('Checkbox', () => <CheckboxWrap />)
|
|
76
|
+
.add('FormCheckbox', () => (
|
|
77
|
+
<div>
|
|
78
|
+
<div style={ROW_STYLES}>
|
|
79
|
+
<FormCheckbox {...basePropsForm} />
|
|
80
|
+
</div>
|
|
81
|
+
<div style={ROW_STYLES}>
|
|
82
|
+
<FormCheckbox {...withErrorForm} />
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
));
|