1.2.0 • Published 3 years ago

@vrom-dev/custom-calendar v1.2.0

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
3 years ago

\

This webcomponent follows the open-wc recommendation.

Installation

npm i @vrom-dev/custom-calendar

Props

PropertyOptionalTypeDescription
localeYesStringSpecifies the language for the calendar. It accepts all locales from Intl.DateTimeFormat API
eventsYesObjectObject with dates as keys and an array of events for each key. See usage section for an example

Styling

It is possible to style the component overriding the following custom properties:

custom-calendar {
  --cal-bg-color; /* Calendar background color */
  --cal-text-color-days; /* Calendar days text color */
  --cal-text-color-heading; /* Calendar weedays, month and year text color */
  --cal-data-hint-bg; /* Data hint background color */
  --cal-data-hint-text; /* Data hint text color */
  --cal-event; /* Event day background color */
  --cal-event-hover; /* Event day background color on hover */
}

Usage

<script type="module">
  import { html, render } from 'lit';
  import '../custom-calendar.js';

  const events = {
    '20/5/2022': ['Star Wars Obi-Wan Kenobi', 'We rule this city'],
    '27/5/2022': ['Red', 'El sastre de la mafia'],
  };
  render(
    html`<custom-calendar locale="es-ES" .events=${events}></custom-calendar>`
  );
</script>

Linting and formatting

To scan the project for linting and formatting errors, run

npm run lint

To automatically fix linting and formatting errors, run

npm run format

Testing with Web Test Runner

To execute a single test run:

npm run test

To run the tests in interactive watch mode run:

npm run test:watch

Demoing with Storybook

To run a local instance of Storybook for your component, run

npm run storybook

To build a production version of Storybook, run

npm run storybook:build

Tooling configs

For most of the tools, the configuration is in the package.json to minimize the amount of files in your project.

If you customize the configuration a lot, you can consider moving them to individual files.

Local Demo with web-dev-server

npm start

To run a local development server that serves the basic demo located in demo/index.html

1.2.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago