@wayke-se/components-react 3.5.3 → 3.6.0-beta.1

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 (47) hide show
  1. package/README.md +51 -43
  2. package/dist-node/index.js +692 -128
  3. package/dist-node/index.js.map +1 -1
  4. package/dist-src/components/AccessoryCard/index.js +14 -0
  5. package/dist-src/components/AccessoryCard/wrapper.js +90 -0
  6. package/dist-src/components/DocumentList/wrapper.js +1 -1
  7. package/dist-src/components/Gallery/index.js +7 -4
  8. package/dist-src/components/Gallery/wrapper.js +71 -39
  9. package/dist-src/components/Icon/index.js +2 -0
  10. package/dist-src/components/Image/index.js +5 -0
  11. package/dist-src/components/Link/index.js +28 -0
  12. package/dist-src/components/NavButton/index.js +42 -0
  13. package/dist-src/components/OverflowGrid/index.js +56 -66
  14. package/dist-src/components/OverflowGrid/wrapper.js +144 -0
  15. package/dist-src/components/PriceBox/index.js +6 -0
  16. package/dist-src/components/PriceBox/wrapper.js +34 -0
  17. package/dist-src/layout/theme.js +8 -0
  18. package/dist-src/layouts/searchItem/Accessories/AccessoryModal.js +51 -0
  19. package/dist-src/layouts/searchItem/Accessories/index.js +32 -0
  20. package/dist-src/layouts/searchItem/Related.js +23 -25
  21. package/dist-src/layouts/searchItem/index.js +3 -1
  22. package/dist-src/queries/SEARCH_ITEM_BRANCH_QUERY.js +18 -0
  23. package/dist-src/queries/SEARCH_ITEM_QUERY.js +18 -0
  24. package/dist-types/@types/codegen/types.d.ts +17 -0
  25. package/dist-types/components/AccessoryCard/index.d.ts +16 -0
  26. package/dist-types/components/AccessoryCard/wrapper.d.ts +18 -0
  27. package/dist-types/components/Gallery/wrapper.d.ts +2 -6
  28. package/dist-types/components/Icon/index.d.ts +1 -0
  29. package/dist-types/components/Image/index.d.ts +1 -0
  30. package/dist-types/components/Link/index.d.ts +7 -0
  31. package/dist-types/components/NavButton/index.d.ts +3 -0
  32. package/dist-types/components/OverflowGrid/index.d.ts +12 -3
  33. package/dist-types/components/OverflowGrid/wrapper.d.ts +18 -0
  34. package/dist-types/components/PriceBox/index.d.ts +11 -0
  35. package/dist-types/components/PriceBox/wrapper.d.ts +10 -0
  36. package/dist-types/layout/theme.d.ts +8 -0
  37. package/dist-types/layouts/searchItem/Accessories/AccessoryModal.d.ts +8 -0
  38. package/dist-types/layouts/searchItem/Accessories/index.d.ts +7 -0
  39. package/dist-web/index.js +605 -123
  40. package/dist-web/index.js.map +1 -1
  41. package/package.json +2 -4
  42. package/assets/ajax-loader.gif +0 -0
  43. package/assets/default.css +0 -1
  44. package/assets/fonts/slick.eot +0 -0
  45. package/assets/fonts/slick.svg +0 -14
  46. package/assets/fonts/slick.ttf +0 -0
  47. package/assets/fonts/slick.woff +0 -0
package/README.md CHANGED
@@ -1,29 +1,29 @@
1
1
  # Components React
2
2
 
3
- > This repository contains components for search and items to use on external websites.
3
+ This repository contains components for search and items to use on external websites.
4
4
 
5
- ## Notes
5
+ ## Usage
6
6
 
7
- * Starting from version `2.0.0` and above will require import of `@wayke.se/components-react/assets/default.css` in order to apply basic styling to the gallery.
7
+ Get started using `@wayke-se/components-react`.
8
8
 
9
- ## Usage
9
+ ### Before you start
10
10
 
11
- Install
11
+ **Install**
12
12
  ```bash
13
13
  npm install @wayke-se/components-react
14
14
  ```
15
15
 
16
- Install peer dependencies
16
+ **Install peer dependencies**
17
17
  ```bash
18
18
  npm install react react-dom styled-components
19
19
  ```
20
20
 
