From 6db08fa3cea714d132ff8a9c362bf06fb9bf7148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Litera?= Date: Fri, 15 Oct 2021 12:36:14 +0200 Subject: [PATCH] Docs: Documentation of usage and configuration --- README.md | 101 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 92 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8a1ee1a2..92c27475 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,66 @@ Provide configurable cookie consent banner with predefined LMC defaults. The UI The package is a wrapper around [Cookie Consent] by [Orest Bida]. -## Install +## Usage + +1. Download (or use via [cdn](#download--cdn)) and include the script at the bottom of `body` tag. + + ```html + + ``` + +2. Run the plugin with your configuration parameters. +
+
Show basic example + + ```html + + + ``` + + +
+
+ + For more details check out original [cookie consent] library. + +### Zero configuration setup + +Download (or use via [cdn](#download--cdn)) and include the script at the bottom of `body` tag. + +```html + +``` + +Will display cookie consent with default configuration. + +### Download & CDN + +You can download the [latest version](https://github.com/lmc-eu/cookie-consent-manager/releases) or use it via cdn: + +javascript : + +```html +https://cdn.jsdelivr.net/npm/lmc-eu/cookie-consent-manager@v0.1.0/init.js +``` + +stylesheet : + +```html +https://cdn.jsdelivr.net/npm/lmc-eu/cookie-consent-managert@v0.1.0/LmcCookieConsentManager.css +``` + +### npm ```shell yarn add @lmc-eu/cookie-consent-manager @@ -16,16 +75,40 @@ or npm install --save @lmc-eu/cookie-consent-manager ``` -TODO +```js +import LmcCookieConsentManager from '@lmc-eu/cookie-consent-manager'; -## Usage +LmcCookieConsentManager({ + currentLang: 'cs', + themeCss: './dist/LmcCookieConsentManager.css', + config: { + // override default config + }, +}); +``` + +```scss +@use '../node_modules/@lmc-eu/cookie-consent-manager/LmcCookieConsentManager'; + +:root { + // override default config +} +``` + +## Configuration + +You can initialize cookie consent manager with following parameters: -TODO +| Option | Type | Default | Description | +| ------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `currentLang` | string | 'cs' | Specify one of the languages you have defined (can also be dynamic): 'en', 'cs' ... | +| `themeCss` | string | '' | Specify path to the .css file | +| `config` | Object | {} | Override default config. For all parameters consult [original library](https://github.com/orestbida/cookieconsent/blob/master/Readme.md#all-available-options). | -## Changelog +## License -TODO +Distributed under the MIT License. See [LICENSE](https://github.com/lmc-eu/cookie-consent-manager/blob/main/LICENSE.md) for more information. -- [spirit design system]: https://github.com/lmc-eu/spirit-design-system -- [cookie consent]: https://github.com/orestbida/cookieconsent -- [orest bida]: https://github.com/orestbida +[spirit design system]: https://github.com/lmc-eu/spirit-design-system +[cookie consent]: https://github.com/orestbida/cookieconsent +[orest bida]: https://github.com/orestbida