@bytebrand/fe-ui-core 4.8.49 → 4.8.51
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 +2 -5
- package/source/components/AccordionWidget/AccordionWidget.styl +1 -0
- package/source/components/AccordionWidget/AccordionWidget.tsx +8 -4
- 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 +1 -1
- package/source/components/OfferPanel/OfferCheckboxGroup/OfferCheckboxGroup.styl +24 -0
- package/source/components/OfferPanel/OfferCheckboxGroup/OfferCheckboxGroup.tsx +1 -1
- 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 +23 -11
- package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.story.js +120 -0
- package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.tsx +2 -0
- package/source/components/VehicleDetailedSlider/partials/PriceData.tsx +7 -4
- 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 +5 -0
- package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.tsx +3 -1
- package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.styl +1 -1
- package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.tsx +24 -11
- package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.styl +3 -2
- 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.tsx +14 -3
- 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 +1 -1
- 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.tsx +1 -1
- package/source/framework/DataTransformers.ts +1 -0
- package/source/framework/constants/common.ts +8 -4
- package/source/framework/types/types.ts +1 -0
- package/source/framework/vehiclesProps/decoratedLightProps.tsx +48 -12
- package/source/framework/vehiclesProps/decoratedProps.tsx +35 -8
- package/source/locales/data.ts +3 -0
- package/bytebrand-fe-ui-core-4.8.47.tgz +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import MaterialSwitch from './MaterialSwitch';
|
|
4
|
+
|
|
5
|
+
const Switch = () => {
|
|
6
|
+
const [value, setValue] = useState(false);
|
|
7
|
+
|
|
8
|
+
const onChange = (checked) => {
|
|
9
|
+
setValue(checked);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
return <MaterialSwitch value={value} onChange={onChange} label='switcher' />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
storiesOf('_Common_UI', module)
|
|
17
|
+
.add('MaterialSwitch', () => <Switch />)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import MaterialTooltip from './MaterialTooltip';
|
|
4
|
+
|
|
5
|
+
const Tooltip = () => {
|
|
6
|
+
return <MaterialTooltip text='info text' icon='infoIcon' />
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
storiesOf('_Common_UI', module)
|
|
10
|
+
.add('MaterialTooltip', () => <Tooltip />)
|
|
@@ -7,7 +7,7 @@ import ClickAwayListener from '@mui/material/ClickAwayListener';
|
|
|
7
7
|
import { debounce } from 'lodash';
|
|
8
8
|
|
|
9
9
|
interface IMaterialTooltip {
|
|
10
|
-
text:
|
|
10
|
+
text: React.ReactNode;
|
|
11
11
|
icon?: string;
|
|
12
12
|
className?: string;
|
|
13
13
|
placement?: 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import useModal from '../../../framework/hooks/useModal';
|
|
4
|
+
|
|
5
|
+
import Modal from './Modal';
|
|
6
|
+
|
|
7
|
+
const ModalComponent = () => {
|
|
8
|
+
const { isVisible, toggleModal } = useModal();
|
|
9
|
+
const [modal, setModal] = useState('');
|
|
10
|
+
|
|
11
|
+
const onClearModalState = () => {
|
|
12
|
+
setModal('');
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const onOpenCookieModal = () => {
|
|
16
|
+
setModal('PREVIEW_COOKIE_MODAL');
|
|
17
|
+
toggleModal();
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const modalProps = {
|
|
21
|
+
onClearModalState,
|
|
22
|
+
setModal
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
<button onClick={onOpenCookieModal}>
|
|
28
|
+
open modal
|
|
29
|
+
</button>
|
|
30
|
+
<Modal isVisible={isVisible} toggleModal={toggleModal} name={modal} modalProps={modalProps} />
|
|
31
|
+
</>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
storiesOf('_Common_UI', module)
|
|
37
|
+
.add('Modal', () => <ModalComponent />)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Resizable } from 're-resizable';
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
// Components
|
|
5
|
+
import MuiGroupedSelect from './MuiGroupedSelect';
|
|
6
|
+
|
|
7
|
+
const resizableProps = {
|
|
8
|
+
defaultSize: { width: 360, height: 700 }
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const MuiFieldWrapper = () => {
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Resizable {...resizableProps}>
|
|
15
|
+
<MuiGroupedSelect />
|
|
16
|
+
</Resizable>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
storiesOf('_Common_UI', module)
|
|
21
|
+
.add('MuiGroupedSelect', () => <MuiFieldWrapper />)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
|
|
5
|
+
import PropertySelector from './PropertySelector';
|
|
6
|
+
import PSGroup from './PSGroup';
|
|
7
|
+
|
|
8
|
+
import styles from './PSGroup.story.styl';
|
|
9
|
+
|
|
10
|
+
export class PSGroupDefault extends React.Component {
|
|
11
|
+
state = {
|
|
12
|
+
value: ['always']
|
|
13
|
+
};
|
|
14
|
+
action = action('change');
|
|
15
|
+
|
|
16
|
+
onChange = (event, value) => {
|
|
17
|
+
// value here have to be single string|number or array
|
|
18
|
+
this.action(event, value);
|
|
19
|
+
this.setState(() => ({ value }));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
render() {
|
|
23
|
+
return (
|
|
24
|
+
<PSGroup name='availability' behavior='checkbox' value={this.state.value} containerClassName={styles.default} onChange={this.onChange}>
|
|
25
|
+
<PropertySelector value='1' content='cbd_selector_exterior_color_brown' label='Brown' type='color' />
|
|
26
|
+
<PropertySelector value='2' content='cbd_selector_exterior_color_blue' label='Blue' type='color' />
|
|
27
|
+
<PropertySelector value='3' content='cbd_selector_exterior_color_green' label='Green' type='color' disabled={true} />
|
|
28
|
+
</PSGroup>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class PSGroupHorizontal extends React.Component {
|
|
34
|
+
state = {
|
|
35
|
+
value: ['M_Sport']
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
action = action('change');
|
|
39
|
+
onChange = (event, value) => {
|
|
40
|
+
this.action(event, value);
|
|
41
|
+
this.setState(() => ({ value }));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
renderSubModel = (index) => {
|
|
45
|
+
const models = ['320 | 2.0 | Automatic', '320 | 2.0 | Diesel', '320 | 2.0'];
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div className={styles.equipment}>
|
|
49
|
+
<div className={styles.column}>
|
|
50
|
+
<span className={styles.value}>
|
|
51
|
+
{models[index]}
|
|
52
|
+
</span>
|
|
53
|
+
</div>
|
|
54
|
+
<div className={styles.column}>
|
|
55
|
+
<span className={styles.title}>
|
|
56
|
+
Power
|
|
57
|
+
</span>
|
|
58
|
+
<span className={styles.value}>
|
|
59
|
+
184 PS / 138 KW
|
|
60
|
+
</span>
|
|
61
|
+
</div>
|
|
62
|
+
<div className={styles.column}>
|
|
63
|
+
<span className={styles.title}>
|
|
64
|
+
Built by
|
|
65
|
+
</span>
|
|
66
|
+
<span className={styles.value}>
|
|
67
|
+
7/2015 – 12/2018
|
|
68
|
+
</span>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
render() {
|
|
75
|
+
return (
|
|
76
|
+
<PSGroup name='sub_model' behavior='radio' containerClassName={styles.horizontal} childClassName={styles.horizontalChild} value={this.state.value} onChange={this.onChange}>
|
|
77
|
+
<PropertySelector label={this.renderSubModel(0)} value='M_Sport' />
|
|
78
|
+
<PropertySelector label={this.renderSubModel(1)} value='M_Sport_Coupe' />
|
|
79
|
+
<PropertySelector label={this.renderSubModel(2)} value='M_Sport_Diesel' />
|
|
80
|
+
</PSGroup>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
storiesOf('_Common_UI', module)
|
|
86
|
+
.add('PSGroup', () => (
|
|
87
|
+
<div>
|
|
88
|
+
<p className={styles.text}>Checkbox behavior</p>
|
|
89
|
+
<PSGroupDefault />
|
|
90
|
+
<p className={styles.text}>Radio button behavior</p>
|
|
91
|
+
<PSGroupHorizontal />
|
|
92
|
+
</div>
|
|
93
|
+
));
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@import '../../../theme/theme.styl'
|
|
2
|
+
|
|
3
|
+
.default
|
|
4
|
+
composes: default
|
|
5
|
+
display: flex
|
|
6
|
+
flex-direction: column
|
|
7
|
+
|
|
8
|
+
.horizontal
|
|
9
|
+
border: 1px solid lightgray
|
|
10
|
+
padding: 10px
|
|
11
|
+
border-radius: 5px
|
|
12
|
+
margin-bottom: 20px
|
|
13
|
+
display: flex
|
|
14
|
+
flex-direction: row
|
|
15
|
+
align-items: center
|
|
16
|
+
justify-content: space-between
|
|
17
|
+
|
|
18
|
+
.horizontalChild
|
|
19
|
+
margin-bottom: 0 !important
|
|
20
|
+
margin-right: 10px
|
|
21
|
+
|
|
22
|
+
.text
|
|
23
|
+
font-family: $font-style-arial
|
|
24
|
+
font-size: $font-size-h3
|
|
25
|
+
font-weight: $font-weight-medium
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
import { action } from '@storybook/addon-actions';
|
|
5
|
+
|
|
6
|
+
import PropertySelector from './PropertySelector';
|
|
7
|
+
import { CONTAINER_STYLES, ROW_STYLES, COLUMN_STYLES } from '../../../framework/constants';
|
|
8
|
+
import { EXTERIOR_COLORS } from '../../../framework/constants/selectors';
|
|
9
|
+
|
|
10
|
+
const renderColors = () => EXTERIOR_COLORS.map((color, index) => {
|
|
11
|
+
const props = {
|
|
12
|
+
type: 'color',
|
|
13
|
+
checked: index === 2 || index === 3,
|
|
14
|
+
name: color,
|
|
15
|
+
value: color,
|
|
16
|
+
|
|
17
|
+
content: color,
|
|
18
|
+
label: <span>wow so label. <b>much content</b></span>,
|
|
19
|
+
|
|
20
|
+
tooltip: 'some text here',
|
|
21
|
+
onChange: action('change')
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return index < 5 ? (
|
|
25
|
+
<div key={index} style={ROW_STYLES}>
|
|
26
|
+
<PropertySelector {...props} />
|
|
27
|
+
</div>
|
|
28
|
+
) : false;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const renderIcons = () => {
|
|
32
|
+
const props = {
|
|
33
|
+
type: 'icon',
|
|
34
|
+
name: 'icon',
|
|
35
|
+
checked: true,
|
|
36
|
+
label: <span>wow so label. <b>much content</b></span>,
|
|
37
|
+
|
|
38
|
+
content: <span></span>,
|
|
39
|
+
onChange: action('change')
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div style={ROW_STYLES}>
|
|
44
|
+
<PropertySelector {...props} />
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const renderText = () => [...Array(5)].map((item, index) => {
|
|
50
|
+
const props = {
|
|
51
|
+
type: 'text',
|
|
52
|
+
checked: index === 1,
|
|
53
|
+
name: index,
|
|
54
|
+
|
|
55
|
+
content: index === 0 ? 'All' : index,
|
|
56
|
+
label: <span>wow so label. <b>much content</b></span>,
|
|
57
|
+
|
|
58
|
+
tooltip: 'some text here',
|
|
59
|
+
onChange: action('change')
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div key={index} style={ROW_STYLES}>
|
|
64
|
+
<PropertySelector {...props} />
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
storiesOf('_Common_UI', module)
|
|
71
|
+
.add('PropertySelector', () => (
|
|
72
|
+
<div style={CONTAINER_STYLES}>
|
|
73
|
+
<div style={COLUMN_STYLES}>
|
|
74
|
+
{renderColors()}
|
|
75
|
+
</div>
|
|
76
|
+
<div style={COLUMN_STYLES}>
|
|
77
|
+
{renderIcons()}
|
|
78
|
+
</div>
|
|
79
|
+
<div style={COLUMN_STYLES}>
|
|
80
|
+
{renderText()}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
|
|
5
|
+
import Radio from './Radio';
|
|
6
|
+
import FormRadioGroup from './FormRadioGroup';
|
|
7
|
+
import styles from './FormRadioGroup.story.styl';
|
|
8
|
+
|
|
9
|
+
const mockField = {
|
|
10
|
+
name: 'availability',
|
|
11
|
+
value: 'always',
|
|
12
|
+
error: 'Something went wrong',
|
|
13
|
+
hasError: true,
|
|
14
|
+
onChange: action('FormRadioGroup change'),
|
|
15
|
+
bind: () => {
|
|
16
|
+
const { bind, ...rest } = mockField;
|
|
17
|
+
return rest;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
storiesOf('_Common_UI', module)
|
|
22
|
+
.add('FormRadioGroup', () => (
|
|
23
|
+
<FormRadioGroup field={mockField} childClassName={styles.child}>
|
|
24
|
+
<Radio label='Available always' value='always'/>
|
|
25
|
+
<Radio label='Available from' value='fromDate'/>
|
|
26
|
+
<Radio label='Unknown' value='unknown' disabled={true}/>
|
|
27
|
+
</FormRadioGroup>
|
|
28
|
+
));
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
|
|
5
|
+
import { ROW_STYLES, COLUMN_STYLES } from '../../../framework/constants';
|
|
6
|
+
import Radio from './Radio';
|
|
7
|
+
import RadioGroup from './RadioGroup';
|
|
8
|
+
//import FormCheckbox from './FormCheckbox';
|
|
9
|
+
|
|
10
|
+
//import styles from './Checkbox.story.styl';
|
|
11
|
+
|
|
12
|
+
// Props related to FormCheckbox stories
|
|
13
|
+
//const basePropsForm = {
|
|
14
|
+
// field: { bind: () => { } },
|
|
15
|
+
// label: 'Some label here'
|
|
16
|
+
//};
|
|
17
|
+
//
|
|
18
|
+
//const withErrorForm = {
|
|
19
|
+
// field: { bind: () => { }, hasError: true, error: 'Something went wrong'},
|
|
20
|
+
// label: 'Some label here',
|
|
21
|
+
//};
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
// Props related to the Checkbox stories
|
|
25
|
+
const baseProps = {
|
|
26
|
+
name: 'bitch',
|
|
27
|
+
checked: false,
|
|
28
|
+
value: 'some bitchy value',
|
|
29
|
+
label: <span>wow, so label!</span>,
|
|
30
|
+
|
|
31
|
+
onChange: action('checkbox change'),
|
|
32
|
+
onFocus: action('checkbox focus'),
|
|
33
|
+
onBlur: action('checkbox blur')
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
storiesOf('_Common_UI', module)
|
|
37
|
+
.add('Radio', () => (
|
|
38
|
+
<div>
|
|
39
|
+
<div style={ROW_STYLES}>
|
|
40
|
+
<div style={COLUMN_STYLES}>
|
|
41
|
+
<Radio {...baseProps} checked={true} />
|
|
42
|
+
</div>
|
|
43
|
+
<div style={COLUMN_STYLES}>
|
|
44
|
+
<Radio {...baseProps} disabled={true} />
|
|
45
|
+
</div>
|
|
46
|
+
<div style={COLUMN_STYLES}>
|
|
47
|
+
<Radio {...baseProps} error={true} />
|
|
48
|
+
</div>
|
|
49
|
+
<div style={COLUMN_STYLES}>
|
|
50
|
+
<Radio {...baseProps} checked={true} disabled={true} />
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
));
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
|
|
5
|
+
import Radio from './Radio';
|
|
6
|
+
import RadioGroup from './RadioGroup';
|
|
7
|
+
|
|
8
|
+
import styles from './RadioGroup.story.styl';
|
|
9
|
+
|
|
10
|
+
export class RadioGroupDefault extends React.Component {
|
|
11
|
+
state = {
|
|
12
|
+
value: 'always'
|
|
13
|
+
};
|
|
14
|
+
action = action('change');
|
|
15
|
+
|
|
16
|
+
onChange = (event, value) => {
|
|
17
|
+
this.action(event, value);
|
|
18
|
+
this.setState(() => ({ value }));
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
render() {
|
|
22
|
+
return (
|
|
23
|
+
<RadioGroup name='availability' containerClassName={styles.default} value={this.state.value} onChange={this.onChange}>
|
|
24
|
+
<Radio label='Available always' value='always' />
|
|
25
|
+
<Radio label='Available from' value='fromDate' />
|
|
26
|
+
<Radio label='Unknown' value='unknown' disabled={true} />
|
|
27
|
+
</RadioGroup>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class RadioGroupVertical extends React.Component {
|
|
33
|
+
state = {
|
|
34
|
+
value: 'M_Sport'
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
action = action('change');
|
|
38
|
+
onChange = (event, value) => {
|
|
39
|
+
this.action(event, value);
|
|
40
|
+
this.setState(() => ({ value }));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
renderSubModel = (index) => {
|
|
44
|
+
const models = ['320 | 2.0 | Automatic', '320 | 2.0 | Diesel', '320 | 2.0'];
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div className={styles.equipment}>
|
|
48
|
+
<div className={styles.column}>
|
|
49
|
+
<span className={styles.value}>
|
|
50
|
+
{models[index]}
|
|
51
|
+
</span>
|
|
52
|
+
</div>
|
|
53
|
+
<div className={styles.column}>
|
|
54
|
+
<span className={styles.title}>
|
|
55
|
+
Power
|
|
56
|
+
</span>
|
|
57
|
+
<span className={styles.value}>
|
|
58
|
+
184 PS / 138 KW
|
|
59
|
+
</span>
|
|
60
|
+
</div>
|
|
61
|
+
<div className={styles.column}>
|
|
62
|
+
<span className={styles.title}>
|
|
63
|
+
Built by
|
|
64
|
+
</span>
|
|
65
|
+
<span className={styles.value}>
|
|
66
|
+
7/2015 – 12/2018
|
|
67
|
+
</span>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
render() {
|
|
74
|
+
return (
|
|
75
|
+
<RadioGroup name='sub_model' containerClassName={styles.vertical} childClassName={styles.verticalChild} value={this.state.value} onChange={this.onChange}>
|
|
76
|
+
<Radio label={this.renderSubModel(0)} value='M_Sport' />
|
|
77
|
+
<Radio label={this.renderSubModel(1)} value='M_Sport_Coupe' />
|
|
78
|
+
<Radio label={this.renderSubModel(2)} value='M_Sport_Diesel' />
|
|
79
|
+
</RadioGroup>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
storiesOf('_Common_UI', module)
|
|
85
|
+
.add('RadioGroup', () => (
|
|
86
|
+
<div>
|
|
87
|
+
<RadioGroupDefault />
|
|
88
|
+
<RadioGroupVertical />
|
|
89
|
+
</div>
|
|
90
|
+
));
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.default
|
|
2
|
+
border: 1px solid lightgray
|
|
3
|
+
padding: 10px
|
|
4
|
+
border-radius: 5px
|
|
5
|
+
margin-bottom: 20px
|
|
6
|
+
display: flex
|
|
7
|
+
flex-direction: row
|
|
8
|
+
align-items: center
|
|
9
|
+
justify-content: space-between
|
|
10
|
+
|
|
11
|
+
.vertical
|
|
12
|
+
composes: default
|
|
13
|
+
display: flex
|
|
14
|
+
flex-direction: column
|
|
15
|
+
align-items: center
|
|
16
|
+
padding: 10px
|
|
17
|
+
|
|
18
|
+
.verticalChild:not(:last-of-type)
|
|
19
|
+
margin-bottom: 10px
|
|
20
|
+
|
|
21
|
+
.equipment
|
|
22
|
+
display: flex
|
|
23
|
+
flex-direction: row
|
|
24
|
+
align-items: center
|
|
25
|
+
justify-content: space-between
|
|
26
|
+
min-width: 500px
|
|
27
|
+
|
|
28
|
+
.column
|
|
29
|
+
display: flex
|
|
30
|
+
flex-direction: column
|
|
31
|
+
align-items: stretch
|
|
32
|
+
width: 150px
|
|
33
|
+
|
|
34
|
+
.title
|
|
35
|
+
font-size: 10px
|
|
36
|
+
|
|
37
|
+
.value
|
|
38
|
+
font-size: 14px
|
|
39
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
import { action } from '@storybook/addon-actions';
|
|
5
|
+
import Range from './Range';
|
|
6
|
+
import { Tooltip } from '@mui/material';
|
|
7
|
+
|
|
8
|
+
import styles from './Range.story.styl';
|
|
9
|
+
|
|
10
|
+
const RangeWrapper = () => {
|
|
11
|
+
const [value, setValue] = useState(300);
|
|
12
|
+
|
|
13
|
+
const onChange = (value) => {
|
|
14
|
+
setValue(value);
|
|
15
|
+
action('onChange');
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const ValueLabelComponent = (props) => {
|
|
19
|
+
const { children, value } = props;
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Tooltip enterTouchDelay={0} placement='top' title={value}>
|
|
23
|
+
{children}
|
|
24
|
+
</Tooltip>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const props = {
|
|
29
|
+
value,
|
|
30
|
+
components: {
|
|
31
|
+
ValueLabel: ValueLabelComponent
|
|
32
|
+
},
|
|
33
|
+
onChange,
|
|
34
|
+
min: 0,
|
|
35
|
+
max: 10000,
|
|
36
|
+
step: 100
|
|
37
|
+
};
|
|
38
|
+
return (
|
|
39
|
+
<div className={styles.container}>
|
|
40
|
+
<Range {...props} />
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
storiesOf('_Common_UI', module)
|
|
46
|
+
.add('Range', () => <RangeWrapper />);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
import { action } from '@storybook/addon-actions';
|
|
5
|
+
import SliderArrow from './SliderArrow';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const props = {
|
|
9
|
+
direction: 'left',
|
|
10
|
+
onClick: action('slider arrow clicked')
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
storiesOf('_Common_UI', module)
|
|
14
|
+
.add('SliderArrow', () => (
|
|
15
|
+
<div>
|
|
16
|
+
<SliderArrow {...props} />
|
|
17
|
+
</div>
|
|
18
|
+
));
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Resizable } from 're-resizable';
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
import { action } from '@storybook/addon-actions';
|
|
5
|
+
import TabsComponent from './Tabs.tsx';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const wrapperProps = {
|
|
9
|
+
border: '1px solid rgba(0,0,0,0.1)',
|
|
10
|
+
borderRadius: '2px',
|
|
11
|
+
backgroundColor: '#fff'
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const resizableProps = {
|
|
15
|
+
defaultSize: { width: 'auto', height: 'auto' }
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const TabsStory = () => {
|
|
19
|
+
const [priceTabActiveIndex, setNewIndex] = useState(0);
|
|
20
|
+
|
|
21
|
+
const onTabPriceSelect = (event, priceTabActiveIndex) => {
|
|
22
|
+
setNewIndex(priceTabActiveIndex);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const tabsProps = {
|
|
26
|
+
priceTabActiveIndex,
|
|
27
|
+
onTabPriceSelect,
|
|
28
|
+
tabsTitles: [{
|
|
29
|
+
title: 'financing',
|
|
30
|
+
children: <span>financing</span>
|
|
31
|
+
}, {
|
|
32
|
+
title: 'leasing',
|
|
33
|
+
children: <span>leasing</span>
|
|
34
|
+
}, {
|
|
35
|
+
title: 'buy',
|
|
36
|
+
children: <span>buy</span>
|
|
37
|
+
}, {
|
|
38
|
+
title: 'abo',
|
|
39
|
+
isDisable: true,
|
|
40
|
+
children: <span>abo</span>
|
|
41
|
+
}],
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<>
|
|
46
|
+
<p>Tabs on CDP</p>
|
|
47
|
+
<div style={wrapperProps}>
|
|
48
|
+
<Resizable {...resizableProps}>
|
|
49
|
+
<TabsComponent {...tabsProps} />
|
|
50
|
+
</Resizable>
|
|
51
|
+
</div>
|
|
52
|
+
</>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
storiesOf('_Common_UI', module).add('Tabs', () => <TabsStory />);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { storiesOf } from '@storybook/react';
|
|
4
|
+
import TimePicker from './TimePicker';
|
|
5
|
+
|
|
6
|
+
const TimePickerStory = () => {
|
|
7
|
+
const [time, setTime] = useState(0);
|
|
8
|
+
const [day, setDay] = useState(0);
|
|
9
|
+
const [timestamp, setTimestamp] = useState('');
|
|
10
|
+
|
|
11
|
+
const onHandleTimeChange = (value) => {
|
|
12
|
+
setTime(value)
|
|
13
|
+
};
|
|
14
|
+
const onHandleDayChange = (value) => {
|
|
15
|
+
setDay(value)
|
|
16
|
+
};
|
|
17
|
+
const onHandleTimestampChange = (value) => {
|
|
18
|
+
setTimestamp(new Date(value))
|
|
19
|
+
};
|
|
20
|
+
return (
|
|
21
|
+
<TimePicker
|
|
22
|
+
style={{ background: '#fff', display: 'flex', justifyContent: 'space-between', width: '800px' }}
|
|
23
|
+
time={time}
|
|
24
|
+
day={day}
|
|
25
|
+
onHandleTimeChange={onHandleTimeChange}
|
|
26
|
+
onHandleDayChange={onHandleDayChange}
|
|
27
|
+
onHandleTimestampChange={onHandleTimestampChange}
|
|
28
|
+
lang='de'
|
|
29
|
+
t={phrase => phrase}
|
|
30
|
+
/>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
storiesOf('_Common_UI', module)
|
|
35
|
+
.add('TimePicker', () => (
|
|
36
|
+
<div style={{ background: '#fff', width: '350px', height: '100%' }}><TimePickerStory /></div>
|
|
37
|
+
));
|