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.
- package/README.md +18 -12
- package/example.js +305 -368
- package/lib/button/accordion.js +2 -2
- package/lib/button/navigation/accordion.js +3 -3
- package/lib/constants.js +4 -2
- package/lib/div/accordion.js +3 -3
- package/lib/example/article/{accordion/buttons.js → buttons.js} +17 -17
- package/lib/example/article/{accordion/codes.js → codes.js} +17 -17
- package/lib/example/article/{accordion/inputs.js → headings.js} +19 -19
- package/lib/example/article/{accordion/home.js → home.js} +18 -18
- package/lib/example/article/{accordion/headings.js → inputs.js} +19 -19
- package/lib/example/article/{accordion/links.js → links.js} +17 -17
- package/lib/example/article/{accordion/sections.js → sections.js} +17 -17
- package/lib/{article/accordion.js → example/article.js} +35 -53
- package/lib/example/articlesArray.js +8 -8
- package/lib/index.js +9 -16
- package/lib/item/accordion.js +3 -3
- package/package.json +1 -1
- package/src/button/accordion.js +1 -1
- package/src/button/navigation/accordion.js +3 -2
- package/src/constants.js +1 -0
- package/src/div/accordion.js +3 -3
- package/src/example/article/{accordion/buttons.js → buttons.js} +4 -4
- package/src/example/article/{accordion/codes.js → codes.js} +4 -4
- package/src/example/article/{accordion/headings.js → headings.js} +4 -4
- package/src/example/article/{accordion/home.js → home.js} +5 -5
- package/src/example/article/{accordion/inputs.js → inputs.js} +4 -4
- package/src/example/article/{accordion/links.js → links.js} +4 -4
- package/src/example/article/{accordion/sections.js → sections.js} +4 -4
- package/src/example/{article/accordion.js → article.js} +6 -2
- package/src/example/articlesArray.js +11 -11
- package/src/index.js +0 -1
- package/src/item/accordion.js +5 -3
- package/lib/example/article/accordion.js +0 -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
|
-
[
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
|
108
|
+
The articles provided must have `title`, `uri` and` path` static properties. For example:
|
|
109
109
|
|
|
110
110
|
```
|
|
111
|
-
import
|
|
111
|
+
import Article from"/../article";
|
|
112
112
|
|
|
113
|
-
import { buttonsURI } from "
|
|
114
|
-
import { buttonsPath } from "
|
|
113
|
+
import { buttonsURI } from "../uris";
|
|
114
|
+
import { buttonsPath } from "../paths";
|
|
115
115
|
|
|
116
|
-
export default class
|
|
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
|
|
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 {
|
|
195
|
+
import { Element } from "easy";
|
|
196
|
+
|
|
197
|
+
class Article extends Element {
|
|
198
|
+
static tagName = "article";
|
|
199
|
+
}
|
|
194
200
|
|
|
195
|
-
export default withStyle(
|
|
201
|
+
export default withStyle(Article)`
|
|
196
202
|
|
|
197
203
|
padding: 2rem;
|
|
198
204
|
|