Gathering detailed insights and metrics for cardon
Gathering detailed insights and metrics for cardon
Gathering detailed insights and metrics for cardon
Gathering detailed insights and metrics for cardon
@cardonexinc/freelens-argo-rollouts-extension
Argo Rollouts extension for Freelens
payment-gateway-crypto
A payment gateway for reciving payments on zkEVM: Cardona testnet and Base Sepolia Testnet
uswap_sdk_v2_polygonzkevm_cardona
🛠 An v2 SDK for building applications on top of Uniswap. which also supports polygonzkevm_cardona testnet
Create reusable React cards, pop-ups or modals with asynchronous functionality
npm install cardon
Typescript
Module System
Node Version
NPM Version
JavaScript (86.49%)
TypeScript (10.28%)
HTML (2.1%)
CSS (1.13%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
7 Stars
9 Commits
2 Forks
1 Watchers
1 Branches
1 Contributors
Updated on May 30, 2023
Latest Version
1.0.3
Package Id
cardon@1.0.3
Unpacked Size
27.13 kB
Size
7.14 kB
File Count
18
NPM Version
8.19.2
Node Version
16.18.1
Published on
May 30, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
5
Cardon is a tool that allows you to create reusable cards that can be used as asynchronous functions on any screen.
You can check out a live demo of Cardon on CodeSandbox.
To use Cardon in your project, install it as a dependency using either Yarn or NPM.
1# Yarn 2$ yarn add cardon 3 4# NPM 5$ npm install cardon
Cardon provides two primary methods, 'CardonContainer'
and 'withCardon'
, for usage.
Component Name | Description |
---|---|
CardonContainer | It creates an instance for the cards. All cards are displayed within this container. |
withCardon | This method wraps the component you want to display as a card, injects properties named 'visible' and 'get' into it, and then returns an interface for usage. |
withCardon
Injected propswithCardon
adds several props to the component it wraps.
Name | Type | Description |
---|---|---|
visible | boolean | This property controls the visibility of the card. It toggles based on the invocation of the 'show' or 'hide' function. |
get | WithCardonGet | This is a callback generator function. Callbacks must be created using the 'get' function to return the desired callback value. To ensure the correct functioning of the cards, only callbacks generated via 'get' should be used. |
withCardon
OptionswithCardon
also accepts an options object as a second parameter.
Name | Type | Default Value | Description |
---|---|---|---|
destroyOnHide | boolean | false | If set to true, the component will be destroyed when hidden. If left unchanged, the component will remain on the root and must be manually hidden using the 'visible' property. |
key | string (optional) | - | A unique identifier for the card. This key can be used to control the visibility of a specific card using the Cardon.hide(key) method. |
When called, each card returns two functions named 'show'
and 'hide'
.
withCardon
methods after wrappingName | Type | Description |
---|---|---|
show | (props?: P, callback?: (result: R) => void) => Promise<R> | The function to show the card. It returns a promise with data and waits until the card is closed or can utilize the callback function provided as the second parameter. The card is automatically hidden after the result is returned. |
hide | () => void | Allows the card to be cancelled and hidden without waiting for data to return. Typically, this doesn't need to be used but can be situationally helpful. |
withCardon
can also receive options with its second parameter as withCardon(component, options)
.
Cardon exports a Cardon
class with utility methods.
1import Cardon from "cardon";
Method | Description |
---|---|
Cardon.clear() | Clears all visible cards. |
Cardon.hide(key: string) | Hides a specific card. The card must have a unique key assigned during creation using the 'withCardon' method. |
Here are a few simple steps to use Cardon:
CardonContainer
component to the root file.1// App.js 2function App() { 3 return ( 4 <div> 5 <Main /> 6+ <CardonContainer /> 7 </div > 8 ); 9} 10export default App;
Create a folder named 'cardon' or any name of your choosing and place your cards within this folder.
Wrap the component you want to use as a card as shown in the example below.
1// ./cardon/MyModalCard.jsx 2import { withCardon } from "cardon"; 3import React from "react"; 4 5function MyModalCard({ visible, get, title }) { 6 return ( 7 <Modal open={visible} onClose={get(null)}> 8 My Reusable '{title}' Modal! 9 <button onClick={get(true)}>Yes</button> 10 <button onClick={get(false)}>No</button> 11 </Modal> 12 ); 13} 14export default withCardon(MyModalCard);
Or with TypeScript:
1// ./cardon/MyModalCard.tsx 2import { withCardon } from "cardon"; 3import React from "react"; 4 5interface Props { 6 title: string; 7} 8function MyModalCard({ visible, get, title }) { 9 return ( 10 <div> 11 My Reusable '{title}' Card! 12 <button onClick={get(true)}>Yes</button> 13 <button onClick={get(false)}>No</button> 14 </div> 15 ); 16} 17export default withCardon<Props, boolean>(MyModalCard);
You can alternatively use a card with 'destroyOnHide' options (This is necessary if the card doesn't use the 'visible' prop):
1// ./cardon/MyModalCard.jsx 2import React from "react"; 3import { withCardon } from "cardon"; 4 5function MyModalCard({ get, title }) { 6 return ( 7 <div> 8 My Reusable '{title}' Card! 9 <button onClick={get(true)}>Yes</button> 10 <button onClick={get(false)}>No</button> 11 </div> 12 ); 13} 14export default withCardon(MyModalCard, { destroyOnHide: true });
1let result = await MyModalCard.show({ title: "Awesome" });
Here's an example of usage:
1import React from "react"; 2import { MyModalCard } from "./cardon/MyModalCard"; 3function HomePage() { 4 const [modalResult, setModalResult] = React.useState(false); 5 const showModal = async () => { 6 let result = await MyModalCard.show({ title: "Awesome" }); 7 setModalResult(result); 8 }; 9 10 return ( 11 <> 12 {modalResult ? "Yes" : "No"} 13 <button onClick={showModal}>Show</button> 14 </> 15 ); 16}
You can also use the Cardon class like this:
1import Cardon from "cardon";
2
3Cardon.hide("my-modal-card-key");
4// or clear all visible cards
5Cardon.clear();
Check here for the API document
MIT - Mustafa Kuru
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/9 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
99 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More