@paqtcom/recycleclub-calculator
v1.3.2
Published
A Web Component to check what your empty cartridges are worth
Downloads
7
Readme
RecycleClub Calculator
A Web Component to check what your empty cartridges are worth. The RecycleClub Calculator can be implemented and used across any JavaScript framework or no framework at all. We accomplish this by using standardized web platform APIs and Web Components.
Browser Support
We only support the latest modern browsers: https://browserslist.dev/?q=ZGVmYXVsdHMsIG5vdCBpZSAxMQ%3D%3D
npx browserslist "defaults, not ie 11"
Using this component
<html>
<head>
<script
type="module"
src="https://cdn.jsdelivr.net/npm/@paqtcom/recycleclub-calculator@1/dist/recycleclub-calculator/recycleclub-calculator.esm.js"
></script>
</head>
<body>
<recycleclub-calculator></recycleclub-calculator>
</body>
</html>
We recommend to display it on a background with the color #EDF3F8
.
An example of this setup: https://codesandbox.io/s/recycleclub-calculator-usage-vpee94
Charities
If you're a charity using the calculator you need to set the charity-code
attribute to the code you will receive from RecycleClub. This way, the compensation for all the cartridges submitted with your calculator will go to you.
<html>
<head>
<script
type="module"
src="https://cdn.jsdelivr.net/npm/@paqtcom/recycleclub-calculator@1/dist/recycleclub-calculator/recycleclub-calculator.esm.js"
></script>
</head>
<body>
<recycleclub-calculator charity-code="enter-your-charity-code-here"></recycleclub-calculator>
</body>
</html>
i18n
We support the following languages: en
, de
, fr
, and nl
.
The language will be automatically based on the document language specified in the html tag (<html lang="en">
) or otherwise the browser language of the user.
Customization
You can optionally set one of these CSS custom properties ("CSS variables") in a :root
block of your css, to change the typography.
:root {
--recycleclub-calculator-font-family: sans-serif;
--recycleclub-calculator-font-size: 1.1em;
--recycleclub-calculator-heading-font-family: serif;
--recycleclub-calculator-button-font-family: serif;
}
It inherits the font-family and font-size from the parent, so you probably only need to set the --recycleclub-calculator-heading-font-family
& --recycleclub-calculator-button-font-family
if you want to use a different font for the headings and/or button. For example to use a custom font you've already loaded.
Development
Make sure you are using node v16 (with npm v8). If you use nvm
, you can run nvm use
.
To start building the components using Stencil, clone this repo to a new directory:
git clone https://github.com/paqtcom/recycleclub-calculator.git recycleclub-calculator
cd recycleclub-calculator
Change the api-endpoint
, redirect-hostname
& redirect-path
attributes in /src/index.html
if needed.
and run:
npm install
npm start
To build the component for production, run:
npm run build
To run the unit tests for the components, run:
npm test
To publish a new version on npm, run:
# if not yet logged in
npm login
npm publish
Need help? Check out the docs here.
Automated tests
Run this command to test the component and it's sub components:
npm run test
Or run this command in the root to test the core components and all the framework wrappers.
Release a new version
To create a new npm release, you have to be a member of the paqtcom
organization and be logged in to npm in your local terminal (npm login
).
Switch to the master
branch.
Update the version in the package.json
(and package-lock.json
) and push this.
Go to the root of the repo in your terminal.
Run these commands:
npm run install
npm run build
If successful, you can then publish this package to npm:
npm publish
Attribution
Ionicons
We used some SVG's from Ionicons.
The MIT License (MIT)
Copyright (c) 2015-present Ionic (http://ionic.io/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.