21
+ ### Basic usage
22
+
21
23
  ```javascript
22
24
  import React from 'react';
23
25
  import WaykeComposite from '@wayke-se/components-react'
24
- import '@wayke-se/components-react/assets/default.css';
25
- // Optional
26
- import '@wayke-se/ecom-web/dist/index.css';
26
+ import '@wayke-se/ecom-web/dist/index.css'; // Only required if Ecom is activated
27
27
 
28
28
  const ProviderSettings: WaykeProviderSettings = {
29
29
  graphQlUrl: "https://gql.wayketech.se/query",
@@ -66,10 +66,9 @@ const ProviderSettings: WaykeProviderSettings = {
66
66
  }
67
67
  ```
68
68
 
69
-
70
69
  ### WaykeComposite uses hash-route, i want to use path-route
71
70
 
72
- In this case you need to make sure that you are in control of the routing, if the user reloads the page, where same html file is
71
+ In this case you need to make sure that you are in control of the routing, if the user reloads the page, where same html file is
73
72
  served for `/your/path/to/this/component` and `/your/path/to/this/component/00000000-0000-0000-0000-000000000000`.
74
73
 
75
74
  Examples given the application is located in `/search/vehicles`:
@@ -84,9 +83,7 @@ Examples given the application is located in `/search/vehicles`:
84
83
  ```javascript
85
84
  import React from 'react';
86
85
  import { WaykeCompositePath } from '@wayke-se/components-react'
87
- import '@wayke.se/components-react/assets/default.css';
88
- // Optional
89
- import '@wayke-se/ecom-web/dist/index.css';
86
+ import '@wayke-se/ecom-web/dist/index.css'; // Only required if Ecom is activated
90
87
 
91
88
  const App = () => (
92
89
  <WaykeCompositePath
@@ -119,7 +116,6 @@ const App = () => {
119
116
  );
120
117
  };
121
118
  ```
122
-
123
119
  ### I only want to use the Search Item component
124
120
 
125
121
  It's recomended to place WaykeItemProvider close to app-root in order to keep the cache
@@ -127,9 +123,7 @@ It's recomended to place WaykeItemProvider close to app-root in order to keep th
127
123
  ```javascript
128
124
  import React, { useCallback } from 'react';
129
125
  import { WaykeItemProvider, WaykeSearchItem } from '@wayke-se/components-react'
130
- import '@wayke.se/components-react/assets/default.css';
131
- // Optional
132
- import '@wayke-se/ecom-web/dist/index.css';
126
+ import '@wayke-se/ecom-web/dist/index.css'; // Only required if Ecom is activated
133
127
 
134
128
  const App = ({}) => {
135
129
  const id = 'd01f79a3-7552-49c4-9d4d-deb3aa581c31';
@@ -442,7 +436,7 @@ To style the components, copy the following snippet into your *CSS* file and mod
442
436
  }
443
437
  ```
444
438
 
445
- ...or if you want to use it as Sass (.scss):
439
+ ...or if you want to use it as _Sass_ (.scss):
446
440
 
447
441
  ```scss
448
442
  .wayke__theme {
@@ -474,17 +468,23 @@ To style the components, copy the following snippet into your *CSS* file and mod
474
468
  }
475
469
  ```
476
470
 
471
+ > **It is highly recommended to *NOT* add or remove any properties defined above in the color selectors**. However, since fonts usually requires more configuration we encourage you to add the necessary font styling required to match your current profile. If you add new properties to the font selectors, please be careful and ensure everything looks as intended before going into production.
472
+
477
473
  ### Ecom theme
478
- The default ecom css can be found and imported `node_module/@wayke-se/ecom-web/dist/index.css`.
479
474
 
