GithubHelp home page GithubHelp logo

minimalist-navigation-bar's Introduction

Minimalist Navigation Bar

Description

This is a minimalistic navigation bar that is generated using data from a JSON file. The navigation bar has a sliding bar that indicates a selected item, and that bar resizes itself to match the width of the selected item text.

Specifications

  • On resize, the sliding indicator bar updates its position and size to match the text
  • Code is optimized for Safari, support for other browsers are included (Chrome & Firefox)
  • No library usage, only ES6 and CSS
  • Displays time of the current city

Considerations

My idea going into this navigation cmoponent is to make it accessible for inclusivity. With this in mind, we can use the aria-selected attribute for a multitude of features including animations, styles and much more.

By using aria-selected, we don't have add/remove classes on buttons, we can use this attribute to determine which button is active and simply update its value when needed. This value is used to determine the active state of a button in the navigation bar and is used for animations.

Animations are done using transforms rather than absolutely positioned elements as the DOM will NOT be re-drawn.

The hover media query allows us to detect the user's primary input mechanism can hover over elements. It can have two values: none detects when the primary input mechanism can't hover or can't conveniently hover, like most cellphones and tablets.

For the purpose of this exercise only, I have decided to pull timezones codes from navigation.json. It might be a good idea to fetch timezone codes using Google Maps API for exmaple, where you could search for a specific city (eg. https://maps.googleapis.com/maps/api/geocode/json?&address=location and get timezone given lat,long)

How to Run

npm install

npm run start

package.json is configured to run the server on localhost:8080 & the default addresses used by http-server

Notes

  • Not optimized for mobile

minimalist-navigation-bar's People

Contributors

chanroyc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.