1.3.1 • Published 4 years ago

@mjoellnier/dot-menu v1.3.1

Weekly downloads
8
License
MIT
Repository
github
Last release
4 years ago

Dot-menu

This is a ReactJS plugin to create a Dot-menu for your pages. It is highly customizable and tries to expose as many options as possible.

It is still under construction (besides the fact that this is my very first npm plugin). So PRs and feedback are highly welcomed!

What is this all about?

Dot Menu example gif

This plugin creates the menu on the left side (optionally also on the right side). The pages content you create will be window filling (100vw width and 100vh heigth).

Installation

npm install @mjoellnier/dot-menu --save

Example Usage

import DotMenu, { DotMenuPage } from "@mjoellnier/dot-menu";
import React from "react";
import testImage from "./testImage.jpg";

const App = () => {
  return (
    <DotMenu>
      <DotMenuPage backgroundColor={"RANDOM"} title={"Page 1"}>
        Hello 1
      </DotMenuPage>
      <DotMenuPage backgroundColor={"RANDOM"} title={"Page 2"}>
        Hello 2
      </DotMenuPage>
      <DotMenuPage backgroundColor={"RANDOM"} title={"Page 3"}>
        Hello 3
      </DotMenuPage>
      <DotMenuPage backgroundImage={testImage} title={"Page 4"}>
        Hello 4
      </DotMenuPage>
    </DotMenu>
  );
};

export default App;

Properties

DotMenu properties

NameValuesDefaultDescription
dotFillingstringdarkgrayDetermines the color of the nav dots filling. Give it a normal HEX/color string
dotBorderstringgrayDetermines the color of the nav dots border. Give it a normal HEX/color string
hideDotstrue|falsefalseDetermines if the nav dots are hidden
hidePathtrue|falsefalseDetermines if the progress path is hidden
pathColorstringblackDetermines the color of the propress path. Give it a normal HEX/color string
pathWidthstring"2"Determines the width of the progress path. Give it an integer wrapped as string
righttrue|falsefalseDetermines if the menu is rendered on the right or left
showMenuOnSmallScreenstrue|falsefalseDetermines if the menu is shown on small displays
windowScrollingtrue|falsefalseDetermines if the DotMenuPage elements are scrolled as a hole

DotMenuPage properties

NameValuesDefaultDescription
backgroundColorstring | "RANDOM"noneThe page background color. Give it a normal HEX/color string or the string RANDOM when you love surprises!
backgroundImagestring | "RANDOM"noneThe background image for the page. It is rendered fullscreen and resizes with the window/screen size. Use RANDOM to get a surprise image from Unsplash. Check the code example above to see how to add a local image.
styleObjectnoneA styling object that is handed through to the page element. With it you can override every styling item!
titlestringnoneThe title to be rendered in the mouse over box

Changelog

VersionChanges
1.0.0Initial Release
1.0.1Adding smooth scrolling to page on nav dot click
1.1.0Adding DotMenuPage element scrolling and more properties
1.2.0Adding background image and styling feature to pages
1.2.1Code cleaning and smaller fixes
1.3.0Dot Menu is hidden on small screens (can be shown via property)

Todo

  • Write tests!
  • Improve performance for scrolling!
  • Hide menu dots (smoothly) on mobile
  • Implement scrolling when pressing on a nav dot
  • Experiment with mobile
  • Publish example project