480
- > **It is highly recommended to *NOT* add or remove any properties defined above in the color selectors**. However, since fonts usually requires more configuration we encourage you to add the necessary font styling required to match your current profile. If you add new properties to the font selectors, please be careful and ensure everything looks as intended before going into production.
475
+ The default Ecom *CSS* can be found and imported from `@wayke-se/ecom-web/dist/index.css`. This is only necessary if Ecom is activated. If activated and the *CSS* is not imported, the Ecom module will not be displayed correctly.
476
+
477
+ If you want to customize the look of the Ecom module we refer you to the documentation of [@wayke-se/ecom-web](https://www.npmjs.com/package/@wayke-se/ecom-web).
478
+
479
+ ## Run example from this repository
481
480
 
482
- ## Run example from repo
483
- This repository contains a example app that uses [@wayke-se/components-react](https://www.npmjs.com/package/@wayke-se/components-react).
481
+ This repository contains an example app that uses [@wayke-se/components-react](https://www.npmjs.com/package/@wayke-se/components-react).
484
482
 
485
483
 
484
+ ### Setup environment variables
485
+
486
+ To start the example create an `.env` file in root with the following content.
486
487
 
487
- To start the example create an `.env` file in root.
488
488
  ```
489
489
  WAYKE_HOST=YOUR_HOST_1,YOUR_HOST_2
490
490
  WAYKE_SEARCH_URL=https://api.wayketech.se/vehicles
@@ -495,10 +495,15 @@ WAYKE_ECOM_URL=https://ecom.wayketech.se
495
495
  GOOGLE_MAPS_API_KEY=YOUR_GOOGLE_MAPS_STATIC_API_KEY
496
496
  ```
497
497
 
498
- * `WAYKE_SEARCH_MLT_URL` - An *optional* flag. Will fetch related vehicles to current vehicle. If not provided
498
+ #### Notes
499
+
500
+ * `WAYKE_SEARCH_MLT_URL` - An *optional* flag. Will fetch related vehicles to current vehicle. If not provided
499
501
  `WAYKE_SEARCH_URL` will be used instead, but will fetch latest vehicles.
500
502
 
501
- Then run the following:
503
+ ### Start the example app
504
+
505
+ Run the following commands to start the example app.
506
+
502
507
  ```bash
503
508
  npm install
504
509
  cd example
@@ -506,35 +511,38 @@ npm install
506
511
  npm start
507
512
  ```
508
513
 
509
- `WAYKE_HOST` can be used instead of using and exposing the `WAYKE_SEARCH_X_API_KEY`. If, for example, your development host is `test.com.localhost`
510
- Update your local host file and add:
511
- 127.0.0.1 test.com.localhost
512
- This will change the origin, while still pointing to localhost.
513
- Start the example and open `test.com.localhost:5000`.
514
+ ### Custom host
515
+
516
+ `WAYKE_HOST` can be used instead of using and exposing the `WAYKE_SEARCH_X_API_KEY`. If, for example, your development host is `test.com.localhost`.
514
517
 
515
- To add more hosts, add all to your local host file and then update `WAYKE_HOST` (comma separated):
518
+ To do so update your local host file and add:
519
+ ```txt
520
+ 127.0.0.1 test.com.localhost
516
521
  ```
522
+
523
+ This will change the origin, while still pointing to `localhost`. Start the example app and open `test.com.localhost:5000` in your browser.
524
+
525
+ ### Multiple hosts
526
+
527
+ To add multiple hosts, add all hohsts to your local host file and then update `WAYKE_HOST` in `.env` as a comma separated list.
528
+
529
+ ```txt
517
530
  WAYKE_HOST=a.com.localhost,b.com.localhost
518
531
  ```
519
- `a.com.localhost:5000` and `b.com.localhost:5000` can now be accessed.
520
532
 
533
+ `a.com.localhost:5000` and `b.com.localhost:5000` can now be accessed.
521
534
 
522
- ### Available Routes (Independent)
535
+ ### Available routes (independent)
523
536
 
524
- #### WaykeComposite
537
+ **WaykeComposite**
525
538
  [http://localhost:5000](http://localhost:5000)
526
539
 
527
- #### WaykeSearch With WaykeProvider
540
+ **WaykeSearch With WaykeProvider**
528
541
  [http://localhost:5000/search](http://localhost:5000/search)
529
542
 
530
- #### WaykeSearchItem With WaykeProvider
543
+ **WaykeSearchItem With WaykeProvider**
531
544
  [http://localhost:5000/search-item/d01f79a3-7552-49c4-9d4d-deb3aa581c31](http://localhost:5000/search-item/d01f79a3-7552-49c4-9d4d-deb3aa581c31)
532
545
 
533
-
534
546
  ## Example repositories
535
547
 
536
- ### React and Typescript example
537
- [https://github.com/wayke-se/components-react-boilerplate](https://github.com/wayke-se/components-react-boilerplate)
538
-
539
- ### Non-React with/without Typescript example
540
- [https://github.com/wayke-se/components-react-example](https://github.com/wayke-se/components-react-example)
548
+ We have setup an example repository where you can see how we've implemented `@wayke-se/components-react`. You'll find the repository here: [https://github.com/wayke-se/components-react-example](https://github.com/wayke-se/components-react-example).