You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 1, 2024. It is now read-only.
There's three ways to grab Undernet for your project: CDN, NPM, or the raw source code.
2
2
3
-
See related documentation to learn the coding patterns and API in the framework's [CSS](/docs/overview/cs) and [JavaScript](/docs/overview/javascript).
3
+
See related documentation to learn the patterns and API in the framework's [CSS](/docs/overview/cs) and [JavaScript](/docs/overview/javascript).
4
4
5
5
## CDN (easiest)
6
6
7
-
The quickest way to use Undernet is to link the bundled js and minified css using a CDN, such as [jsdelivr](https://jsdelivr.com). Note that this route doesn't allow you to customize the CSS like the other options.
7
+
The quickest way to use Undernet is to link the bundled js and minified css using a CDN, such as [jsdelivr](https://jsdelivr.com). Note that this route doesn't allow you to customize the style. For that, refer to the
8
8
9
9
Include the link tag before your custom CSS, and the script tag at the end of your `<body>` content.
10
10
@@ -34,6 +34,15 @@ Include the link tag before your custom CSS, and the script tag at the end of yo
34
34
</html>
35
35
```
36
36
37
+
Note that if you plan to link to and start Undernet via `<script>` tag, it's recommended to add an event listener for `DOMContentLoaded` to ensure the page is ready. Head over to the [JavaScript](/docs/overview/javascript) page to see more examples, including UI frameworks like React.
38
+
39
+
```html
40
+
<script>
41
+
// Undernet is now attached to the `window`
42
+
if (document) document.addEventListener("DOMContentLoaded", Undernet.start)
43
+
</script>
44
+
```
45
+
37
46
## NPM or Yarn
38
47
39
48
You can also install and setup with npm or yarn.
@@ -48,13 +57,15 @@ $ npm install -D undernet
48
57
$ yarn add -D undernet
49
58
```
50
59
51
-
Note that Undernet uses global DOM variables such as `window`, `document`, and `navigator`, which can break server-side rendering. To avoid conflicts, component scripts internally check for these variables before execution. This should not affect SEO in any meaningful way as content isn't generated dynamically.
60
+
Unlike if you use the CDN, the module _does not_ attach Undernet to the `window`.
61
+
62
+
Also, note that Undernet uses global DOM variables like `window` and `document`, which can break server-side rendering. To avoid conflicts, component scripts internally check before execution. This should not affect SEO in any meaningful way as content isn't generated dynamically with Undernet's component scripts.
52
63
53
64
### Sass
54
65
55
-
With NPM, you need to set up two files which import Undernet's Sass partials. In these examples, the Webpack shorthand `~` is used to access `node_modules`, but any tool will do.
66
+
With NPM, you need to set up two files which import Undernet's Sass partials. In these examples, the Webpack shorthand `~` is used to access `node_modules` (it doesn't matter how you get the files, as long as they come from that folder).
56
67
57
-
The first file is your config, which will have Sass utilities including variables, functions, and mixins. This can be imported wherever you want, as many times as you need, to get access to those utilities.
68
+
The first file is your config, which will have Sass helpers like variables, functions, and mixins. This can be imported wherever you want, as many times as you need, to get access to those utilities.
58
69
59
70
In your app, create a file called `_custom-config.scss` like so:
60
71
@@ -65,9 +76,9 @@ In your app, create a file called `_custom-config.scss` like so:
65
76
@import"~undernet/src/scss/utilities/mixins";
66
77
```
67
78
68
-
Note the comment; you can insert or import your variable overrides before the original `config`.
79
+
Note the comment; you can insert or import your variable overrides before the original `config` as all variables use the [Sass `!default` rule](https://sass-lang.com/documentation/variables#default-values).
69
80
70
-
The next file includes the base framework, including all elements, components, and class utilities you might need. **Only import this file once per page/global stylesheet**, otherwise you'll duplicate the selectors for each redundant import. Your app's Sass entry file is a good place to import it.
81
+
The next file should import the core framework, including all elements, components, and class utilities (you can forego any components/elements that aren't relevant to you). **Only import this file once at the global level**, otherwise you'll duplicate the selectors for each redundant import. Your application's Sass entry file is a good place to import it.
71
82
72
83
Create a file called `_custom-undernet.scss` like so:
73
84
@@ -95,12 +106,15 @@ Finally, import `custom-undernet.scss` to your app's Sass entry file, wherever t
95
106
// all your other styles after
96
107
```
97
108
98
-
... or link to the compiled CSS in your layout.
109
+
... or link to the compiled CSS in your layout, before custom stylesheet links or style tags..
Note that if you plan to start Undernet's JS inline via `<script>` tag, it's recommended to add an event listener for `DOMContentLoaded` to ensure the page is ready.
123
-
124
-
```html
125
-
<script>
126
-
if (document) document.addEventListener("DOMContentLoaded", Undernet.start)
127
-
</script>
128
-
```
129
-
130
-
Similarly, if you are in a UI framework such as React, the appropriate lifecycle method would be `componentDidMount`. If you take this route, be sure to tear down the events in the corresponding `componentWillUnmount`.
131
-
132
-
```js
133
-
componentDidMount() {
134
-
Undernet.start()
135
-
}
136
-
componentWillUnmount() {
137
-
Undernet.stop()
138
-
}
139
-
```
140
-
141
-
In the case of React hooks, you can use `useState`:
142
-
143
-
```js
144
-
constobservedState= []
145
-
constcomponentUnmountFn=Undernet.stop
146
-
constcomponentMountFn= () => {
147
-
Undernet.start()
148
-
return componentUnmountFn
149
-
}
150
-
useEffect(componentMountFn, observedState)
151
-
```
152
-
153
-
If you're using a framework to affect DOM state (including removing nodes from the DOM), you might want to be careful. Undernet isn't smart enough to know that your DOM changed, so you should "stop" right before changing state, and "start" once the DOM is rendered and ready again.
154
-
155
-
Let's look at a real world example, again using React hooks:
// stop accordions if sidebar is visible, right before we close it!
162
-
if (showSidebar) {
163
-
Accordion.stop(".sidebar-wrapper")
164
-
}
165
-
setShowSidebar(false)
166
-
}
167
-
useEffect(() => {
168
-
// if sidebar has become visible, start accordions again
169
-
if (showSidebar) {
170
-
Accordion.start(".sidebar-wrapper")
171
-
}
172
-
}, [showSidebar])
173
-
```
174
-
175
-
In this example, we have a `handleClick` function that is connected to a button to hide a sidebar containing an accordion.
176
-
177
-
We want to "stop" accordions from the DOM by checking if `showsidebar` is currently `true`, before `setShowSidebar` is called.
178
-
179
-
Then, to "start" accordions again, an effect is implemented re-checking `showSidebar`; if it's `true`, we know the sidebar has been re-expanded, so we can start them again.
180
-
181
136
---
182
137
<p class="has-text-end">Is this article inaccurate? <a href="https://github.com/geotrev/undernet/tree/master/app/docs/download.md">Edit this page on Github!</a></p>
Welcome! Undernet is a fully modular, highly configurable set of base CSS styles and interactive UI components. It's also responsive and internationalization-friendly for right-to-left languages.
1
+
Welcome! Undernet is a fully modular, highly configurable set of base CSS styles and interactive UI components. It is responsive and automatically handles right-to-left languages with its styles and components.
2
2
3
3
The framework is extremely light, carrying no external dependencies. It's available via CDN, [NPM](https://www.npmjs.org/package/undernet), and as a raw download.
4
4
@@ -10,14 +10,14 @@ Undernet was created with the goal of simplifying the development experience, al
10
10
11
11
Over time, lots of new features have been added. These include lots of helper CSS classes and Sass utilities to empower developers in building their interfaces.
12
12
13
-
Undernet can both be a prototyping tool or the basis for your web app. You can easily pick and choose which elements and components to include, reducing the size of the overall bundle.
13
+
Undernet can both be a prototyping tool _or_ the basis for your web app. You can easily pick and choose which elements and components to include, reducing the size of the overall bundle.
14
14
15
15
### Core Principles
16
16
17
-
- 🧩 **Configuration:** The framework comes with a configuration file enabling full brand control, from global to element-specific styling.
18
-
- ♿ **Accessibility:** Accessibility is baked in to interactive components like dropdowns and modals, to ensure everyone can use your interface.
19
-
- 📦 **Modularity:** Undernet can act independently from your core stylesheet and can be added to to existing projects using [scopes](/docs/overview/css).
20
-
- 🚲 **Agility:** Installation options range from CDN to hosting the source files yourself.
17
+
- 🧩 **Configurable:** The framework comes with a configuration file enabling full brand control, from global, to element, to component styling.
18
+
- ♿ **Accessible:** Accessibility is baked into all facets of Underneet; theree's no excuse why everyone can't use your interface.
19
+
- 📦 **Modular:** Undernet can act independently from your core stylesheet and be added to to existing projects using a style [scope](/docs/overview/css).
20
+
- 🚲 **Flexible:** Installation options range from CDN to hosting the source files yourself.
21
21
22
22
### Support
23
23
@@ -28,13 +28,12 @@ Undernet's CSS and JavaScript will work in _recent versions_ these browsers:
28
28
- Safari ✓
29
29
- Opera ✓
30
30
31
-
The framework is also tested in and supports **Internet Explorer 11** and **Edge**(non-chromium) on Windows. Support for IE11 and non-chromium Edge may drop in the near future as the new Edge is rolled out in 2020.
31
+
The framework is also tested in and supports **Internet Explorer 11** and **Edge** on Windows. Support for IE11 and Edge may drop in the near future as chromium Edge is rolled out.
32
32
33
33
## Contribute
34
34
35
-
Undernet is completely [free and open source](https://en.wikipedia.org/wiki/Free_and_open-source_software)!
36
-
37
-
Contribute on [Github](https://www.github.com/geotrev/undernet/) if you have questions or a want to file a bug report. Be sure to [read about contributing](https://github.com/geotrev/undernet/blob/master/CONTRIBUTING.md) before filing a bug or pull request.
35
+
Undernet supports a FOSS methodology ([free and open source](https://en.wikipedia.org/wiki/Free_and_open-source_software)). You can contribute on [Github](https://www.github.com/geotrev/undernet/) if you have questions or a want to file a bug report. Be sure to [read about contributing](https://github.com/geotrev/undernet/blob/master/CONTRIBUTING.md) before filing a bug or pull request.
38
36
39
37
---
38
+
40
39
<pclass="has-text-end">Is this article inaccurate? <ahref="https://github.com/geotrev/undernet/tree/master/app/docs/introduction.md">Edit this page on Github!</a></p>
0 commit comments