Neonatal Penguin March

    This package has been deprecated

    Author message:

    Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

    coffeekraken-s-countdown-component

    1.0.2 • Public • Published

    Coffeekraken s-countdown-component

    Create a simple fully customizable countdown that support years, months, days, hours, minutes and seconds display

    View demo

    Table of content

    1. Demo
    2. Install
    3. Get Started
    4. Digit
    5. Active class
    6. Step classes
    7. Javascript API
    8. Sugar Web Components Documentation
    9. Browsers support
    10. Code linting
    11. Contribute
    12. Who are Coffeekraken?
    13. Licence

    Install

    npm install coffeekraken-s-countdown-component --save
    

    Get Started

    First, import the component into your javascript file like so:

    import SCountdownComponent from 'coffeekraken-s-countdown-component'

    Then simply use it inside your html like so:

    <s-countdown end-timestamp="2999999999">
      <span s-countdown-years></span> Years
      <span s-countdown-months></span> Months
      <span s-countdown-days></span> Days
      <span s-countdown-hours></span> Hours
      <span s-countdown-minutes></span> Minutes
      <span s-countdown-seconds></span> Seconds
    </s-countdown>

    Digit

    Each countdown elements like [s-countdown-years], [s-countdown-hours], etc... will contain his remaining digit. This digit will be wrapped inside a span that will have these classes:

    • .s-countdown-digit-container: Applied on the parent element
    • .s-countdown-digit: The main class applied during the whole life of the digit.
    • .s-countdown-digit--out: The class applied on the digit that need to get out.

    Note that the new digit will be added when the previous one has finished his out animation/transition.

    Active class

    An active class will be applied on the element itself during the countdown and removed at the end. This is useful if you want to hide the countdown when it's finished.

    • .active: Applied on the component itself during the countdown

    Step classes

    Step classes are an interesting concept. There are classes applied depending on the number of seconds remaining in the countdown. By default, these are the step classes registered:

    stepClasses: {
      week1: 3600 * 24 * 7,
      day1: 3600 * 24,
      hour1: 3600,
      minutes30: 60 * 30,
      minutes10: 60 * 10,
      minutes5: 60 * 5,
      minute1: 60
    },

    Thie mean that the these classes will be applied on the countdown:

    • .week1: Applied when the countdown is less than 1 week left
    • .day1: Applied when the countdown is less than 1 day left
    • .hour1: Applied when the countdown is less than 1 hour left
    • .minutes30: Applied when the countdown is less than 30 minutes left
    • .minutes10: Applied when the countdown is less than 10 minutes left
    • .minutes5: Applied when the countdown is less than 5 minutes left
    • .minute1: Applied when the countdown is less than 1 minute left

    You can as well configure that by setting the props.stepClasses property

    Browsers support

    IE / Edge
    IE / Edge
    Firefox
    Firefox
    Chrome
    Chrome
    Safari
    Safari
    IE11+ last 2 versions last 2 versions last 2 versions

    As browsers are automatically updated, we will keep as reference the last two versions of each but this component can work on older ones as well.

    The webcomponent API (custom elements, shadowDOM, etc...) is not supported in some older browsers like IE10, etc... In order to make them work, you will need to integrate the corresponding polyfill.

    Code linting

    This package uses some code linting rules. Here's the list:

    1. StandardJS for javascript files
    2. Stylelint with stylelint-config-standard for scss files

    Your commits will not been accepted if the code style is not respected!

    Contribute

    This is an open source project and will ever be! You are more that welcomed to contribute to his development and make it more awesome every day. To do so, you have several possibilities:

    1. Share the love ❤️
    2. Declare issues
    3. Fix issues
    4. Add features
    5. Build web component

    Who are Coffeekraken

    We try to be some cool guys that build some cool tools to make our (and yours hopefully) every day life better.

    More on who we are

    License

    The code is available under the MIT license. This mean that you can use, modify, or do whatever you want with it. This mean also that it is shipped to you for free, so don't be a hater and if you find some issues, etc... feel free to contribute instead of sharing your frustrations on social networks like an asshole...

    Install

    npm i coffeekraken-s-countdown-component

    DownloadsWeekly Downloads

    0

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    1.06 MB

    Total Files

    29

    Last publish

    Collaborators

    • olivierbossel