From b63fdf4109ee5e3b8119c110491d0a9962a56187 Mon Sep 17 00:00:00 2001 From: ReeceM Date: Fri, 13 Mar 2020 23:48:11 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8v1=20release=20notes=20and=20docs=20?= =?UTF-8?q?=F0=9F=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 8 ++++++++ README.md | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97aa382..c7d34b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to `h-bar` will be documented in this file. +# 1.0.0 - 2020-03-13 + +First initial major version of h-bar :) + +This has kinda the base features for the first version. + +See previous versions for the features to this point. + # 0.3.0 - 2020-03-13 ***FEATURE*** diff --git a/README.md b/README.md index 873a8cb..75b8eb9 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,8 @@ The initialization object currently has this structure and defaults: } ], parser: (data) => {/** Parser function */} + dismissible: false, // dismissible banner flag + dismissFor: new Date('2020-03-30'), // would dismiss it till end of march 30th options: { theme: "gray", secondaryLinks: [], @@ -162,6 +164,42 @@ hBar.init({ }) ``` +### Dismissing Notifications + +> Available from `v0.3.0`/`v1.0.0` + +**Temporary Dismissing** +To be able to dismiss a notification, please note it currently removes secondary links. It is therefore useful that you use this feature when just making announcements of a event or brief notification. + +The way to activate session based dismissal is: + +```javascript +{ + //... rest of config + dismissible: true, + //... rest of config +} +``` + +This will just disable the banner for the current page visit, if the user reloads, its back. + +**Time based dismissing** + +To dismiss the banner until another time, you can set the `dismissFor` variable, this requires a `Date()` object. + +When you set this and the banner is dismissed, the UTC milliseconds are stored in the localStorage, this is then read back when loading h-Bar. + +```javascript +{ + //... rest of config + dismissible: true, + dismissFor: new Date('2020-03-30'), // would dismiss it till end of march 30th +} +``` + +If you fail to set the value properly, it won't dismiss and the banner will show by default. + + ### Testing _to come_ please make a PR if you know how to do it on JS.