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-5080n
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
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:
npm login
npm publish
Need help? Check out the docs here.
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.