@wayke-se/components-react 3.0.0-beta.11 → 3.0.0-beta.12

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 (274) hide show
  1. package/package.json +4 -2
  2. package/.editorconfig +0 -10
  3. package/.eslintrc.js +0 -62
  4. package/.github/workflows/release-to-production.yaml +0 -40
  5. package/.github/workflows/release-to-test.yaml +0 -40
  6. package/.prettierrc +0 -12
  7. package/assets/ajax-loader.gif +0 -0
  8. package/assets/default.css +0 -1
  9. package/assets/fonts/slick.eot +0 -0
  10. package/assets/fonts/slick.svg +0 -14
  11. package/assets/fonts/slick.ttf +0 -0
  12. package/assets/fonts/slick.woff +0 -0
  13. package/codegen.yml +0 -19
  14. package/esbuild/build.js +0 -39
  15. package/esbuild/common.js +0 -15
  16. package/esbuild/start.js +0 -21
  17. package/esbuild/www/index.html +0 -32
  18. package/example/src/@types/global.d.ts +0 -7
  19. package/example/src/@types/react-panellum.d.ts +0 -1
  20. package/example/src/App.tsx +0 -77
  21. package/example/src/assets/style/ecom.css +0 -63
  22. package/example/src/assets/style/theme.css +0 -83
  23. package/example/src/index.html +0 -26
  24. package/example/src/index.tsx +0 -11
  25. package/example/src/routes/HashRoute/index.tsx +0 -30
  26. package/example/src/routes/Home/index.tsx +0 -33
  27. package/example/src/routes/NotFound/index.tsx +0 -5
  28. package/example/src/routes/PathRoute/index.tsx +0 -35
  29. package/example/src/routes/Search/index.tsx +0 -28
  30. package/example/src/routes/SearchItem/index.tsx +0 -28
  31. package/example/src/routes/index.tsx +0 -25
  32. package/src/@types/action.ts +0 -3
  33. package/src/@types/codegen/types.ts +0 -366
  34. package/src/@types/filter.ts +0 -18
  35. package/src/@types/queryFilter.ts +0 -5
  36. package/src/@types/react-panellum.d.ts +0 -1
  37. package/src/@types/search.ts +0 -118
  38. package/src/@types/theme.d.ts +0 -5
  39. package/src/@types/vehicle-properties.ts +0 -33
  40. package/src/State/CentralStorage/CentralStorageContext.ts +0 -10
  41. package/src/State/CentralStorage/CentralStorageProvider.tsx +0 -21
  42. package/src/State/CentralStorage/useCentralStorage.ts +0 -37
  43. package/src/State/Path/PathContext.ts +0 -11
  44. package/src/State/Path/PathProvider.tsx +0 -66
  45. package/src/State/Path/reducer.ts +0 -30
  46. package/src/State/Path/usePath.ts +0 -13
  47. package/src/State/RelatedSearch/RelatedSearchContext.ts +0 -18
  48. package/src/State/RelatedSearch/RelatedSearchProvider.tsx +0 -55
  49. package/src/State/RelatedSearch/useRelatedSearch.ts +0 -20
  50. package/src/State/Search/SearchContext.ts +0 -27
  51. package/src/State/Search/SearchProvider.tsx +0 -243
  52. package/src/State/Search/useSearch.ts +0 -6
  53. package/src/State/Settings/SettingsContext.ts +0 -15
  54. package/src/State/Settings/SettingsProvider.tsx +0 -23
  55. package/src/State/Settings/useSettings.ts +0 -7
  56. package/src/components/Accordion/index.tsx +0 -57
  57. package/src/components/Accordion/wrapper.tsx +0 -107
  58. package/src/components/ActionList/index.tsx +0 -48
  59. package/src/components/ActionList/toggle-item.tsx +0 -59
  60. package/src/components/Avatar/index.tsx +0 -12
  61. package/src/components/Avatar/wrapper.tsx +0 -21
  62. package/src/components/Badge/index.tsx +0 -12
  63. package/src/components/Badge/wrapper.tsx +0 -32
  64. package/src/components/Blockquote/index.tsx +0 -32
  65. package/src/components/Blockquote/wrapper.tsx +0 -52
  66. package/src/components/Button/index.tsx +0 -226
  67. package/src/components/CheckMarkList/index.tsx +0 -21
  68. package/src/components/CheckMarkList/wrapper.tsx +0 -31
  69. package/src/components/Checklist/index.tsx +0 -51
  70. package/src/components/Checklist/wrapper.tsx +0 -65
  71. package/src/components/ColorSelect/index.tsx +0 -63
  72. package/src/components/ColorSelect/wrapper.tsx +0 -82
  73. package/src/components/ColumnRow/index.tsx +0 -20
  74. package/src/components/Container/index.tsx +0 -11
  75. package/src/components/Container/wrapper.tsx +0 -14
  76. package/src/components/Content/index.tsx +0 -15
  77. package/src/components/Content/wrapper.tsx +0 -61
  78. package/src/components/ContentLogo/index.tsx +0 -27
  79. package/src/components/DataList/index.tsx +0 -25
  80. package/src/components/DataList/wrapper.tsx +0 -29
  81. package/src/components/DetailBox/index.tsx +0 -34
  82. package/src/components/DetailBox/wrapper.tsx +0 -34
  83. package/src/components/ExtendContent/index.tsx +0 -43
  84. package/src/components/ExtendContent/wrapper.tsx +0 -41
  85. package/src/components/ExtendInfo/index.tsx +0 -32
  86. package/src/components/ExtendInfo/wrapper.tsx +0 -63
  87. package/src/components/Filter/index.tsx +0 -108
  88. package/src/components/Filter/wrapper.tsx +0 -79
  89. package/src/components/FilterPanel/checkListFacet.tsx +0 -46
  90. package/src/components/FilterPanel/colorFacet.tsx +0 -47
  91. package/src/components/FilterPanel/faceSelector.tsx +0 -53
  92. package/src/components/FilterPanel/index.tsx +0 -79
  93. package/src/components/FilterPanel/rangeFacet.tsx +0 -128
  94. package/src/components/FinancialOptions/LoanModal.tsx +0 -223
  95. package/src/components/FinancialOptions/index.tsx +0 -29
  96. package/src/components/FinancialOptions/leasing.tsx +0 -77
  97. package/src/components/FinancialOptions/loan.tsx +0 -87
  98. package/src/components/Gallery/MediaButton.tsx +0 -19
  99. package/src/components/Gallery/index.tsx +0 -227
  100. package/src/components/Gallery/wrapper.tsx +0 -323
  101. package/src/components/Grid/index.tsx +0 -87
  102. package/src/components/Grid/wrapper.tsx +0 -30
  103. package/src/components/Heading/index.tsx +0 -72
  104. package/src/components/Icon/index.tsx +0 -87
  105. package/src/components/InputCheckbox/index.tsx +0 -30
  106. package/src/components/InputCheckbox/wrapper.tsx +0 -87
  107. package/src/components/InputGroup/index.tsx +0 -24
  108. package/src/components/InputLabel/index.tsx +0 -14
  109. package/src/components/InputLabel/wrapper.tsx +0 -10
  110. package/src/components/InputSearch/index.tsx +0 -51
  111. package/src/components/InputSearch/wrapper.tsx +0 -97
  112. package/src/components/InputSelect/index.tsx +0 -35
  113. package/src/components/InputSelect/wrapper.tsx +0 -59
  114. package/src/components/InputText/index.tsx +0 -27
  115. package/src/components/InputText/wrapper.tsx +0 -57
  116. package/src/components/InsuranceOptions/Insurance.tsx +0 -60
  117. package/src/components/InsuranceOptions/InsuranceFree.tsx +0 -59
  118. package/src/components/InsuranceOptions/InsuranceFreeModal.tsx +0 -49
  119. package/src/components/InsuranceOptions/InsuranceModal.tsx +0 -253
  120. package/src/components/InsuranceOptions/index.tsx +0 -27
  121. package/src/components/Lightbox/index.tsx +0 -51
  122. package/src/components/Lightbox/wrapper.tsx +0 -97
  123. package/src/components/Loader/index.tsx +0 -18
  124. package/src/components/Loader/wrapper.tsx +0 -50
  125. package/src/components/LogoBox/index.tsx +0 -22
  126. package/src/components/LogoBox/wrapper.tsx +0 -19
  127. package/src/components/Map/index.tsx +0 -62
  128. package/src/components/Map/wrapper.tsx +0 -29
  129. package/src/components/Modal/index.tsx +0 -51
  130. package/src/components/Modal/wrapper.tsx +0 -127
  131. package/src/components/OpeningHours/index.tsx +0 -145
  132. package/src/components/OptionBox/index.tsx +0 -23
  133. package/src/components/OptionBox/wrapper.tsx +0 -56
  134. package/src/components/OverflowBox/index.tsx +0 -11
  135. package/src/components/OverflowBox/wrapper.tsx +0 -7
  136. package/src/components/OverflowGrid/index.tsx +0 -70
  137. package/src/components/Page/index.tsx +0 -46
  138. package/src/components/Panel/index.tsx +0 -50
  139. package/src/components/Panel/wrapper.tsx +0 -155
  140. package/src/components/Pdf/index.tsx +0 -46
  141. package/src/components/Pdf/wrapper.tsx +0 -61
  142. package/src/components/PhoneNumber/index.tsx +0 -33
  143. package/src/components/Portal/index.ts +0 -5
  144. package/src/components/Portal/portal-element.tsx +0 -9
  145. package/src/components/Portal/portal-namespace.ts +0 -1
  146. package/src/components/Portal/portal.tsx +0 -36
  147. package/src/components/Price/index.tsx +0 -12
  148. package/src/components/PriceTable/index.tsx +0 -34
  149. package/src/components/PriceTable/wrapper.tsx +0 -27
  150. package/src/components/ProductCard/index.tsx +0 -133
  151. package/src/components/ProductCard/wrapper.tsx +0 -147
  152. package/src/components/ProductPage/index.tsx +0 -99
  153. package/src/components/ProgressBar/index.tsx +0 -31
  154. package/src/components/ProgressBar/wrapper.tsx +0 -29
  155. package/src/components/RangeSlider/RangeSliderSimple.tsx +0 -90
  156. package/src/components/RangeSlider/SliderWithLabel.tsx +0 -62
  157. package/src/components/RangeSlider/handle.tsx +0 -26
  158. package/src/components/RangeSlider/index.tsx +0 -132
  159. package/src/components/RangeSlider/track.tsx +0 -19
  160. package/src/components/RangeSlider/wrapper.tsx +0 -93
  161. package/src/components/RangeSliderLabel/index.tsx +0 -18
  162. package/src/components/RangeSliderLabel/wrapper.tsx +0 -33
  163. package/src/components/Repeat/index.tsx +0 -21
  164. package/src/components/Result/index.tsx +0 -91
  165. package/src/components/Result/wrapper.tsx +0 -39
  166. package/src/components/Root/index.tsx +0 -24
  167. package/src/components/SearchBar/index.tsx +0 -48
  168. package/src/components/SearchFilter/index.tsx +0 -31
  169. package/src/components/SearchTerm/index.tsx +0 -23
  170. package/src/components/SearchTerm/wrapper.tsx +0 -71
  171. package/src/components/SectionHeader/index.tsx +0 -25
  172. package/src/components/SectionHeader/wrapper.tsx +0 -17
  173. package/src/components/Snackbar/index.tsx +0 -35
  174. package/src/components/Snackbar/wrapper.tsx +0 -65
  175. package/src/components/SortSelect/index.tsx +0 -35
  176. package/src/components/SortSelect/wrapper.tsx +0 -54
  177. package/src/components/Sphere/Sphere.tsx +0 -49
  178. package/src/components/Sphere/SphereLightbox.tsx +0 -10
  179. package/src/components/Sphere/SphereViewer.tsx +0 -81
  180. package/src/components/Sphere/wrapper.tsx +0 -253
  181. package/src/components/SrOnly/index.tsx +0 -14
  182. package/src/components/SwitchBar/index.tsx +0 -55
  183. package/src/components/SwitchBar/wrapper.tsx +0 -80
  184. package/src/components/TableColumn/index.tsx +0 -18
  185. package/src/components/TableList/index.tsx +0 -39
  186. package/src/components/Tabs/index.tsx +0 -34
  187. package/src/components/Tabs/wrapper.tsx +0 -82
  188. package/src/components/ThreeSixty/Rotation.tsx +0 -136
  189. package/src/components/ThreeSixty/ThreeSixtLightbox.tsx +0 -34
  190. package/src/components/ThreeSixty/ThreeSixty.tsx +0 -53
  191. package/src/components/UspList/index.tsx +0 -47
  192. package/src/components/UspList/wrapper.tsx +0 -92
  193. package/src/components/Utility/index.tsx +0 -17
  194. package/src/components/Video/CustomPlayer.tsx +0 -28
  195. package/src/components/Video/EmbeddedVideoLightbox.tsx +0 -31
  196. package/src/components/Video/EmbededVideo.tsx +0 -72
  197. package/src/components/Video/QuickNavEmbeded.tsx +0 -35
  198. package/src/components/Video/QuickNavVideo.tsx +0 -14
  199. package/src/components/Video/Video.tsx +0 -18
  200. package/src/components/Video/VimeoPlayer.tsx +0 -21
  201. package/src/components/Video/YoutubePlayer.tsx +0 -21
  202. package/src/components/Video/useThumbnail.ts +0 -28
  203. package/src/components/Video/utils.ts +0 -47
  204. package/src/components/Video/wrapper.tsx +0 -29
  205. package/src/hooks/useFetch.ts +0 -88
  206. package/src/hooks/useHasBeenVisible.ts +0 -17
  207. package/src/hooks/useHashGuid.ts +0 -33
  208. package/src/hooks/useInsurance.ts +0 -22
  209. package/src/hooks/useLoan.ts +0 -21
  210. package/src/hooks/useOnScreen.ts +0 -20
  211. package/src/hooks/useOutsideClick.ts +0 -19
  212. package/src/hooks/usePrevious.ts +0 -11
  213. package/src/hooks/useSearchItem.ts +0 -11
  214. package/src/hooks/useSearchItemBranch.ts +0 -14
  215. package/src/hooks/useSessionStorage.ts +0 -32
  216. package/src/hooks/useVimeoThumbnail.ts +0 -31
  217. package/src/images/map/marker.png +0 -0
  218. package/src/images/placeholders/staticmap.jpg +0 -0
  219. package/src/index-dev.tsx +0 -42
  220. package/src/index-esbuild.ts +0 -74
  221. package/src/index.ts +0 -72
  222. package/src/layout/helpers.tsx +0 -6
  223. package/src/layout/keyframes.tsx +0 -23
  224. package/src/layout/theme.ts +0 -60
  225. package/src/layouts/WaykeComposite.tsx +0 -64
  226. package/src/layouts/WaykeCompositeWithProvider.tsx +0 -17
  227. package/src/layouts/search/index.tsx +0 -124
  228. package/src/layouts/searchItem/Branch.tsx +0 -97
  229. package/src/layouts/searchItem/BranchModal.tsx +0 -67
  230. package/src/layouts/searchItem/CheckList.tsx +0 -146
  231. package/src/layouts/searchItem/ManufacturerPackagesOption.tsx +0 -54
  232. package/src/layouts/searchItem/MetadataItem.tsx +0 -74
  233. package/src/layouts/searchItem/PackageOptionModal.tsx +0 -54
  234. package/src/layouts/searchItem/PackageOptions.tsx +0 -58
  235. package/src/layouts/searchItem/Page404.tsx +0 -17
  236. package/src/layouts/searchItem/PageLoading.tsx +0 -17
  237. package/src/layouts/searchItem/Property.tsx +0 -134
  238. package/src/layouts/searchItem/Related.tsx +0 -120
  239. package/src/layouts/searchItem/index.tsx +0 -342
  240. package/src/providers/WaykeItemProvidet.tsx +0 -63
  241. package/src/providers/WaykeProvider.tsx +0 -75
  242. package/src/providers/graphqlProvider.tsx +0 -9
  243. package/src/providers/themeProvider.tsx +0 -15
  244. package/src/queries/INSURANCE_CALCULATION.ts +0 -43
  245. package/src/queries/LOAN_CALCULATION.ts +0 -39
  246. package/src/queries/SEARCH_ITEM_BRANCH_QUERY.ts +0 -120
  247. package/src/queries/SEARCH_ITEM_QUERY.ts +0 -237
  248. package/src/utils/constants.ts +0 -34
  249. package/src/utils/converters.ts +0 -45
  250. package/src/utils/deep-copy.ts +0 -6
  251. package/src/utils/formats.ts +0 -83
  252. package/src/utils/metadata.min.ts +0 -87
  253. package/src/utils/phonenumbers.ts +0 -17
  254. package/src/utils/pubsub/Actions.ts +0 -20
  255. package/src/utils/pubsub/Events.ts +0 -79
  256. package/src/utils/pubsub/pubsub.ts +0 -151
  257. package/src/utils/regex.ts +0 -13
  258. package/src/utils/sortOptions.ts +0 -36
  259. package/src/utils/specification.ts +0 -581
  260. package/src/utils/ssn.ts +0 -1
  261. package/src/utils/url.ts +0 -1
  262. package/src/utils/vehicle-properties/compare-basic-properties.ts +0 -63
  263. package/src/utils/vehicle-properties/compare-categories.ts +0 -45
  264. package/src/utils/vehicle-properties/compare-properties.ts +0 -5
  265. package/src/utils/vehicle-properties/custom-property-adder.ts +0 -163
  266. package/src/utils/vehicle-properties/property-hint-enricher.ts +0 -230
  267. package/src/utils/vehicle-properties/property-remover.ts +0 -28
  268. package/src/utils/vehicle-properties/property-tree-creator.ts +0 -171
  269. package/src/utils/vehicle-properties/property-tree-sorter.ts +0 -20
  270. package/tsconfig.build.json +0 -10
  271. package/tsconfig.eslint.json +0 -11
  272. package/tsconfig.json +0 -18
  273. package/webpack.analyze.js +0 -10
  274. package/webpack.config.js +0 -95
