@afex-dapps/cookie
v1.0.0
Published
cookie
Downloads
70
Readme
@afex-dapps/cookies
@afex-dapps/cookies is a lightweight utility library designed to simplify the implementation of common components in our application.
Exports
The library exports a CookieBanner
component that helps you manage cookie consent for your users, utilizing configuration options inspired by vanilla-cookieconsent
.
Installation
To install @afex-dapps/cookies, run the following command:
npm i afex-utils
Usage
Importing the Component
You can import the CookieBanner component from afex-utils into your main application file, such as App.tsx or main.tsx.
import React from 'react';
import { CookieBanner } from 'afex-utils';
{/* Example Configuration */}
const configuration= {
categories: {
necessary: {
enabled: true, // this category is enabled by default
readOnly: true // this category cannot be disabled
},
analytics: {}
},
language: {
default: 'en',
rtl: 'ar',
autoDetect: 'browser',
translations: {
en: '/assets/translations/en.json',
ar: '/assets/translations/ar.json'
}
}
}
function App() {
return (
<div>
<CookieBanner configuration={configuration} />
{/* Other components in your app */}
</div>
);
}
export default App;
Contributing
If you'd like to contribute to @afex-dapps/cookies, please fork the repository and submit a pull request. We welcome all contributions!
License
@afex-dapps/cookies is released under the MIT License.