easy-navigation 1.0.53 → 2.0.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 (35) hide show
  1. package/README.md +18 -12
  2. package/example.js +305 -368
  3. package/lib/button/accordion.js +2 -2
  4. package/lib/button/navigation/accordion.js +3 -3
  5. package/lib/constants.js +4 -2
  6. package/lib/div/accordion.js +3 -3
  7. package/lib/example/article/{accordion/buttons.js → buttons.js} +17 -17
  8. package/lib/example/article/{accordion/codes.js → codes.js} +17 -17
  9. package/lib/example/article/{accordion/inputs.js → headings.js} +19 -19
  10. package/lib/example/article/{accordion/home.js → home.js} +18 -18
  11. package/lib/example/article/{accordion/headings.js → inputs.js} +19 -19
  12. package/lib/example/article/{accordion/links.js → links.js} +17 -17
  13. package/lib/example/article/{accordion/sections.js → sections.js} +17 -17
  14. package/lib/{article/accordion.js → example/article.js} +35 -53
  15. package/lib/example/articlesArray.js +8 -8
  16. package/lib/index.js +9 -16
  17. package/lib/item/accordion.js +3 -3
  18. package/package.json +1 -1
  19. package/src/button/accordion.js +1 -1
  20. package/src/button/navigation/accordion.js +3 -2
  21. package/src/constants.js +1 -0
  22. package/src/div/accordion.js +3 -3
  23. package/src/example/article/{accordion/buttons.js → buttons.js} +4 -4
  24. package/src/example/article/{accordion/codes.js → codes.js} +4 -4
  25. package/src/example/article/{accordion/headings.js → headings.js} +4 -4
  26. package/src/example/article/{accordion/home.js → home.js} +5 -5
  27. package/src/example/article/{accordion/inputs.js → inputs.js} +4 -4
  28. package/src/example/article/{accordion/links.js → links.js} +4 -4
  29. package/src/example/article/{accordion/sections.js → sections.js} +4 -4
  30. package/src/example/{article/accordion.js → article.js} +6 -2
  31. package/src/example/articlesArray.js +11 -11
  32. package/src/index.js +0 -1
  33. package/src/item/accordion.js +5 -3
  34. package/lib/example/article/accordion.js +0 -35
  35. package/src/article/accordion.js +0 -30
package/README.md CHANGED
@@ -94,10 +94,10 @@ An example array of arrays of articles is shown below:
94
94
 
95
95
  ```
96
96
  const ArticlesArray = [ ///
97
- [ HomeAccordionArticle, LinksAccordionArticle, ButtonsAccordionArticle, HeadingsAccordionArticle ],
98
- CodesAccordionArticle,
99
- InputsAccordionArticle,
100
- SectionsAccordionArticle
97
+ [ HomeArticle, LinksArticle, ButtonsArticle, HeadingsArticle ],
98
+ CodesArticle,
99
+ InputsArticle,
100
+ SectionsArticle
101
101
  ];
102
102
 
103
103
  export default ArticlesArray;
@@ -105,15 +105,15 @@ export default ArticlesArray;
105
105
 
106
106
  In fact not all the elements of the outermost array need to be arrays, single articles are coerced into arrays automatically. For genuine arrays the first element is taken as the main article in that it's title is shown in the accordion and associated navigation buttons. There is no second level navigation to enable the other articles to be shown. However, if they are shown by means of links or whatever, both the accordion and associated navigation will respond by enabling the button corresponding to the first article in the array, thus allowing the user to navigate back to it.
107
107
 
108
- The articles provided must extend the `AccordionArticle` class and provide `title`, `uri` and` path` static properties. For example:
108
+ The articles provided must have `title`, `uri` and` path` static properties. For example:
109
109
 
110
110
  ```
111
- import AccordionArticle from "../../article/accordion";
111
+ import Article from"/../article";
112
112
 
113
- import { buttonsURI } from "../../uris";
114
- import { buttonsPath } from "../../paths";
113
+ import { buttonsURI } from "../uris";
114
+ import { buttonsPath } from "../paths";
115
115
 
116
- export default class ButtonsAccordionArticle extends AccordionArticle {
116
+ export default class ButtonsArticle extends Article {
117
117
  childElements() {
118
118
  return (
119
119
 
@@ -137,6 +137,8 @@ export default class ButtonsAccordionArticle extends AccordionArticle {
137
137
  };
138
138
  }
139
139
  ```
140
+ Note that a predefined `Article` class has been extended here, see the styles section below.
141
+
140
142
  Paths are used to match URIs and should be regular expressions. This means that URIs that include, say, dynamic identifiers, can be matched.
141
143
 
142
144
  ## Styles
@@ -187,12 +189,16 @@ export default withStyle(AccordionNavigation)`
187
189
  ```
188
190
  Note that as well as the `grid-arae` property the navigation's visibility is toggled as the screen width changes.
189
191
 
190
- Before looking at the accordion, note that you may also wish to override the default `AccordionArticle` class in order to set the appropriate whitespace around the articles:
192
+ Before looking at the accordion, note that you may also wish to create an `Article` class in order to set the appropriate whitespace around the articles:
191
193
 
192
194
  ```
193
- import { AccordionArticle } from "easy-navigation";
195
+ import { Element } from "easy";
196
+
197
+ class Article extends Element {
198
+ static tagName = "article";
199
+ }
194
200
 
195
- export default withStyle(AccordionArticle)`
201
+ export default withStyle(Article)`
196
202
 
197
203
  padding: 2rem;
198
204