@@ -1,124 +0,0 @@
1
- import React, { useEffect, useCallback, useMemo } from 'react';
2
-
3
- import Container from '../../components/Container/index';
4
- import { Page, PageSection } from '../../components/Page/index';
5
- import Result from '../../components/Result/index';
6
- import Filter from '../../components/Filter/index';
7
- import Grid from '../../components/Grid/index';
8
- import SearchTerm from '../../components/SearchTerm/index';
9
- import { PortalElement, PortalNamespace } from '../../components/Portal/index';
10
- import SearchFilter from '../../components/SearchFilter/index';
11
- import Snackbar from '../../components/Snackbar/index';
12
- import useSearch from '../../State/Search/useSearch';
13
- import { SearchFilterTypes } from '../../@types/filter';
14
- import PubSub from '../../utils/pubsub/pubsub';
15
-
16
- export interface WaykeSearchProps {
17
- filterList?: SearchFilterTypes[];
18
- initialQueryParams?: URLSearchParams | string;
19
- removeSearchBar?: boolean;
20
- removeFilterOptions?: boolean;
21
- placeholderImage?: string;
22
- hashRoute?: boolean;
23
- pathRoute?: string;
24
- modifyDocumentTitleSearch?: string;
25
- onClickSearchItem?: (id: string) => void;
26
- }
27
-
28
- const WaykeSearch = ({
29
- filterList,
30
- initialQueryParams,
31
- hashRoute,
32
- pathRoute,
33
- removeSearchBar,
34
- placeholderImage,
35
- removeFilterOptions,
36
- modifyDocumentTitleSearch,
37
- onClickSearchItem,
38
- }: WaykeSearchProps) => {
39
- const { error, documents, queryFilter, onFilterUpdate, onInitialize } = useSearch();
40
-
41
- useEffect(() => {
42
- if (modifyDocumentTitleSearch) {
43
- document.title = modifyDocumentTitleSearch;
44
- }
45
- onInitialize(
46
- typeof initialQueryParams === 'string'
47
- ? new URLSearchParams(initialQueryParams)
48
- : initialQueryParams
49
- );
50
- }, []);
51
-
52
- const onItemClicked = useCallback((id: string) => {
53
- PubSub.publish('ItemClicked', id);
54
- if (onClickSearchItem) {
55
- onClickSearchItem(id);
56
- }
57
- }, []);
58
-
59
- const onClearQuery = useCallback(() => {
60
- const nextQuery = new URLSearchParams(queryFilter.searchParams);
61
- nextQuery.delete('query');
62
- onFilterUpdate(nextQuery.toString());
63
- }, [queryFilter.searchParams]);
64
-
65
- const searchQuery = useMemo(() => queryFilter.searchParams.get('query'), [documents]);
66
-
67
- return (
68
- <>
69
- <Page>
70
- {!removeSearchBar && (
71
- <PageSection>
72
- <Container>
73
- <SearchFilter />
74
- </Container>
75
- </PageSection>
76
- )}
77
- {searchQuery && (
78
- <PageSection>
79
- <Container>
80
- <SearchTerm onClear={onClearQuery}>{searchQuery}</SearchTerm>
81
- </Container>
82
- </PageSection>
83
- )}
84
- {!removeFilterOptions && (
85
- <PageSection>
86
- <Container>
87
- <Filter filterList={filterList} />
88
- </Container>
89
- </PageSection>
90
- )}
91
- <PageSection accent fillSpace className="wayke__theme wayke__color--accent-bg">
92
- <Container>
93
- <Result>
94
- <>
95
- {error && (
96
- <Snackbar severity="error" icon heading="Ett fel har inträffat">
97
- Vänligen försök igen.
98
- </Snackbar>
99
- )}
100
- {!error && documents && documents.length > 0 && (
101
- <Grid
102
- hashRoute={hashRoute}
103
- pathRoute={pathRoute}
104
- onClickItem={onItemClicked}
105
- documents={documents}
106
- placeholderImage={placeholderImage}
107
- />
108
- )}
109
- {!error && documents && documents.length === 0 && (
110
- <Snackbar severity="warning" icon heading="Inga resultat">
111
- Det finns inga resultat som matchar din sökning.
112
- </Snackbar>
113
- )}
114
- </>
115
- </Result>
116
- </Container>
117
- </PageSection>
118
- </Page>
119
- <PortalElement id={PortalNamespace.DefaultPortal} />
120
- </>
121
- );
122
- };
123
-
124
- export default WaykeSearch;
@@ -1,97 +0,0 @@
1
- import React, { useState, useCallback, useEffect } from 'react';
2
-
3
- import { Repeat } from '../../components/Repeat/index';
4
- import Content from '../../components/Content/index';
5
- import { ProductPageContentLimit } from '../../components/ProductPage/index';
6
- import { H2 } from '../../components/Heading/index';
7
- import { ButtonContent, ButtonInline, ButtonInlineBold } from '../../components/Button/index';
8
- import { TableColumn, TableColumnRow, TableColumnCell } from '../../components/TableColumn/index';
9
-
10
- import OpeningHours from '../../components/OpeningHours/index';
11
- import PhoneNumber from '../../components/PhoneNumber/index';
12
- import Map from '../../components/Map/index';
13
-
14
- import { Branch, Maybe } from '../../@types/codegen/types';
15
- import BranchModal from './BranchModal';
16
- import { formatPhonenumber } from '../../utils/phonenumbers';
17
-
18
- interface BranchProps {
19
- branch?: Maybe<Branch>;
20
- loading: boolean;
21
- }
22
-
23
- const Branch = ({ branch, loading }: BranchProps) => {
24
- const [modal, setModal] = useState(false);
25
-
26
- const openModal = useCallback(() => setModal(true), []);
27
- const closeModal = useCallback(() => setModal(false), []);
28
-
29
- useEffect(() => {
30
- if (branch && modal) {
31
- setModal(false);
32
- }
33
- }, [branch]);
34
-
35
- if (!branch) {
36
- return null;
37
- }
38
-
39
- return (
40
- <>
41
- {modal && (
42
- <BranchModal loading={loading} connections={branch?.connections} onClose={closeModal} />
43
- )}
44
- <Repeat>
45
- <H2 noMargin>
46
- {branch?.location?.city
47
- ? `Den här bilen finns på vår anläggning i ${branch?.location?.city}`
48
- : 'Kontakt'}
49
- </H2>
50
- </Repeat>
51
- <Repeat>
52
- <Map position={branch?.location?.position} />
53
- </Repeat>
54
- {(branch?.connections?.length || 0) > 1 && (
55
- <Repeat>
56
- <Content>
57
- <p>
58
- Denna bil tillhör ett centrallager och går att köpa genom flera anläggningar.{' '}
59
- <ButtonInline as="span" role="button" onClick={openModal} inline>
60
- Klicka här för att visa kontaktuppgifter till en annan anläggning
61
- </ButtonInline>
62
- .
63
- </p>
64
- </Content>
65
- </Repeat>
66
- )}
67
- <Repeat>
68
- <ProductPageContentLimit>
69
- <Repeat>
70
- <TableColumn>
71
- {branch?.location?.streetAddress && branch?.location?.city && (
72
- <TableColumnRow>
73
- <TableColumnCell>Adress</TableColumnCell>
74
- <TableColumnCell>
75
- <ButtonInlineBold>
76
- <ButtonContent>{`${branch?.location?.streetAddress}, ${branch?.location?.city}`}</ButtonContent>
77
- </ButtonInlineBold>
78
- </TableColumnCell>
79
- </TableColumnRow>
80
- )}
81
- {branch?.contact?.phonenumber && (
82
- <PhoneNumber phoneNumber={formatPhonenumber(branch.contact.phonenumber)} />
83
- )}
84
- </TableColumn>
85
- </Repeat>
86
- {branch?.openingHours && (
87
- <Repeat>
88
- <OpeningHours openingHours={branch.openingHours} />
89
- </Repeat>
90
- )}
91
- </ProductPageContentLimit>
92
- </Repeat>
93
- </>
94
- );
95
- };
96
-
97
- export default Branch;
@@ -1,67 +0,0 @@
1
- import React, { useState, useCallback, useContext } from 'react';
2
-
3
- import { Repeat, RepeatTiny } from '../../components/Repeat/index';
4
- import InputSelect from '../../components/InputSelect/index';
5
- import { ButtonPrimary, ButtonContent } from '../../components/Button/index';
6
- import Modal from '../../components/Modal/index';
7
- import Content from '../../components/Content/index';
8
- import InputLabel from '../../components/InputLabel/index';
9
- import { BranchConnection } from '../../@types/codegen/types';
10
- import { CentralStorageContext } from '../../State/CentralStorage/CentralStorageContext';
11
-
12
- interface BranchModalProps {
13
- loading: boolean;
14
- connections?: BranchConnection[];
15
- onClose: () => void;
16
- }
17
-
18
- const BranchModal = ({ loading, connections, onClose }: BranchModalProps) => {
19
- const { centralStorageId, setCentralStorageId } = useContext(CentralStorageContext);
20
- const [localValue, setLocalValue] = useState(centralStorageId);
21
-
22
- const onConfirm = useCallback((id: string) => {
23
- if (id) {
24
- setCentralStorageId(id);
25
- }
26
- }, []);
27
-
28
- const onChange = useCallback(
29
- (e: React.ChangeEvent<HTMLSelectElement>) => setLocalValue(e.currentTarget.value),
30
- []
31
- );
32
-
33
- if (!localValue) {
34
- return null;
35
- }
36
-
37
- return (
38
- <Modal title="Byt anläggning" onClose={onClose}>
39
- <Repeat>
40
- <RepeatTiny>
41
- <Content>
42
- <p>Välj den anläggning du vill visa kontaktuppgifter för.</p>
43
- </Content>
44
- </RepeatTiny>
45
- <RepeatTiny>
46
- <InputLabel>Välj anläggning</InputLabel>
47
- <InputSelect
48
- value={localValue}
49
- onChange={onChange}
50
- options={connections?.map((x) => ({
51
- value: x.id,
52
- displayName: x.name,
53
- }))}
54
- title="Välj anläggning"
55
- />
56
- </RepeatTiny>
57
- </Repeat>
58
- <Repeat>
59
- <ButtonPrimary disabled={loading} fullWidth onClick={() => onConfirm(localValue)}>
60
- <ButtonContent>Välj</ButtonContent>
61
- </ButtonPrimary>
62
- </Repeat>
63
- </Modal>
64
- );
65
- };
66
-
67
- export default BranchModal;
@@ -1,146 +0,0 @@
1
- import React, { useState, useCallback, useEffect } from 'react';
2
-
3
- import { Repeat, RepeatTiny } from '../../components/Repeat/index';
4
- import ActionList from '../../components/ActionList/index';
5
- import { ButtonPrimary, ButtonContent, ButtonInline } from '../../components/Button/index';
6
- import CheckMarkList, { CheckMarkListItem } from '../../components/CheckMarkList/index';
7
- import Content from '../../components/Content/index';
8
- import SwitchBar from '../../components/SwitchBar/index';
9
- import {
10
- Manufacturer,
11
- PackageOption,
12
- Ecommerce,
13
- ContactOptions,
14
- Branch,
15
- } from '../../@types/codegen/types';
16
- import BranchModal from './BranchModal';
17
- import PackageOptionModal, { PackageOptionModalData } from './PackageOptionModal';
18
-
19
- interface CheckList {
20
- manufacturer?: Manufacturer | null;
21
- packageOptions: PackageOption[];
22
- ecommerce?: Ecommerce | null;
23
- branch?: Branch | null;
24
- contact?: ContactOptions | null;
25
- loadingCentralStorageVehicle: boolean;
26
- toggleEcomModal: () => void;
27
- }
28
-
29
- const CheckList = ({
30
- manufacturer,
31
- packageOptions,
32
- ecommerce,
33
- branch,
34
- contact,
35
- toggleEcomModal,
36
- loadingCentralStorageVehicle,
37
- }: CheckList) => {
38
- const [modalBranch, setModalBranch] = useState(false);
39
- const openModalBranch = useCallback(() => setModalBranch(true), []);
40
- const closeModalBranch = useCallback(() => setModalBranch(false), []);
41
-
42
- const [modal, setModal] = useState<PackageOptionModalData>();
43
- const onOpen = useCallback((nextModal: PackageOptionModalData) => setModal(nextModal), []);
44
- const onClose = useCallback(() => setModal(undefined), []);
45
-
46
- useEffect(() => {
47
- if ((branch || contact) && modalBranch) {
48
- setModalBranch(false);
49
- }
50
- }, [branch, contact]);
51
-
52
- const packageOption = manufacturer?.packageOption;
53
-
54
- return (
55
- <>
56
- {modalBranch && (
57
- <BranchModal
58
- loading={loadingCentralStorageVehicle}
59
- connections={branch?.connections}
60
- onClose={closeModalBranch}
61
- />
62
- )}
63
- {modal && <PackageOptionModal packageOption={modal} onClose={onClose} />}
64
- <Repeat>
65
- <CheckMarkList>
66
- {packageOption?.title && (
67
- <CheckMarkListItem>
68
- <>
69
- Inkl.{' '}
70
- <ButtonInline
71
- onClick={() =>
72
- onOpen({
73
- title: packageOption?.title,
74
- image: packageOption?.image,
75
- description: packageOption?.description,
76
- link: packageOption?.link,
77
- })
78
- }
79
- >
80
- {packageOption.title}
81
- </ButtonInline>{' '}
82
- begagnatgaranti
83
- </>
84
- </CheckMarkListItem>
85
- )}
86
- {packageOptions?.map((packageOption, index) => (
87
- <CheckMarkListItem key={packageOption.title || index}>
88
- <>
89
- Inkl.{' '}
90
- <ButtonInline
91
- onClick={() =>
92
- onOpen({
93
- title: packageOption?.title,
94
- image: packageOption?.image,
95
- description: packageOption?.description,
96
- link: packageOption?.link,
97
- })
98
- }
99
- >
100
- {packageOption.title}
101
- </ButtonInline>
102
- </>
103
- </CheckMarkListItem>
104
- ))}
105
- {ecommerce?.withHomeDelivery && <CheckMarkListItem>Hemleverans</CheckMarkListItem>}
106
- </CheckMarkList>
107
- </Repeat>
108
- <Repeat>
109
- {ecommerce && ecommerce.enabled && (
110
- <RepeatTiny>
111
- <ButtonPrimary disabled={!!ecommerce.reserved} fullWidth onClick={toggleEcomModal}>
112
- <ButtonContent>Köp bilen online</ButtonContent>
113
- </ButtonPrimary>
114
- </RepeatTiny>
115
- )}
116
- {ecommerce?.reserved && (
117
- <RepeatTiny>
118
- <SwitchBar
119
- title="Bilen är reserverad"
120
- body="Denna bil är reserverad av en annan köpare."
121
- >
122
- <Content>
123
- <p>Denna bil är reserverad av en annan köpare.</p>
124
- </Content>
125
- </SwitchBar>
126
- </RepeatTiny>
127
- )}
128
- <ActionList branch={branch} contact={contact} />
129
- </Repeat>
130
- {(branch?.connections.length || 0) > 1 && (
131
- <Repeat>
132
- <SwitchBar title="Centrallagerbil" actionTitle="Byt anläggning" onClick={openModalBranch}>
133
- <Content>
134
- <p>
135
- Denna bil tillhör ett centrallager och går att köpa genom flera anläggningar. Byt
136
- anläggning för att visa kontaktuppgifter till just den anläggningen.
137
- </p>
138
- </Content>
139
- </SwitchBar>
140
- </Repeat>
141
- )}
142
- </>
143
- );
144
- };
145
-
146
- export default CheckList;
@@ -1,54 +0,0 @@
1
- import React from 'react';
2
- import { marked } from 'marked';
3
-
4
- import { Repeat } from '../../components/Repeat/index';
5
- import { ProductPageMainSection } from '../../components/ProductPage/index';
6
- import Content from '../../components/Content/index';
7
- import { H2 } from '../../components/Heading/index';
8
- import { ButtonInline } from '../../components/Button/index';
9
- import LogoBox from '../../components/LogoBox/index';
10
- import { Maybe, PackageOption } from '../../@types/codegen/types';
11
-
12
- interface ManufacturerPackageOption {
13
- packageOption?: Maybe<PackageOption>;
14
- }
15
-
16
- const ManufacturerPackageOption = ({ packageOption }: ManufacturerPackageOption) => {
17
- if (!packageOption) {
18
- return null;
19
- }
20
-
21
- return (
22
- <ProductPageMainSection>
23
- <Repeat>
24
- <H2 noMargin>{packageOption.title}</H2>
25
- </Repeat>
26
- {packageOption.description && (
27
- <Repeat>
28
- <Content dangerouslySetInnerHTML={{ __html: marked(packageOption.description) }} />
29
- </Repeat>
30
- )}
31
- {packageOption.link?.url && (
32
- <Repeat>
33
- <ButtonInline
34
- as="a"
35
- href={packageOption.link.url}
36
- target="_blank"
37
- rel="noopener noreferrer"
38
- >
39
- {packageOption.link.title
40
- ? packageOption.link.title
41
- : 'Läs mer (Öppnas i ett nytt fönster)'}
42
- </ButtonInline>
43
- </Repeat>
44
- )}
45
- {packageOption.image && (
46
- <Repeat>
47
- <LogoBox logo={packageOption.image} alt="Logotyp" wide />
48
- </Repeat>
49
- )}
50
- </ProductPageMainSection>
51
- );
52
- };
53
-
54
- export default ManufacturerPackageOption;
@@ -1,74 +0,0 @@
1
- import React, { useState, useCallback } from 'react';
2
- import { Property } from '../../@types/vehicle-properties';
3
-
4
- import {
5
- TableListItem,
6
- TableListKey,
7
- TableListValue,
8
- TableListBooleanPos,
9
- TableListBooleanNeg,
10
- } from '../../components/TableList/index';
11
- import { IconCheck, IconCancel } from '../../components/Icon/index';
12
- import { SrOnly } from '../../components/SrOnly/index';
13
- import { ButtonInline } from '../../components/Button/index';
14
- import Modal from '../../components/Modal/index';
15
- import Content from '../../components/Content/index';
16
-
17
- const formatValue = (value: Property['value'], unit: Property['unit']) => {
18
- if (typeof value === 'boolean') {
19
- return value ? (
20
- <TableListBooleanPos title="Ja">
21
- <SrOnly>Ja</SrOnly>
22
- <IconCheck block />
23
- </TableListBooleanPos>
24
- ) : (
25
- <TableListBooleanNeg title="Nej">
26
- <SrOnly>Nej</SrOnly>
27
- <IconCancel block />
28
- </TableListBooleanNeg>
29
- );
30
- }
31
- if (Array.isArray(value)) {
32
- return value.join(', ');
33
- }
34
- if (!!value && !!unit) {
35
- return `${value} ${unit}`;
36
- }
37
- return value;
38
- };
39
-
40
- interface MetadataItemProps {
41
- name: string;
42
- hint?: string | null | undefined;
43
- value: Property['value'];
44
- unit: Property['unit'];
45
- }
46
-
47
- const MetadataItem = ({ name, hint, value, unit }: MetadataItemProps) => {
48
- const [foldout, setFoldout] = useState(false);
49
- const onToggleFoldout = useCallback(() => setFoldout(!foldout), [foldout]);
50
-
51
- const presentedValue = formatValue(value, unit);
52
-
53
- return (
54
- <TableListItem>
55
- <TableListKey>
56
- {hint ? (
57
- <ButtonInline onClick={onToggleFoldout} title={`Mer information om ${name}`}>
58
- {name}
59
- </ButtonInline>
60
- ) : (
61
- name
62
- )}
63
- </TableListKey>
64
- <TableListValue>{value !== undefined ? presentedValue : 'Uppgift saknas'}</TableListValue>
65
- {hint && foldout && (
66
- <Modal title={name} onClose={onToggleFoldout}>
67
- <Content dangerouslySetInnerHTML={{ __html: hint }} />
68
- </Modal>
69
- )}
70
- </TableListItem>
71
- );
72
- };
73
-
74
- export default MetadataItem;
@@ -1,54 +0,0 @@
1
- import React from 'react';
2
- import { marked } from 'marked';
3
-
4
- import { Repeat } from '../../components/Repeat/index';
5
- import { ButtonInline } from '../../components/Button/index';
6
- import Modal from '../../components/Modal/index';
7
- import Content from '../../components/Content/index';
8
- import LogoBox from '../../components/LogoBox/index';
9
-
10
- interface ModelLink {
11
- href?: string | null;
12
- title?: string | null;
13
- }
14
-
15
- export interface PackageOptionModalData {
16
- title?: string | null;
17
- image?: string | null;
18
- description?: string | null;
19
- link?: ModelLink | null;
20
- }
21
-
22
- interface PackageOptionsModalProps {
23
- packageOption: PackageOptionModalData;
24
- onClose: () => void;
25
- }
26
-
27
- const PackageOptionModal = ({ packageOption, onClose }: PackageOptionsModalProps) => (
28
- <Modal title={packageOption.title || ''} onClose={onClose}>
29
- {packageOption.image && (
30
- <Repeat>
31
- <LogoBox logo={packageOption.image} alt={packageOption.title || undefined} wide />
32
- </Repeat>
33
- )}
34
- {packageOption.description && (
35
- <Repeat>
36
- <Content dangerouslySetInnerHTML={{ __html: marked(packageOption.description) }} />
37
- </Repeat>
38
- )}
39
- {packageOption.link?.href && packageOption.link.title && (
40
- <Repeat>
41
- <ButtonInline
42
- as="a"
43
- href={packageOption.link.href}
44
- target="_blank"
45
- rel="noopener noreferrer nofollow"
46
- >
47
- {packageOption.link.title}
48
- </ButtonInline>
49
- </Repeat>
50
- )}
51
- </Modal>
52
- );
53
-
54
- export default PackageOptionModal;
@@ -1,58 +0,0 @@
1
- import React from 'react';
2
- import { marked } from 'marked';
3
-
4
- import { Repeat } from '../../components/Repeat/index';
5
- import { ProductPageMainSection } from '../../components/ProductPage/index';
6
- import Content from '../../components/Content/index';
7
- import { H2 } from '../../components/Heading/index';
8
- import { ButtonInline } from '../../components/Button/index';
9
- import LogoBox from '../../components/LogoBox/index';
10
- import { PackageOption } from '../../@types/codegen/types';
11
-
12
- interface PackageOptionsProps {
13
- packageOptions?: PackageOption[] | null;
14
- }
15
-
16
- const PackageOptions = ({ packageOptions }: PackageOptionsProps) => {
17
- if (!packageOptions) {
18
- return null;
19
- }
20
-
21
- return (
22
- <>
23
- {packageOptions.map((packageOption, index) => (
24
- <ProductPageMainSection key={packageOption.title || index}>
25
- <Repeat>
26
- <H2 noMargin>{packageOption.title}</H2>
27
- </Repeat>
28
- {packageOption.description && (
29
- <Repeat>
30
- <Content dangerouslySetInnerHTML={{ __html: marked(packageOption.description) }} />
31
- </Repeat>
32
- )}
33
- {packageOption.link?.url && (
34
- <Repeat>
35
- <ButtonInline
36
- as="a"
37
- href={packageOption.link.url}
38
- target="_blank"
39
- rel="noopener noreferrer"
40
- >
41
- {packageOption.link.title
42
- ? packageOption.link.title
43
- : 'Läs mer (Öppnas i ett nytt fönster)'}
44
- </ButtonInline>
45
- </Repeat>
46
- )}
47
- {packageOption.image && (
48
- <Repeat>
49
- <LogoBox logo={packageOption.image} alt="Logotyp" wide />
50
- </Repeat>
51
- )}
52
- </ProductPageMainSection>
53
- ))}
54
- </>
55
- );
56
- };
57
-
58
- export default PackageOptions;