Superflows Navigation Component
npm install sf-nav
html
<sf-nav> Demo
Superflows
Sonali Joshi
mentioned you in a comment
1 day ago
Rahim Ahmed
reacted to your blog post
2 days ago
John Bolton
replied to a thread that you posted in
1 month ago
Sonali Joshi
mentioned you in a comment
1 day ago
Rahim Ahmed
reacted to your blog post
2 days ago
John Bolton
replied to a thread that you posted in
1 month ago
View All
Sign In
Copyright 2022 Superflows
`
Tutorial
$3
Create an html page and add the following html content to it:
`html
<sf-nav> Demo
Superflows
`
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!
$3
Set the brand logo as show below. It will be rendered both in the header and the footer.
`html
Superflows
`
$3
Routing is enabled by default. Every hash link specified in the SfNav 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. SfNav will then automatically take care of routing.
`html
`
For passing parameters to individual components, include the following javascript code. Individual components can then fetch their parameters from the associative array routeMap.
`html
`
$3
You can compose your menu using unordered lists, as shown in the below example.
`html
`
$3
Search Input is shown by default and the SfNav component throws a searchClick event after the user types something in the search input field and presses enter. To handle the searchClick event:
`html
`
$3
Social media links can be configured using unordered lists, and are shown in the footer. Set them up as follows:
`html
`
$3
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:
`html
Sonali Joshi
mentioned you in a comment
1 day ago
Rahim Ahmed
reacted to your blog post
2 days ago
John Bolton
replied to a thread that you posted in
1 month ago
Sonali Joshi
mentioned you in a comment
1 day ago
Rahim Ahmed
reacted to your blog post
2 days ago
John Bolton
replied to a thread that you posted in
1 month ago
View All
`
$3
Copyright notice can be shown in the footer as follows:
`html
Copyright 2022 Superflows
`
$3
You can add a call to action (CTA) button to the header as follows:
`html
Sign In
`
$3
Profile section mainly contains two things - (1) Profile picture toggle, (2) Dropdown menu. You can configure both these as follows:
`html
`
$3
Css custom properties can be used to customize the appearance as follows:
`html
`
Testing
Tests can be run with the test script.
`bash
npm test
`
- Chromium: |██████████████████████████████| 2/2 test files | 9 passed, 0 failed
- Firefox: |██████████████████████████████| 2/2 test files | 9 passed, 0 failed
- Webkit: |██████████████████████████████| 2/2 test files | 9 passed, 0 failed
- Code coverage: 98.63 % (Overall) 100% (Main flow)
- View full coverage report at coverage/lcov-report/index.html
Dev Server
To run the dev server and open the project in a new browser tab:
`bash
npm run serve
`
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`.