All Projects → kristofferandreasen → React Announcement

kristofferandreasen / React Announcement

Licence: mit
📣 Push out beautiful website announcements in React 📣 An NPM package to quickly convey your message to visitors.

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to React Announcement

Django Sql Explorer
Easily share data across your company via SQL queries. From Grove Collab.
Stars: ✭ 1,958 (+1214.09%)
Mutual labels:  hacktoberfest
Custom Pod Autoscaler
Custom Pod Autoscaler base, allows creation of Custom Pod Autoscalers
Stars: ✭ 148 (-0.67%)
Mutual labels:  hacktoberfest
Cigar
💨 Smoke testing tool written in PHP
Stars: ✭ 148 (-0.67%)
Mutual labels:  hacktoberfest
Handwritten.js
Convert typed text to realistic handwriting!
Stars: ✭ 1,806 (+1112.08%)
Mutual labels:  hacktoberfest
Macos Defaults
Incomplete list of macOS `defaults` commands with demos ✨
Stars: ✭ 146 (-2.01%)
Mutual labels:  hacktoberfest
Sonar Bsl Plugin Community
Поддержка языка 1С:Предприятие 8 и OneScript для SonarQube.
Stars: ✭ 147 (-1.34%)
Mutual labels:  hacktoberfest
Librobotcontrol
Robotics Focused library for embedded Linux computers.
Stars: ✭ 146 (-2.01%)
Mutual labels:  hacktoberfest
Readme Scribe
A GitHub Action that automatically generates & updates markdown content (like your README.md)
Stars: ✭ 149 (+0%)
Mutual labels:  hacktoberfest
Znc
Official repository for the ZNC IRC bouncer
Stars: ✭ 1,851 (+1142.28%)
Mutual labels:  hacktoberfest
Niapy
Python microframework for building nature-inspired algorithms. Official docs: http://niapy.readthedocs.io/en/stable/
Stars: ✭ 148 (-0.67%)
Mutual labels:  hacktoberfest
Hacktoberfest2020
Make your first PR! ~ A beginner-friendly repository. Add your profile, a blog, or any program under any language (it can be anything from a hello-world program to a complex data structure algorithm) or update the existing one. Just make sure to add the file under the correct directory. Happy hacking!
Stars: ✭ 147 (-1.34%)
Mutual labels:  hacktoberfest
Documentation
The source for Datadog's documentation site.
Stars: ✭ 147 (-1.34%)
Mutual labels:  hacktoberfest
Hacktoberfest Swag
Looking for hacktoberfest swag? You've come to the right place.
Stars: ✭ 148 (-0.67%)
Mutual labels:  hacktoberfest
Parse Sdk Android
The Android SDK for the Parse Platform
Stars: ✭ 1,806 (+1112.08%)
Mutual labels:  hacktoberfest
Prism.plugin.popups
This provides extensibility for Prism.Forms INavigationService to handle Popup Views
Stars: ✭ 149 (+0%)
Mutual labels:  hacktoberfest
Rom Rails
Rails integration for Ruby Object Mapper
Stars: ✭ 146 (-2.01%)
Mutual labels:  hacktoberfest
Rioxarray
geospatial xarray extension powered by rasterio
Stars: ✭ 148 (-0.67%)
Mutual labels:  hacktoberfest
Has Parameters
A trait that allows you to pass arguments to Laravel middleware in a more PHP'ish way.
Stars: ✭ 149 (+0%)
Mutual labels:  hacktoberfest
Djangocms Installer
Console wizard to bootstrap django CMS projects
Stars: ✭ 148 (-0.67%)
Mutual labels:  hacktoberfest
Astarte
Core Astarte Repository
Stars: ✭ 148 (-0.67%)
Mutual labels:  hacktoberfest

react-announcement

📣 Push out beautiful website announcements in React 📣
This simple and modern component makes it easier for you to engage with your visitors in a non-intrusive way. The component is fully responsive and will render perfectly on desktop, tablets and mobile.

A small component to help you convert. Built with ❤︎ by Kristoffer Andreasen

example video

Install

npm install --save react-announcement

Usage

import * as React from 'react'
import Logo from './logo.svg'
import Announcement from 'react-announcement'

class Example extends React.Component {
  render () {
    return (
      <Announcement
          title="Here is your component"
          subtitle="The best announcement component for React is finally here. Install it in all your projects."
          link="https://github.com/kristofferandreasen/react-announcement"
          imageSource={Logo}
      />
    )
  }
}

Usage with optional properties

This example includes the optional properties in the component.

The daysToLive property changes to the cookie created by the component. This way you can control how many days you want to wait before you show the announcement to the same user.

The secondsBeforeBannerShows property changes the number of seconds a user waits before the announcement is presented.

The closeIconSize is to allow you to change to size of the icon in the top right corner.

The animateInDuration changes the duration of the fade-in animation.

The animateOutDuration changes the duration of the fade-out animation - this is fired on the click of the close icon.

import * as React from 'react'
import Logo from './logo.svg'
import Announcement from 'react-announcement'

class Example extends React.Component {
  render () {
    return (
      <Announcement
        title="Here is your component"
        subtitle="The best announcement component for React is finally here. Install it in all your projects."
        link="https://github.com/kristofferandreasen/react-announcement"
        imageSource={Logo}
        daysToLive={3}
        secondsBeforeBannerShows={20}
        closeIconSize={30}
        animateInDuration={2000}
        animateOutDuration={500}
      />
    )
  }
}

Properties

Property Type Required Default value Description
title string yes The title of the announcement
subtitle string yes The general card text on the announcement
imageSource string yes The image source string used on the left side of the image. Use a square image for the best results. Dimensions are 68x68 pixels.
link string yes The link used when the announcement is clicked.
daysToLive number no 7 An optional property specifying the number of days the cookie will live before the announcement is shown again to a user.
secondsBeforeBannerShows number no 5 The number of seconds a user has to keep the page open before the announcement is shown.
animateInDuration number no 1000 Changes the duration of the fade-in animation.
animateOutDuration number no 30 Change the duration of the fade-out animation.

Responsive

The announcement is shown on the left side of the screen on desktop and centered at the bottom on mobile.

mobile gif

Developing

The project is bootstrapped with create-react-library and TypeScript has been added to the project. You can read more about the development workflow in the project docs.

To start developing, you need to open two terminals.

In the first tab, run from the main directory:

npm start

This will activate rollup to watch for any changes to your src directory and build the dist everytime.

In another terminal, navigate to the example folder:

cd example

Then run:

npm install

and finally:

npm start

This will start up the development server allowing you to see the results. Be aware that the solution is setting a cookie and this cookie will be stored in your browser. In order to see the banner again, you will need to open the localhost link in incognito or clear your browser cookies.

Contributing

Your contributions are always welcome! Please have a look at the contribution guidelines first 🎉

License

MIT © kristofferandreasen

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].