2.2.2 • Published 4 years ago

flex-banner v2.2.2

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

NPM JavaScript Style Guide Build Status

Install

npm install --save flex-banner

or

yarn add flex-banner

Usage

import * as React from "react";

import FlexBanner from "flex-banner";

class Example extends React.Component {
  render() {
    return (
      <FlexBanner
        title="Fully responsive react banner for websites"
        ctaLink="https://github.com/IsAmrish/flex-banner"
        ctaTitle="Learn More"
        isCenter={true}
      />
    );
  }
}

Usage with Optional Properties

This example includes optional property in the component:

ctaTitle - Title of Call To Action (CTA).

isCenter - To make banner title and link center aligned.

crossIconSize - To define, font size of cross Icons.

animationTime - To define, sliding { SlideDown and SlideUp } time of banner.

delayToShowBanner - Delay in showing up banner.

daysToLive - No of days cookie will live before banner is shown up.

wrapperStyle - style object for styling of the wrapper

mainStyleTitle - style object for styling of the title of banner. If ctaTitle property is not defined, then this will defined the styling of link.

mainStyleLink - style object for styling of the CTA of banner.

crossStyle - style object for styling of the crossIcon. The font size of cross icon can only be defined by crossIconSize property.

hidePermanentlyOnDate - To hide banner permanently on a specific date / datetime

Properties

PropertyTypeRequiredDefault valueDescription
titlestringyesthe title of the banner
ctaLinkstringyesurl for the call to action
ctaTitlestringnoThe title for call to action. It is not required if you want to use title as title of call to action
isCenterbooleannotrueMake center aligned the banner with value true otherwise left aligned using value false
crossIconSizenumberno22size of crossIcon in px. Set its value to 0 if you don't want to add crossIcon.
animationTimenumberno1animationTime is in seconds. It's sliding time for banner. For no animation, set value to 0.
delayToShowBannernumberno2delayToShowBanner is in seconds. It's the time a user has to keep the page open before the banner is shown. For no delay, set value to 0
daysToLivenumberno0A property specifying the number of days the cookie will live before the banner is shown again to a user. The default is 0, it means that banner will show up every time user refresh the page or hit the page url.
wrapperStyleobjectnostyle object for styling of the wrapper
mainStyleTitleobjectnostyle object for styling of title
mainStyleLinkobjectnostyle object for styling of Call To Action link
crossStyleobjectnostyle object for styling cross Icon - such as color etc. Note - font size property will be set only by crossIconSize property.

| hidePermanentlyOnDate | Date | no | | To hide banner permanently on a specific date / datetime property. |

Example with CTA title

import * as React from "react";

import FlexBanner from "flex-banner";

class Example extends React.Component {
  render() {
    return (
      <FlexBanner
        title="Fully responsive react banner for websites"
        ctaLink="https://github.com/IsAmrish/flex-banner"
        ctaTitle="Learn More"
        isCenter={false}
        crossIconSize={24}
        animationTime={1.5}
        delayToShowBanner={0}
        daysToLive={5}
        wrapperStyle={{ backgroundColor: "lightblue" }}
        mainStyleTitle={{ color: "black" }}
        mainStyleLink={{ color: "red" }}
        crossStyle={{ color: "red" }}
      />
    );
  }
}

Results

Example without CTA title

import * as React from "react";

import FlexBanner from "flex-banner";

class Example extends React.Component {
  render() {
    return (
      <FlexBanner
        title="Fully responsive react banner for websites"
        ctaLink="https://github.com/IsAmrish/flex-banner"
        isCenter={false}
        crossIconSize={24}
        animationTime={1.5}
        delayToShowBanner={0}
        daysToLive={5}
        wrapperStyle={{ backgroundColor: "lightblue" }}
        mainStyleTitle={{ color: "green" }}
        mainStyleLink={{ color: "blue" }} // this will not work
        crossStyle={{ color: "red" }}
      />
    );
  }
}

Results


Responsive View of FlexBanner

The banner will be shown top regardless of screen.

License

MIT © isamrish

2.2.1

4 years ago

2.2.0

4 years ago

2.2.2

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

1.0.1

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.0.0

4 years ago