sf-i-events 1.0.748 → 1.0.750

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 copy.md CHANGED
@@ -1,588 +1,588 @@
1
- <img src="https://superflows-images.s3.ap-south-1.amazonaws.com/superflows_logo_gray_c2c.png" width="400"/>
2
-
3
- # SfIEvents
4
-
5
- > Navigation web component provided by Superflows. This component allows implementation of the single page application architecture (SPA) using pure HTML, CSS and Javascript.
6
-
7
- <br />
8
-
9
- ## Powered by
10
-
11
- <img src="https://superflows-images.s3.ap-south-1.amazonaws.com/lit_logo.png" width="100" />
12
-
13
- <br />
14
-
15
- ## i ♥
16
-
17
- <img src="https://superflows-images.s3.ap-south-1.amazonaws.com/Building+in+public.png" width="300" />
18
-
19
- <br />
20
-
21
- [![NPM](https://img.shields.io/npm/v/sf-i-events.svg)](https://www.npmjs.com/package/sf-i-events) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
22
-
23
- <br />
24
-
25
- ## Video Tutorial
26
-
27
- <a href="https://youtu.be/ZGDhUaleN84"><img src="https://user-images.githubusercontent.com/108924653/212681990-afb09c0e-6d88-4b29-ae6a-e3a046dd0bdb.png" width="200"/></a>
28
-
29
- <br />
30
-
31
- ## Table of Contents
32
-
33
- - [Motivation](#motivation)
34
- - [Design](#design)
35
- - [Development & Quality Control](#development--quality-control)
36
- - [Features](#features)
37
- - [Functionality](#functionality)
38
- - [Demo](#demo)
39
- - [Usage](#usage)
40
- - [Tutorial](#tutorial)
41
- - [Testing](#testing)
42
- - [Dev Server](#dev-server)
43
- - [Documentation](#documentation)
44
- - [Demo Project](#demo-project)
45
- - [YouTube Channel](#youtube-channel)
46
- - [Join The Community](#join-the-community)
47
-
48
- <br />
49
-
50
- ## Motivation
51
-
52
- Can modular web design be achieved using just html, css and javascript? Theoretically the answer is yes. Web components rolling out in the HTML specification has opened up a lot of possibilities. The motivation of this library is building a navigation bar web component that enables a modular single page applications architecture using purely html, css, javascript. 
53
-
54
- <br />
55
-
56
- ## Design
57
-
58
- Approach is to keep the design dead simple and to support most popular navbar functionality. "Unless a clean & simple way to implement a new feature that doesn't complicate the life of the developer-user is figured out, it is not taken up for development." is the guiding philosophy.
59
-
60
- <br />
61
-
62
- ## Development & Quality Control
63
-
64
- Test driven development approach with a focus on maintaining 100 percent unit test code coverage for the main workflow is the methodology of working.
65
-
66
- <br />
67
-
68
- ## Features
69
-
70
- - **Accessibility** - This web component is designed considering the W3C accessibility recommendations
71
- - **Interoperability** - This is a web component, hence natively supported by the browsers. It can be used across any frontend framework such as React, Angular, Vue or with no framework at all
72
-
73
- <br />
74
-
75
- ## Functionality
76
-
77
- - **Header & Footer** - SfIEvents component generates both the header and footer view
78
- - **Routing** - Routing is built inside this component, no external routing library required
79
- - **Brand Info** - Brand name and logo are customizable
80
- - **Main Menu** - Menu is fully customizable and is accepted as an un-ordered list
81
- - **Search Input** - SfIEvents ships with a search input field
82
- - **Social Media** - SfIEvents accepts social media links as an un-ordered list and renders them into the footer
83
- - **Copyright Notice** - SfIEvents accepts copyright notice as input and renders it into the footer
84
- - **Notifications** - Notifications feature is in-built, which includes a notification bell and a dropdown list to show recent notifications
85
- - **Call-to-action Button** - SfIEvents comes with a call-to-action button, which can be used to highlight key actions such as sign in and subscribe.
86
- - **Profile Section** - User profile section is also included, which can be used to show the status of a signed in user. It also includes a separate profile menu, that is customizable as well.
87
- - **Customizability** - SfIEvents colors can be customized using css custom properties
88
- - **Responsiveness** - SfIEvents nicely adapts to all screen sizes
89
- - **Keyboard Navigation** - It allows keyboard navigation across all elements on desktop, mobile and tablet form factors.
90
- - **Screen Reader Support** - It supports both desktop and mobile screen readers making your app acceessible to partially or completely blind users.
91
-
92
- <br />
93
-
94
- ## Demo
95
-
96
- <a href="https://replit.com/@SuperflowsAppv3/Single-Page-Modular-App-Using-Pure-HTML-CSS-Javascript#index.html"><img width="100" src="https://superflows-images.s3.ap-south-1.amazonaws.com/View+Demo.png" /></a>
97
-
98
- <br />
99
-
100
- ## Usage
101
-
102
- ```html
103
-
104
- <!DOCTYPE html>
105
-
106
- <html>
107
- <head>
108
- <meta charset="utf-8" />
109
- <meta name="viewport" content="width=device-width, initial-scale=1">
110
- <title>&lt;sf-i-events&gt; Demo</title>
111
- <!-- Integration material icons as they are used in sf-i-events -->
112
- <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
113
- <!-- Google fonts integration -->
114
- <link rel="preconnect" href="https://fonts.googleapis.com">
115
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
116
- <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@200;300;400;600&display=swap" rel="stylesheet">
117
- <!-- Integration the web components module -->
118
- <script src="https://unpkg.com/@webcomponents/webcomponentsjs@latest/webcomponents-loader.js"></script>
119
- <!-- Integration lit and sf-i-events web components module -->
120
- <script type="module">
121
- import {LitElement, html, css} from 'https://unpkg.com/lit-element/lit-element.js?module';
122
- import {SfIEvents} from 'https://unpkg.com/sf-i-events/sf-i-events.js?module';
123
- </script>
124
- <style>
125
-
126
- body {
127
- background-color: #efefef;
128
- margin: 0px;
129
- font-family: 'Source Sans Pro';
130
- }
131
-
132
- sf-i-events:not(:defined) {
133
- display: none;
134
- }
135
-
136
- sf-i-events {
137
- --nav-background-color: rgb(4, 135, 205);
138
- --nav-color: #fff;
139
- --notif-background-color: rgb(4, 135, 205);
140
- --notif-color: #fff;
141
- --menu-background-color: rgb(49, 161, 222);
142
- --menu-color: #fff;
143
- --footer-background-color: rgb(167, 147, 60);
144
- --footer-color: #fff;
145
- }
146
-
147
- </style>
148
- </head>
149
- <body style="margin: 0px;">
150
- <sf-i-events>
151
- <!-- Set the brand name -->
152
- <h2 slot="brandName"><a href="#home" >Superflows</a></h2>
153
- <!-- Set the brand logo -->
154
- <a slot="brandImage" href="#home" ><img alt="logo" src="https://superflows-images.s3.ap-south-1.amazonaws.com/superflows_white_transparent_200.png" /></a>
155
- <!-- Set the main menu -->
156
- <ul slot="mainMenu">
157
- <li><a href="#about">About</a></li>
158
- <li class="li-solutions">
159
- <a href="javascript:void(0);" class="a-solutions">Solutions</a>
160
- <ul>
161
- <li><a href="#services">Services</a></li>
162
- <li><a href="#products">Products</a></li>
163
- </ul>
164
- </li>
165
- <li>
166
- <a href="javascript:void(0);">Contact Us</a>
167
- <ul>
168
- <li><a href="https://instagram.com">Instagram</a></li>
169
- <li><a href="https://facebook.com">Facebook</a></li>
170
- <li><a href="https://youtube.com">YouTube</a></li>
171
- </ul>
172
- </li>
173
- </ul>
174
- <!-- Set the social media links -->
175
- <ul slot="socialMedia">
176
- <li><a href="https://facebook.com"><img src="https://superflows-images.s3.ap-south-1.amazonaws.com/facebook-black_round.png" /></a></li>
177
- <li><a href="https://twitter.com"><img src="https://superflows-images.s3.ap-south-1.amazonaws.com/twitter_black_round.png" /></a></li>
178
- <li><a href="https://youtube.com"><img src="https://superflows-images.s3.ap-south-1.amazonaws.com/youtube_black_round.png" /></a></li>
179
- </ul>
180
- <!-- Set the notifications -->
181
- <ul slot="unreadNotifications">
182
- <li><a href="#notification/1"><h3>Sonali Joshi</h3><p>mentioned you in a comment</p><div>1 day ago</div></a></li>
183
- <li><a href="#notification/2"><h3>Rahim Ahmed</h3><p>reacted to your blog post</p><div>2 days ago</div></a></li>
184
- <li><a href="#notification/3"><h3>John Bolton</h3><p>replied to a thread that you posted in</p><div>1 month ago</div></a></li>
185
- </ul>
186
- <ul slot="readNotifications">
187
- <li><a href="#notification/4"><h3>Sonali Joshi</h3><p>mentioned you in a comment</p><div>1 day ago</div></a></li>
188
- <li><a href="#notification/5"><h3>Rahim Ahmed</h3><p>reacted to your blog post</p><div>2 days ago</div></a></li>
189
- <li><a href="#notification/6"><h3>John Bolton</h3><p>replied to a thread that you posted in</p><div>1 month ago</div></a></li>
190
- </ul>
191
- <a slot="notificationsList" href="#notifications">View All</a>
192
- <!-- Set CTA -->
193
- <a slot="cta" href="#login">Sign In</a>
194
- <!-- Set copyright notice -->
195
- <p slot="copyright">Copyright 2022 Superflows</p>
196
- <!-- Profile picture -->
197
- <img alt="profile" slot="profilePicture" src="https://preview.keenthemes.com/metronic-v4/theme/assets/pages/media/profile/profile_user.jpg" />
198
- <!-- Set the profile menu -->
199
- <ul slot="profileMenu">
200
- <li><a href="#settings">My Profile</a></li>
201
- <li>
202
- <a href="javascript:void(0);">Settings</a>
203
- <ul>
204
- <li><a href="#settings_data">Data & Privacy</a></li>
205
- <li><a href="#settings_notifications">Notifications</a></li>
206
- </ul>
207
- </li>
208
- <li>
209
- <a href="javascript:void(0);">Support</a>
210
- <ul>
211
- <li><a href="#ticket">Create Ticket</a></li>
212
- <li><a href="#chat">Chat With Us</a></li>
213
- </ul>
214
- </li>
215
- <li><a href="#signout">Sign Out</a></li>
216
- </ul>
217
- <!-- Page Content -->
218
- <div slot="content"></div>
219
- </sf-i-events>
220
-
221
- <script>
222
- var routeMap = [];
223
- </script>
224
- <script>
225
- function getCurrentPathName() {
226
- return window.location.hash.length === 0 ? '' : window.location.hash.split("/")[0].replace('#', '');
227
- }
228
- function getCurrentArgs() {
229
- return routeMap[getCurrentPathName() + '.html'];
230
- }
231
- </script>
232
- <script>
233
- document.getElementsByTagName('sf-i-events')[0].addEventListener('searchClick', () => {console.log('hurray');})
234
- document.getElementsByTagName('sf-i-events')[0].addEventListener('routeChange', (e) => {
235
- routeMap[e.detail.pathName] = e.detail.args;
236
- })
237
- </script>
238
- </body>
239
- </html>
240
-
241
- ```
242
-
243
- <br />
244
-
245
- ## Tutorial
246
-
247
- <br />
248
-
249
- ### Step 1 - Create an html page
250
-
251
- Create an html page and add the following html content to it:
252
-
253
- ```html
254
-
255
- <!DOCTYPE html>
256
-
257
- <html>
258
- <head>
259
- <meta charset="utf-8" />
260
- <meta name="viewport" content="width=device-width, initial-scale=1">
261
- <title>&lt;sf-i-events&gt; Demo</title>
262
- <!-- Integration material icons as they are used in sf-i-events -->
263
- <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
264
- <!-- Google fonts integration -->
265
- <link rel="preconnect" href="https://fonts.googleapis.com">
266
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
267
- <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@200;300;400;600&display=swap" rel="stylesheet">
268
- <!-- Integration the web components module -->
269
- <script src="https://unpkg.com/@webcomponents/webcomponentsjs@latest/webcomponents-loader.js"></script>
270
- <!-- Integration lit and sf-i-events web components module -->
271
- <script type="module">
272
- import {LitElement, html, css} from 'https://unpkg.com/lit-element/lit-element.js?module';
273
- import {SfIEvents} from 'https://unpkg.com/sf-i-events/sf-i-events.js?module';
274
- </script>
275
- <style>
276
-
277
- body {
278
- background-color: #efefef;
279
- margin: 0px;
280
- font-family: 'Source Sans Pro';
281
- }
282
-
283
- sf-i-events:not(:defined) {
284
- display: none;
285
- }
286
-
287
- </style>
288
- </head>
289
- <body>
290
- <!-- Add the component tag -->
291
- <sf-i-events>
292
- <!-- Set the brand name -->
293
- <h2 slot="brandName"><a href="#home" >Superflows</a></h2>
294
- </sf-i-events>
295
- </body>
296
- </html>
297
-
298
- ```
299
-
300
- A bare bones version of the navigation header and footer, which includes only the brand name will be rendered. This will be our starting point!
301
-
302
- <br />
303
-
304
- ### Step 2 - Setup Brand Info
305
-
306
- Set the brand logo as show below. It will be rendered both in the header and the footer.
307
-
308
- ```html
309
-
310
- <sf-i-events>
311
- <!-- Set the brand name -->
312
- <h2 slot="brandName"><a href="#home" >Superflows</a></h2>
313
- <!-- Set the brand logo -->
314
- <a slot="brandImage" href="#home" ><img alt="logo" src="https://superflows-images.s3.ap-south-1.amazonaws.com/superflows_white_transparent_200.png" /></a>
315
- </sf-i-events>
316
-
317
- ```
318
-
319
- <br />
320
-
321
- ### Step 3 - Routing
322
-
323
- Routing is enabled by default. Every hash link specified in the SfIEvents component needs to be backed by its separate html component. For example the links in the brand info section (above section), contains #home as the link. For routing to work, simply create a separate home.html component for it. SfIEvents will then automatically take care of routing.
324
-
325
- ```html
326
-
327
- <sf-i-events>
328
- <!-- Page Content -->
329
- <div slot="content">
330
- </div>
331
- </sf-i-events>
332
-
333
- ```
334
-
335
- For passing parameters to individual components, include the following javascript code. Individual components can then fetch their parameters from the associative array routeMap.
336
-
337
- ```html
338
- <script>
339
- var routeMap = [];
340
-
341
- function getCurrentPathName() {
342
- return window.location.hash.length === 0 ? '' : window.location.hash.split("/")[0].replace('#', '');
343
- }
344
- function getCurrentArgs() {
345
- return routeMap[getCurrentPathName() + '.html'];
346
- }
347
-
348
- document.getElementsByTagName('sf-i-events')[0].addEventListener('searchClick', () => {console.log('hurray');})
349
- document.getElementsByTagName('sf-i-events')[0].addEventListener('routeChange', (e) => {
350
- routeMap[e.detail.pathName] = e.detail.args;
351
- })
352
- </script>
353
- ```
354
-
355
- <br />
356
-
357
- ### Step 4 - Setup Main Menu
358
-
359
- You can compose your menu using unordered lists, as shown in the below example.
360
-
361
- ```html
362
-
363
- <sf-i-events>
364
- <!-- Set the main menu -->
365
- <ul slot="mainMenu">
366
- <li><a href="#about">About</a></li>
367
- <li class="li-solutions">
368
- <a href="javascript:void(0);" class="a-solutions">Solutions</a>
369
- <ul>
370
- <li><a href="#services">Services</a></li>
371
- <li><a href="#products">Products</a></li>
372
- </ul>
373
- </li>
374
- <li>
375
- <a href="javascript:void(0);">Contact Us</a>
376
- <ul>
377
- <li><a href="https://instagram.com">Instagram</a></li>
378
- <li><a href="https://facebook.com">Facebook</a></li>
379
- <li><a href="https://youtube.com">YouTube</a></li>
380
- </ul>
381
- </li>
382
- </ul>
383
- </sf-i-events>
384
-
385
- ```
386
-
387
- <br />
388
-
389
- ### Step 5 - Setup Search
390
-
391
- Search Input is shown by default and the SfIEvents component throws a searchClick event after the user types something in the search input field and presses enter. To handle the searchClick event:
392
-
393
- ```html
394
-
395
- <script>
396
- document.getElementsByTagName('sf-i-events')[0].addEventListener('searchClick', () => {console.log('search clicked');})
397
- </script>
398
-
399
- ```
400
-
401
- <br />
402
-
403
- ### Step 6 - Setup Social Media Links
404
-
405
- Social media links can be configured using unordered lists, and are shown in the footer. Set them up as follows:
406
-
407
- ```html
408
-
409
- <sf-i-events>
410
- <!-- Set the social media links -->
411
- <ul slot="socialMedia">
412
- <li><a href="https://facebook.com"><img src="https://superflows-images.s3.ap-south-1.amazonaws.com/facebook-black_round.png" /></a></li>
413
- <li><a href="https://twitter.com"><img src="https://superflows-images.s3.ap-south-1.amazonaws.com/twitter_black_round.png" /></a></li>
414
- <li><a href="https://youtube.com"><img src="https://superflows-images.s3.ap-south-1.amazonaws.com/youtube_black_round.png" /></a></li>
415
- </ul>
416
- </sf-i-events>
417
-
418
- ```
419
-
420
- ### Step 7 - Setup Notifications
421
-
422
- Notifications dropdown can be configured using unordered lists as shown in the example below. Notifications functionality has three parts - (1) Unread notifications, (2) Read Notifications, (3) Notifications List Link. All of them can be configured separately:
423
-
424
- ```html
425
-
426
- <sf-i-events>
427
- <!-- Set the notifications -->
428
- <ul slot="unreadNotifications">
429
- <li><a href="#notification/1"><h3>Sonali Joshi</h3><p>mentioned you in a comment</p><div>1 day ago</div></a></li>
430
- <li><a href="#notification/2"><h3>Rahim Ahmed</h3><p>reacted to your blog post</p><div>2 days ago</div></a></li>
431
- <li><a href="#notification/3"><h3>John Bolton</h3><p>replied to a thread that you posted in</p><div>1 month ago</div></a></li>
432
- </ul>
433
- <ul slot="readNotifications">
434
- <li><a href="#notification/4"><h3>Sonali Joshi</h3><p>mentioned you in a comment</p><div>1 day ago</div></a></li>
435
- <li><a href="#notification/5"><h3>Rahim Ahmed</h3><p>reacted to your blog post</p><div>2 days ago</div></a></li>
436
- <li><a href="#notification/6"><h3>John Bolton</h3><p>replied to a thread that you posted in</p><div>1 month ago</div></a></li>
437
- </ul>
438
- <a slot="notificationsList" href="#notifications">View All</button>
439
- </sf-i-events>
440
-
441
- ```
442
-
443
- <br />
444
-
445
- ### Step 8 - Setup Copyright notice
446
-
447
- Copyright notice can be shown in the footer as follows:
448
-
449
- ```html
450
-
451
- <sf-i-events>
452
- <p slot="copyright">Copyright 2022 Superflows</p>
453
- <!-- other config -->
454
- </sf-i-events>
455
-
456
- ```
457
-
458
- <br />
459
-
460
- ### Step 9 - Setup Call To Action
461
-
462
- You can add a call to action (CTA) button to the header as follows:
463
-
464
- ```html
465
-
466
- <sf-i-events>
467
- <a slot="cta" href="#login">Sign In</a>
468
- <!-- other config -->
469
- </sf-i-events>
470
-
471
- ```
472
-
473
- <br />
474
-
475
- ### Step 10 - Setup Profile Section
476
-
477
- Profile section mainly contains two things - (1) Profile picture toggle, (2) Dropdown menu. You can configure both these as follows:
478
-
479
- ```html
480
-
481
- <sf-i-events>
482
- <!-- Profile picture -->
483
- <img alt="profile" slot="profilePicture" src="https://preview.keenthemes.com/metronic-v4/theme/assets/pages/media/profile/profile_user.jpg" />
484
- <!-- Set the profile menu -->
485
- <ul slot="profileMenu">
486
- <li><a href="#settings">My Profile</a></li>
487
- <li>
488
- <a href="javascript:void(0);">Settings</a>
489
- <ul>
490
- <li><a href="#settings_data">Data & Privacy</a></li>
491
- <li><a href="#settings_notifications">Notifications</a></li>
492
- </ul>
493
- </li>
494
- <li>
495
- <a href="javascript:void(0);">Support</a>
496
- <ul>
497
- <li><a href="#ticket">Create Ticket</a></li>
498
- <li><a href="#chat">Chat With Us</a></li>
499
- </ul>
500
- </li>
501
- <li><a href="#signout">Sign Out</a></li>
502
- </ul>
503
- <!-- other config -->
504
- </sf-i-events>
505
-
506
- ```
507
-
508
- <br />
509
-
510
- ### Step 11 - Customize The Appearance
511
-
512
- Css custom properties can be used to customize the appearance as follows:
513
-
514
- ```html
515
-
516
- <head>
517
- <style>
518
-
519
-
520
- sf-i-events {
521
- --nav-background-color: rgb(4, 135, 205);
522
- --nav-color: #fff;
523
- --notif-background-color: rgb(4, 135, 205);
524
- --notif-color: #fff;
525
- --menu-background-color: rgb(49, 161, 222);
526
- --menu-color: #fff;
527
- --footer-background-color: rgb(167, 147, 60);
528
- --footer-color: #fff;
529
- }
530
-
531
- </style>
532
- </head>
533
-
534
- ```
535
-
536
-
537
- ## Testing
538
-
539
- Tests can be run with the `test` script.
540
-
541
- ```bash
542
- npm test
543
- ```
544
-
545
- - Chromium: |██████████████████████████████| 2/2 test files | 9 passed, 0 failed
546
- - Firefox: |██████████████████████████████| 2/2 test files | 9 passed, 0 failed
547
- - Webkit: |██████████████████████████████| 2/2 test files | 9 passed, 0 failed
548
- - Code coverage: 98.63 % (Overall) 100% (Main flow)
549
- - View full coverage report at coverage/lcov-report/index.html
550
-
551
- <br />
552
-
553
- ## Dev Server
554
-
555
- To run the dev server and open the project in a new browser tab:
556
-
557
- ```bash
558
- npm run serve
559
- ```
560
-
561
- There is a development HTML file located at `/dev/index.html` that you can view at http://localhost:8000/dev/index.html. Note that this command will serve your code using Lit's development mode (with more verbose errors). To serve your code against Lit's production mode, use `npm run serve:prod`.
562
-
563
- <br />
564
-
565
- ## Documentation
566
-
567
- [Read](https://superflows.dev/docs/navigation)
568
-
569
- ## Demo Project
570
-
571
- [View Demo](https://replit.com/@SuperflowsAppv3/Single-Page-Modular-App-Using-Pure-HTML-CSS-Javascript#index.html)
572
-
573
- ## YouTube Channel
574
-
575
- [View Channel](https://www.youtube.com/channel/UCYNJLCE48yir4DsquciBuDw)
576
-
577
- ## Join The Community
578
-
579
- [Join Now](https://discord.gg/ksEXS4P9h6)
580
-
581
- ## Blog
582
-
583
- [Read](https://blog.superflows.dev/)
584
-
585
- ## License
586
-
587
- MIT © [superflows-dev](https://github.com/superflows-dev)
588
-
1
+ <img src="https://superflows-images.s3.ap-south-1.amazonaws.com/superflows_logo_gray_c2c.png" width="400"/>
2
+
3
+ # SfIEvents
4
+
5
+ > Navigation web component provided by Superflows. This component allows implementation of the single page application architecture (SPA) using pure HTML, CSS and Javascript.
6
+
7
+ <br />
8
+
9
+ ## Powered by
10
+
11
+ <img src="https://superflows-images.s3.ap-south-1.amazonaws.com/lit_logo.png" width="100" />
12
+
13
+ <br />
14
+
15
+ ## i ♥
16
+
17
+ <img src="https://superflows-images.s3.ap-south-1.amazonaws.com/Building+in+public.png" width="300" />
18
+
19
+ <br />
20
+
21
+ [![NPM](https://img.shields.io/npm/v/sf-i-events.svg)](https://www.npmjs.com/package/sf-i-events) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
22
+
23
+ <br />
24
+
25
+ ## Video Tutorial
26
+
27
+ <a href="https://youtu.be/ZGDhUaleN84"><img src="https://user-images.githubusercontent.com/108924653/212681990-afb09c0e-6d88-4b29-ae6a-e3a046dd0bdb.png" width="200"/></a>
28
+
29
+ <br />
30
+
31
+ ## Table of Contents
32
+
33
+ - [Motivation](#motivation)
34
+ - [Design](#design)
35
+ - [Development & Quality Control](#development--quality-control)
36
+ - [Features](#features)
37
+ - [Functionality](#functionality)
38
+ - [Demo](#demo)
39
+ - [Usage](#usage)
40
+ - [Tutorial](#tutorial)
41
+ - [Testing](#testing)
42
+ - [Dev Server](#dev-server)
43
+ - [Documentation](#documentation)
44
+ - [Demo Project](#demo-project)
45
+ - [YouTube Channel](#youtube-channel)
46
+ - [Join The Community](#join-the-community)
47
+
48
+ <br />
49
+
50
+ ## Motivation
51
+
52
+ Can modular web design be achieved using just html, css and javascript? Theoretically the answer is yes. Web components rolling out in the HTML specification has opened up a lot of possibilities. The motivation of this library is building a navigation bar web component that enables a modular single page applications architecture using purely html, css, javascript. 
53
+
54
+ <br />
55
+
56
+ ## Design
57
+
58
+ Approach is to keep the design dead simple and to support most popular navbar functionality. "Unless a clean & simple way to implement a new feature that doesn't complicate the life of the developer-user is figured out, it is not taken up for development." is the guiding philosophy.
59
+
60
+ <br />
61
+
62
+ ## Development & Quality Control
63
+
64
+ Test driven development approach with a focus on maintaining 100 percent unit test code coverage for the main workflow is the methodology of working.
65
+
66
+ <br />
67
+
68
+ ## Features
69
+
70
+ - **Accessibility** - This web component is designed considering the W3C accessibility recommendations
71
+ - **Interoperability** - This is a web component, hence natively supported by the browsers. It can be used across any frontend framework such as React, Angular, Vue or with no framework at all
72
+
73
+ <br />
74
+
75
+ ## Functionality
76
+
77
+ - **Header & Footer** - SfIEvents component generates both the header and footer view
78
+ - **Routing** - Routing is built inside this component, no external routing library required
79
+ - **Brand Info** - Brand name and logo are customizable
80
+ - **Main Menu** - Menu is fully customizable and is accepted as an un-ordered list
81
+ - **Search Input** - SfIEvents ships with a search input field
82
+ - **Social Media** - SfIEvents accepts social media links as an un-ordered list and renders them into the footer
83
+ - **Copyright Notice** - SfIEvents accepts copyright notice as input and renders it into the footer
84
+ - **Notifications** - Notifications feature is in-built, which includes a notification bell and a dropdown list to show recent notifications
85
+ - **Call-to-action Button** - SfIEvents comes with a call-to-action button, which can be used to highlight key actions such as sign in and subscribe.
86
+ - **Profile Section** - User profile section is also included, which can be used to show the status of a signed in user. It also includes a separate profile menu, that is customizable as well.
87
+ - **Customizability** - SfIEvents colors can be customized using css custom properties
88
+ - **Responsiveness** - SfIEvents nicely adapts to all screen sizes
89
+ - **Keyboard Navigation** - It allows keyboard navigation across all elements on desktop, mobile and tablet form factors.
90
+ - **Screen Reader Support** - It supports both desktop and mobile screen readers making your app acceessible to partially or completely blind users.
91
+
92
+ <br />
93
+
94
+ ## Demo
95
+
96
+ <a href="https://replit.com/@SuperflowsAppv3/Single-Page-Modular-App-Using-Pure-HTML-CSS-Javascript#index.html"><img width="100" src="https://superflows-images.s3.ap-south-1.amazonaws.com/View+Demo.png" /></a>
97
+
98
+ <br />
99
+
100
+ ## Usage
101
+
102
+ ```html
103
+
104
+ <!DOCTYPE html>
105
+
106
+ <html>
107
+ <head>
108
+ <meta charset="utf-8" />
109
+ <meta name="viewport" content="width=device-width, initial-scale=1">
110
+ <title>&lt;sf-i-events&gt; Demo</title>
111
+ <!-- Integration material icons as they are used in sf-i-events -->
112
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
113
+ <!-- Google fonts integration -->
114
+ <link rel="preconnect" href="https://fonts.googleapis.com">
115
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
116
+ <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@200;300;400;600&display=swap" rel="stylesheet">
117
+ <!-- Integration the web components module -->
118
+ <script src="https://unpkg.com/@webcomponents/webcomponentsjs@latest/webcomponents-loader.js"></script>
119
+ <!-- Integration lit and sf-i-events web components module -->
120
+ <script type="module">
121
+ import {LitElement, html, css} from 'https://unpkg.com/lit-element/lit-element.js?module';
122
+ import {SfIEvents} from 'https://unpkg.com/sf-i-events/sf-i-events.js?module';
123
+ </script>
124
+ <style>
125
+
126
+ body {
127
+ background-color: #efefef;
128
+ margin: 0px;
129
+ font-family: 'Source Sans Pro';
130
+ }
131
+
132
+ sf-i-events:not(:defined) {
133
+ display: none;
134
+ }
135
+
136
+ sf-i-events {
137
+ --nav-background-color: rgb(4, 135, 205);
138
+ --nav-color: #fff;
139
+ --notif-background-color: rgb(4, 135, 205);
140
+ --notif-color: #fff;
141
+ --menu-background-color: rgb(49, 161, 222);
142
+ --menu-color: #fff;
143
+ --footer-background-color: rgb(167, 147, 60);
144
+ --footer-color: #fff;
145
+ }
146
+
147
+ </style>
148
+ </head>
149
+ <body style="margin: 0px;">
150
+ <sf-i-events>
151
+ <!-- Set the brand name -->
152
+ <h2 slot="brandName"><a href="#home" >Superflows</a></h2>
153
+ <!-- Set the brand logo -->
154
+ <a slot="brandImage" href="#home" ><img alt="logo" src="https://superflows-images.s3.ap-south-1.amazonaws.com/superflows_white_transparent_200.png" /></a>
155
+ <!-- Set the main menu -->
156
+ <ul slot="mainMenu">
157
+ <li><a href="#about">About</a></li>
158
+ <li class="li-solutions">
159
+ <a href="javascript:void(0);" class="a-solutions">Solutions</a>
160
+ <ul>
161
+ <li><a href="#services">Services</a></li>
162
+ <li><a href="#products">Products</a></li>
163
+ </ul>
164
+ </li>
165
+ <li>
166
+ <a href="javascript:void(0);">Contact Us</a>
167
+ <ul>
168
+ <li><a href="https://instagram.com">Instagram</a></li>
169
+ <li><a href="https://facebook.com">Facebook</a></li>
170
+ <li><a href="https://youtube.com">YouTube</a></li>
171
+ </ul>
172
+ </li>
173
+ </ul>
174
+ <!-- Set the social media links -->
175
+ <ul slot="socialMedia">
176
+ <li><a href="https://facebook.com"><img src="https://superflows-images.s3.ap-south-1.amazonaws.com/facebook-black_round.png" /></a></li>
177
+ <li><a href="https://twitter.com"><img src="https://superflows-images.s3.ap-south-1.amazonaws.com/twitter_black_round.png" /></a></li>
178
+ <li><a href="https://youtube.com"><img src="https://superflows-images.s3.ap-south-1.amazonaws.com/youtube_black_round.png" /></a></li>
179
+ </ul>
180
+ <!-- Set the notifications -->
181
+ <ul slot="unreadNotifications">
182
+ <li><a href="#notification/1"><h3>Sonali Joshi</h3><p>mentioned you in a comment</p><div>1 day ago</div></a></li>
183
+ <li><a href="#notification/2"><h3>Rahim Ahmed</h3><p>reacted to your blog post</p><div>2 days ago</div></a></li>
184
+ <li><a href="#notification/3"><h3>John Bolton</h3><p>replied to a thread that you posted in</p><div>1 month ago</div></a></li>
185
+ </ul>
186
+ <ul slot="readNotifications">
187
+ <li><a href="#notification/4"><h3>Sonali Joshi</h3><p>mentioned you in a comment</p><div>1 day ago</div></a></li>
188
+ <li><a href="#notification/5"><h3>Rahim Ahmed</h3><p>reacted to your blog post</p><div>2 days ago</div></a></li>
189
+ <li><a href="#notification/6"><h3>John Bolton</h3><p>replied to a thread that you posted in</p><div>1 month ago</div></a></li>
190
+ </ul>
191
+ <a slot="notificationsList" href="#notifications">View All</a>
192
+ <!-- Set CTA -->
193
+ <a slot="cta" href="#login">Sign In</a>
194
+ <!-- Set copyright notice -->
195
+ <p slot="copyright">Copyright 2022 Superflows</p>
196
+ <!-- Profile picture -->
197
+ <img alt="profile" slot="profilePicture" src="https://preview.keenthemes.com/metronic-v4/theme/assets/pages/media/profile/profile_user.jpg" />
198
+ <!-- Set the profile menu -->
199
+ <ul slot="profileMenu">
200
+ <li><a href="#settings">My Profile</a></li>
201
+ <li>
202
+ <a href="javascript:void(0);">Settings</a>
203
+ <ul>
204
+ <li><a href="#settings_data">Data & Privacy</a></li>
205
+ <li><a href="#settings_notifications">Notifications</a></li>
206
+ </ul>
207
+ </li>
208
+ <li>
209
+ <a href="javascript:void(0);">Support</a>
210
+ <ul>
211
+ <li><a href="#ticket">Create Ticket</a></li>
212
+ <li><a href="#chat">Chat With Us</a></li>
213
+ </ul>
214
+ </li>
215
+ <li><a href="#signout">Sign Out</a></li>
216
+ </ul>
217
+ <!-- Page Content -->
218
+ <div slot="content"></div>
219
+ </sf-i-events>
220
+
221
+ <script>
222
+ var routeMap = [];
223
+ </script>
224
+ <script>
225
+ function getCurrentPathName() {
226
+ return window.location.hash.length === 0 ? '' : window.location.hash.split("/")[0].replace('#', '');
227
+ }
228
+ function getCurrentArgs() {
229
+ return routeMap[getCurrentPathName() + '.html'];
230
+ }
231
+ </script>
232
+ <script>
233
+ document.getElementsByTagName('sf-i-events')[0].addEventListener('searchClick', () => {console.log('hurray');})
234
+ document.getElementsByTagName('sf-i-events')[0].addEventListener('routeChange', (e) => {
235
+ routeMap[e.detail.pathName] = e.detail.args;
236
+ })
237
+ </script>
238
+ </body>
239
+ </html>
240
+
241
+ ```
242
+
243
+ <br />
244
+
245
+ ## Tutorial
246
+
247
+ <br />
248
+
249
+ ### Step 1 - Create an html page
250
+
251
+ Create an html page and add the following html content to it:
252
+
253
+ ```html
254
+
255
+ <!DOCTYPE html>
256
+
257
+ <html>
258
+ <head>
259
+ <meta charset="utf-8" />
260
+ <meta name="viewport" content="width=device-width, initial-scale=1">
261
+ <title>&lt;sf-i-events&gt; Demo</title>
262
+ <!-- Integration material icons as they are used in sf-i-events -->
263
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
264
+ <!-- Google fonts integration -->
265
+ <link rel="preconnect" href="https://fonts.googleapis.com">
266
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
267
+ <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@200;300;400;600&display=swap" rel="stylesheet">
268
+ <!-- Integration the web components module -->
269
+ <script src="https://unpkg.com/@webcomponents/webcomponentsjs@latest/webcomponents-loader.js"></script>
270
+ <!-- Integration lit and sf-i-events web components module -->
271
+ <script type="module">
272
+ import {LitElement, html, css} from 'https://unpkg.com/lit-element/lit-element.js?module';
273
+ import {SfIEvents} from 'https://unpkg.com/sf-i-events/sf-i-events.js?module';
274
+ </script>
275
+ <style>
276
+
277
+ body {
278
+ background-color: #efefef;
279
+ margin: 0px;
280
+ font-family: 'Source Sans Pro';
281
+ }
282
+
283
+ sf-i-events:not(:defined) {
284
+ display: none;
285
+ }
286
+
287
+ </style>
288
+ </head>
289
+ <body>
290
+ <!-- Add the component tag -->
291
+ <sf-i-events>
292
+ <!-- Set the brand name -->
293
+ <h2 slot="brandName"><a href="#home" >Superflows</a></h2>
294
+ </sf-i-events>
295
+ </body>
296
+ </html>
297
+
298
+ ```
299
+
300
+ A bare bones version of the navigation header and footer, which includes only the brand name will be rendered. This will be our starting point!
301
+
302
+ <br />
303
+
304
+ ### Step 2 - Setup Brand Info
305
+
306
+ Set the brand logo as show below. It will be rendered both in the header and the footer.
307
+
308
+ ```html
309
+
310
+ <sf-i-events>
311
+ <!-- Set the brand name -->
312
+ <h2 slot="brandName"><a href="#home" >Superflows</a></h2>
313
+ <!-- Set the brand logo -->
314
+ <a slot="brandImage" href="#home" ><img alt="logo" src="https://superflows-images.s3.ap-south-1.amazonaws.com/superflows_white_transparent_200.png" /></a>
315
+ </sf-i-events>
316
+
317
+ ```
318
+
319
+ <br />
320
+
321
+ ### Step 3 - Routing
322
+
323
+ Routing is enabled by default. Every hash link specified in the SfIEvents component needs to be backed by its separate html component. For example the links in the brand info section (above section), contains #home as the link. For routing to work, simply create a separate home.html component for it. SfIEvents will then automatically take care of routing.
324
+
325
+ ```html
326
+
327
+ <sf-i-events>
328
+ <!-- Page Content -->
329
+ <div slot="content">
330
+ </div>
331
+ </sf-i-events>
332
+
333
+ ```
334
+
335
+ For passing parameters to individual components, include the following javascript code. Individual components can then fetch their parameters from the associative array routeMap.
336
+
337
+ ```html
338
+ <script>
339
+ var routeMap = [];
340
+
341
+ function getCurrentPathName() {
342
+ return window.location.hash.length === 0 ? '' : window.location.hash.split("/")[0].replace('#', '');
343
+ }
344
+ function getCurrentArgs() {
345
+ return routeMap[getCurrentPathName() + '.html'];
346
+ }
347
+
348
+ document.getElementsByTagName('sf-i-events')[0].addEventListener('searchClick', () => {console.log('hurray');})
349
+ document.getElementsByTagName('sf-i-events')[0].addEventListener('routeChange', (e) => {
350
+ routeMap[e.detail.pathName] = e.detail.args;
351
+ })
352
+ </script>
353
+ ```
354
+
355
+ <br />
356
+
357
+ ### Step 4 - Setup Main Menu
358
+
359
+ You can compose your menu using unordered lists, as shown in the below example.
360
+
361
+ ```html
362
+
363
+ <sf-i-events>
364
+ <!-- Set the main menu -->
365
+ <ul slot="mainMenu">
366
+ <li><a href="#about">About</a></li>
367
+ <li class="li-solutions">
368
+ <a href="javascript:void(0);" class="a-solutions">Solutions</a>
369
+ <ul>
370
+ <li><a href="#services">Services</a></li>
371
+ <li><a href="#products">Products</a></li>
372
+ </ul>
373
+ </li>
374
+ <li>
375
+ <a href="javascript:void(0);">Contact Us</a>
376
+ <ul>
377
+ <li><a href="https://instagram.com">Instagram</a></li>
378
+ <li><a href="https://facebook.com">Facebook</a></li>
379
+ <li><a href="https://youtube.com">YouTube</a></li>
380
+ </ul>
381
+ </li>
382
+ </ul>
383
+ </sf-i-events>
384
+
385
+ ```
386
+
387
+ <br />
388
+
389
+ ### Step 5 - Setup Search
390
+
391
+ Search Input is shown by default and the SfIEvents component throws a searchClick event after the user types something in the search input field and presses enter. To handle the searchClick event:
392
+
393
+ ```html
394
+
395
+ <script>
396
+ document.getElementsByTagName('sf-i-events')[0].addEventListener('searchClick', () => {console.log('search clicked');})
397
+ </script>
398
+
399
+ ```
400
+
401
+ <br />
402
+
403
+ ### Step 6 - Setup Social Media Links
404
+
405
+ Social media links can be configured using unordered lists, and are shown in the footer. Set them up as follows:
406
+
407
+ ```html
408
+
409
+ <sf-i-events>
410
+ <!-- Set the social media links -->
411
+ <ul slot="socialMedia">
412
+ <li><a href="https://facebook.com"><img src="https://superflows-images.s3.ap-south-1.amazonaws.com/facebook-black_round.png" /></a></li>
413
+ <li><a href="https://twitter.com"><img src="https://superflows-images.s3.ap-south-1.amazonaws.com/twitter_black_round.png" /></a></li>
414
+ <li><a href="https://youtube.com"><img src="https://superflows-images.s3.ap-south-1.amazonaws.com/youtube_black_round.png" /></a></li>
415
+ </ul>
416
+ </sf-i-events>
417
+
418
+ ```
419
+
420
+ ### Step 7 - Setup Notifications
421
+
422
+ Notifications dropdown can be configured using unordered lists as shown in the example below. Notifications functionality has three parts - (1) Unread notifications, (2) Read Notifications, (3) Notifications List Link. All of them can be configured separately:
423
+
424
+ ```html
425
+
426
+ <sf-i-events>
427
+ <!-- Set the notifications -->
428
+ <ul slot="unreadNotifications">
429
+ <li><a href="#notification/1"><h3>Sonali Joshi</h3><p>mentioned you in a comment</p><div>1 day ago</div></a></li>
430
+ <li><a href="#notification/2"><h3>Rahim Ahmed</h3><p>reacted to your blog post</p><div>2 days ago</div></a></li>
431
+ <li><a href="#notification/3"><h3>John Bolton</h3><p>replied to a thread that you posted in</p><div>1 month ago</div></a></li>
432
+ </ul>
433
+ <ul slot="readNotifications">
434
+ <li><a href="#notification/4"><h3>Sonali Joshi</h3><p>mentioned you in a comment</p><div>1 day ago</div></a></li>
435
+ <li><a href="#notification/5"><h3>Rahim Ahmed</h3><p>reacted to your blog post</p><div>2 days ago</div></a></li>
436
+ <li><a href="#notification/6"><h3>John Bolton</h3><p>replied to a thread that you posted in</p><div>1 month ago</div></a></li>
437
+ </ul>
438
+ <a slot="notificationsList" href="#notifications">View All</button>
439
+ </sf-i-events>
440
+
441
+ ```
442
+
443
+ <br />
444
+
445
+ ### Step 8 - Setup Copyright notice
446
+
447
+ Copyright notice can be shown in the footer as follows:
448
+
449
+ ```html
450
+
451
+ <sf-i-events>
452
+ <p slot="copyright">Copyright 2022 Superflows</p>
453
+ <!-- other config -->
454
+ </sf-i-events>
455
+
456
+ ```
457
+
458
+ <br />
459
+
460
+ ### Step 9 - Setup Call To Action
461
+
462
+ You can add a call to action (CTA) button to the header as follows:
463
+
464
+ ```html
465
+
466
+ <sf-i-events>
467
+ <a slot="cta" href="#login">Sign In</a>
468
+ <!-- other config -->
469
+ </sf-i-events>
470
+
471
+ ```
472
+
473
+ <br />
474
+
475
+ ### Step 10 - Setup Profile Section
476
+
477
+ Profile section mainly contains two things - (1) Profile picture toggle, (2) Dropdown menu. You can configure both these as follows:
478
+
479
+ ```html
480
+
481
+ <sf-i-events>
482
+ <!-- Profile picture -->
483
+ <img alt="profile" slot="profilePicture" src="https://preview.keenthemes.com/metronic-v4/theme/assets/pages/media/profile/profile_user.jpg" />
484
+ <!-- Set the profile menu -->
485
+ <ul slot="profileMenu">
486
+ <li><a href="#settings">My Profile</a></li>
487
+ <li>
488
+ <a href="javascript:void(0);">Settings</a>
489
+ <ul>
490
+ <li><a href="#settings_data">Data & Privacy</a></li>
491
+ <li><a href="#settings_notifications">Notifications</a></li>
492
+ </ul>
493
+ </li>
494
+ <li>
495
+ <a href="javascript:void(0);">Support</a>
496
+ <ul>
497
+ <li><a href="#ticket">Create Ticket</a></li>
498
+ <li><a href="#chat">Chat With Us</a></li>
499
+ </ul>
500
+ </li>
501
+ <li><a href="#signout">Sign Out</a></li>
502
+ </ul>
503
+ <!-- other config -->
504
+ </sf-i-events>
505
+
506
+ ```
507
+
508
+ <br />
509
+
510
+ ### Step 11 - Customize The Appearance
511
+
512
+ Css custom properties can be used to customize the appearance as follows:
513
+
514
+ ```html
515
+
516
+ <head>
517
+ <style>
518
+
519
+
520
+ sf-i-events {
521
+ --nav-background-color: rgb(4, 135, 205);
522
+ --nav-color: #fff;
523
+ --notif-background-color: rgb(4, 135, 205);
524
+ --notif-color: #fff;
525
+ --menu-background-color: rgb(49, 161, 222);
526
+ --menu-color: #fff;
527
+ --footer-background-color: rgb(167, 147, 60);
528
+ --footer-color: #fff;
529
+ }
530
+
531
+ </style>
532
+ </head>
533
+
534
+ ```
535
+
536
+
537
+ ## Testing
538
+
539
+ Tests can be run with the `test` script.
540
+
541
+ ```bash
542
+ npm test
543
+ ```
544
+
545
+ - Chromium: |██████████████████████████████| 2/2 test files | 9 passed, 0 failed
546
+ - Firefox: |██████████████████████████████| 2/2 test files | 9 passed, 0 failed
547
+ - Webkit: |██████████████████████████████| 2/2 test files | 9 passed, 0 failed
548
+ - Code coverage: 98.63 % (Overall) 100% (Main flow)
549
+ - View full coverage report at coverage/lcov-report/index.html
550
+
551
+ <br />
552
+
553
+ ## Dev Server
554
+
555
+ To run the dev server and open the project in a new browser tab:
556
+
557
+ ```bash
558
+ npm run serve
559
+ ```
560
+
561
+ There is a development HTML file located at `/dev/index.html` that you can view at http://localhost:8000/dev/index.html. Note that this command will serve your code using Lit's development mode (with more verbose errors). To serve your code against Lit's production mode, use `npm run serve:prod`.
562
+
563
+ <br />
564
+
565
+ ## Documentation
566
+
567
+ [Read](https://superflows.dev/docs/navigation)
568
+
569
+ ## Demo Project
570
+
571
+ [View Demo](https://replit.com/@SuperflowsAppv3/Single-Page-Modular-App-Using-Pure-HTML-CSS-Javascript#index.html)
572
+
573
+ ## YouTube Channel
574
+
575
+ [View Channel](https://www.youtube.com/channel/UCYNJLCE48yir4DsquciBuDw)
576
+
577
+ ## Join The Community
578
+
579
+ [Join Now](https://discord.gg/ksEXS4P9h6)
580
+
581
+ ## Blog
582
+
583
+ [Read](https://blog.superflows.dev/)
584
+
585
+ ## License
586
+
587
+ MIT © [superflows-dev](https://github.com/superflows-dev)
588
+