{"id":16065190,"url":"https://github.com/se-gl/codn","last_synced_at":"2026-04-13T00:34:54.954Z","repository":{"id":49814826,"uuid":"517969236","full_name":"Se-Gl/codn","owner":"Se-Gl","description":"Sustainable and lightweight react components based on the greenCSS style guide. SSR ready.","archived":false,"fork":false,"pushed_at":"2022-10-30T12:09:06.000Z","size":2084,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T04:34:18.101Z","etag":null,"topics":["accordion","green-software","input","javascript-framework","javascript-library","modal","nextjs","react","react-component","react-component-library","react-components","ssr","sustainability","web-component","web-components","web-components-library"],"latest_commit_sha":null,"homepage":"https://www.codn.dev","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Se-Gl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-26T08:05:56.000Z","updated_at":"2023-04-25T10:07:18.000Z","dependencies_parsed_at":"2022-08-12T20:40:47.431Z","dependency_job_id":null,"html_url":"https://github.com/Se-Gl/codn","commit_stats":null,"previous_names":["se-gl/sustainable-react"],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Se-Gl%2Fcodn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Se-Gl%2Fcodn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Se-Gl%2Fcodn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Se-Gl%2Fcodn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Se-Gl","download_url":"https://codeload.github.com/Se-Gl/codn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247318749,"owners_count":20919484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accordion","green-software","input","javascript-framework","javascript-library","modal","nextjs","react","react-component","react-component-library","react-components","ssr","sustainability","web-component","web-components","web-components-library"],"created_at":"2024-10-09T05:11:50.358Z","updated_at":"2026-04-13T00:34:54.905Z","avatar_url":"https://github.com/Se-Gl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sustainable React Components\r\n\r\n[![Prettier](https://github.com/Se-Gl/codn/actions/workflows/prettier.yml/badge.svg)](https://github.com/Se-Gl/codn/actions/workflows/prettier.yml)\r\n![Coverage](https://raw.githubusercontent.com/Se-Gl/codn/main/images/badges/badge-statements.svg)\r\n[![Downloads p/week](https://badgen.net/npm/dw/codn)](https://badgen.net/npm/dw/codn)\r\n[![NPM version](https://badgen.net/npm/v/codn)](https://badgen.net/npm/v/codn)\r\n[![minified + gzip](https://badgen.net/bundlephobia/minzip/codn)](https://badgen.net/bundlephobia/minzip/codn)\r\n[![License](https://badgen.net/npm/license/codn)](https://badgen.net/npm/license/codn)\r\n\r\nThis is a sustainable React component project based on [greenCSS](https://github.com/Se-Gl/greenCSS). The components work with plain React, as well as with SSR - such as Next.js. Animations and the basic design were realised with greenCSS. greenCSS is an animated, responsive, lightweight and sustainable CSS library. It is recommended that you also use greenCSS in your project. If you don't want to, just style your modal with your own classes.\r\n\r\nThe project is based on the [sustainable-react](https://www.npmjs.com/package/sustainable-react) package.\r\n\r\n## Features\r\n\r\n- Tested with react and next.js\r\n- [Accordions](#how-to-use-the-accordion) [minified ~ 6KB]\r\n- [Modal](#how-to-use-the-modal) [minified ~ 2KB] | [Next.js Modal](#nextjs-installation) | [React Modal](#react-installation)\r\n- [Input](#how-to-use-the-input) [minified ~ 4KB]\r\n- [Cookie Banner](#how-to-use-the-cookie-banner) [minified ~ 3KB]\r\n- [Toast](#how-to-use-the-toast) [minified ~ 5KB]\r\n- [Captcha](#how-to-use-the-captcha) [minified ~ 2KB]\r\n\r\n## Installation process\r\n\r\n`npm i codn`\r\n\r\n### How to use the Accordion\r\n\r\n![Accordion preview](./images/samples/accordion-sample.gif)\r\n\r\n#### Accordion Features\r\n\r\n- Tested with react and next.js\r\n- Press Tab + Enter to open the accordions\r\n- Two different styles out of the box, or use your own classNames\r\n\r\nThe example below uses greenCSS for styling. [Download greenCSS](https://www.npmjs.com/package/greencss) or learn more on the [greenCSS website](https://greencss.dev). Alternatively to greenCSS you can insert your own classNames.\r\nThe Accordion can be operated with the keyboard (Tab / Enter) as well as clicked.\r\n\r\n#### Accordion Example\r\n\r\n```js\r\nimport React from 'react'\r\nimport { Accordion } from 'codn'\r\n// import the styles\r\nimport 'codn/dist/style/green.css'\r\n// if you want to use the greencss classNames:\r\nimport 'greencss/css/greencss.css'\r\n\r\nexport default function AccordionComponent() {\r\n  return (\r\n    \u003cdiv className='sans m-auto bg-gray-10 w-60rem rounded-20px shadow-small-gray-9'\u003e\r\n      \u003cdiv className='w-50rem m-auto py-50px'\u003e\r\n        // default Accordion\r\n        \u003cAccordion\r\n          className='bg-white rounded-5px'\r\n          expand='first title'\r\n          collapse='collapsed content'\r\n          headerStyleExpanded='text-15px font-600 text-purple pb-10px'\r\n          iconColorExpanded='stroke-purple'\r\n        /\u003e\r\n        // Boxed Accordion\r\n        \u003cAccordion boxStyle={true} expand='second title' collapse='second collapsed content' /\u003e\r\n      \u003c/div\u003e\r\n    \u003c/div\u003e\r\n  )\r\n}\r\n```\r\n\r\n### Accordion Props\r\n\r\nYou can adjust the default values listed below at any time with your values or classNames. Be aware that you may have to readjust the design. Therefore, a change is only recommended if you really know what you are doing.\r\n\r\n| Name                | Default Value                                                                                                            | Description                                                  |\r\n| ------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------ |\r\n| **expand**          | **'Your title'**                                                                                                         | Your title                                                   |\r\n| **collapse**        | **'Your collapsed content'**                                                                                             | Your collapsed content                                       |\r\n| className           | 'bg-white'                                                                                                               | Use your own className to style the Accordion                |\r\n| boxStyle            | false                                                                                                                    | Secondary Accordion design                                   |\r\n| shadow              | true                                                                                                                     | Set a shadow around the secondary icon                       |\r\n| headerStyle         | 'text-15px font-600 text-black'                                                                                          | Default \"expand\" title design                                |\r\n| collapseStyle       | 'text-15px text-black'                                                                                                   | Default text style for collapsed content                     |\r\n| headerStyleExpanded | 'text-15px font-600 text-blue pb-10px'                                                                                   | Default \"expand\" title design if expanded                    |\r\n| iconColorCollapse   | 'stroke-black'                                                                                                           | Default icon className if collapsed                          |\r\n| iconColorExpanded   | 'stroke-blue'                                                                                                            | Default icon color if expanded                               |\r\n| circleCollapse      | 'shadow-small-gray-10 bg-white'                                                                                          | Default circle color around the _boxStyle icon_ if collapsed |\r\n| circleExpand        | 'rotate-90deg bg-blue'                                                                                                   | Default circle color around the _boxStyle icon_ if expanded  |\r\n| border              | ' border = 'focus:outline-1px focus:outline-solid focus:text-blue-9 text-blue-9 border-1px border-solid border-gray-10'' | Default border style                                         |\r\n\r\n### How to use the Modal\r\n\r\n![Modal preview](./images/samples/modal-sample.gif)\r\n\r\n#### Modal Features\r\n\r\n- Tested with react and next.js\r\n- Press CTRL + k to open the modal\r\n- Press ESC key to close the modal\r\n- On Chrome browser the background is blurred. In Firefox this feature is not available, there the background has an opacity of 75%.\r\n- Click on the background or the close icon (top right corner) to close the modal.\r\n- The Modal component use a default greenCSS fade in animation with a duration of 500ms `fade-in animation-duration-500ms animation-forwards`. If you want to animate the `Modal.Header` or `Modal.Body`, just add your greenCSS or your custom animation as a class to the `className`. Here can find all [greenCSS animations](https://www.greencss.dev/examples/animation). p.e. `\u003cModal.Body className='clip-circle-in-left animation-duration-800ms animation-forwards'\u003e`\r\n- Do you want to use your own close icon on the top right corner? Add `closeIcon` with your own (svg-) component. `\u003cModal toggle={toggleModal} setToggle={setToggleModal} closeIcon={\u003cdiv\u003eX\u003c/div\u003e}\u003e` The recommended size for an svg is 20x20px.\r\n- People who do not want animations will automatically not be shown any motions. As it will be blocked by default `prefers-reduced-motion: reduce`\r\n\r\n### Modal Example\r\n\r\n#### Next.js installation\r\n\r\nIn the pages directory, add `_document.js`. It is important to add `\u003cdiv id='modal-portal' /\u003e` below the `\u003cMain /\u003e` component. Otherwise your SSR Modal will not work. Learn more about the custom [document](https://nextjs.org/docs/advanced-features/custom-document).\r\n\r\n```js\r\n// pages/_document.js\r\nimport Document, { Html, Head, Main, NextScript } from 'next/document'\r\n\r\nclass MyDocument extends Document {\r\n  static async getInitialProps(ctx) {\r\n    const initialProps = await Document.getInitialProps(ctx)\r\n    return { ...initialProps }\r\n  }\r\n\r\n  render() {\r\n    return (\r\n      \u003cHtml\u003e\r\n        \u003cHead /\u003e\r\n        \u003cbody\u003e\r\n          \u003cMain /\u003e\r\n          \u003cdiv id='modal-portal' /\u003e\r\n          \u003cNextScript /\u003e\r\n        \u003c/body\u003e\r\n      \u003c/Html\u003e\r\n    )\r\n  }\r\n}\r\nexport default MyDocument\r\n```\r\n\r\nThe following jsx file below is based on greenCSS. If you don't want to use it, you can add your own `classNames`.\r\n\r\n```js\r\nimport React, { useState } from 'react'\r\nimport { Modal } from 'codn'\r\n// import the styles\r\nimport 'codn/dist/style/green.css'\r\n\r\nexport default function Home() {\r\n  const [toggleModal, setToggleModal] = useState(false)\r\n  return (\r\n    \u003cdiv className='min-h-100vh bg-gray-9'\u003e\r\n      {/* Modal Toggle Button */}\r\n      \u003cbutton onClick={() =\u003e setToggleModal((prev) =\u003e !prev)} className='bg-red-9 px-20px py-10px rounded-10px hover:bg-red-7'\u003e\r\n        Toggle Modal\r\n      \u003c/button\u003e\r\n\r\n      {/* Modal */}\r\n      \u003cModal toggle={toggleModal} setToggle={setToggleModal}\u003e\r\n        \u003cModal.Header className='sans font-900 text-30px fade-in-left animation-duration-500ms animation-forwards'\u003e\r\n          \u003ch3\u003e👋 Hi, I'm your modal\u003c/h3\u003e\r\n        \u003c/Modal.Header\u003e\r\n        \u003cModal.Body className='sans font-400 text-15px text-gray fade-in animation-duration-800ms animation-forwards'\u003e\r\n          \u003cp\u003e\r\n            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna\r\n            aliqua. Viverra accumsan in nisl nisi scelerisque eu ultrices vitae auctor. Quis vel eros donec ac. Mauris\r\n            pellentesque pulvinar pellentesque habitant morbi tristique senectus.\r\n          \u003c/p\u003e\r\n          \u003cp\u003e\r\n            Nunc non blandit massa enim nec dui nunc. Sed elementum tempus egestas sed sed risus. Senectus et netus et malesuada\r\n            fames ac turpis egestas maecenas. Urna nec tincidunt praesent semper feugiat. Est ante in nibh mauris cursus mattis\r\n            molestie. Vel elit scelerisque mauris pellentesque pulvinar pellentesque habitant.\r\n          \u003c/p\u003e\r\n        \u003c/Modal.Body\u003e\r\n        \u003cModal.Footer className='sans font-400 text-10px'\u003e\r\n          \u003ch3\u003ecopyright\u003c/h3\u003e\r\n        \u003c/Modal.Footer\u003e\r\n      \u003c/Modal\u003e\r\n    \u003c/div\u003e\r\n  )\r\n}\r\n```\r\n\r\nDo you want to use your style within the modal? No problem - you can add any JSX inside.\r\n\r\n```js\r\nimport React, { useState } from 'react'\r\nimport { Modal } from 'codn'\r\n// import the styles\r\nimport 'codn/dist/style/green.css'\r\n\r\nexport default function Home() {\r\n  const [toggleModal, setToggleModal] = useState(false)\r\n  return (\r\n    \u003cdiv className='min-h-100vh bg-gray-9'\u003e\r\n      {/* Modal Toggle Button */}\r\n      \u003cbutton onClick={() =\u003e setToggleModal((prev) =\u003e !prev)} className='bg-red-9 px-20px py-10px rounded-10px hover:bg-red-7'\u003e\r\n        Toggle Modal\r\n      \u003c/button\u003e\r\n\r\n      {/* Modal */}\r\n      \u003cModal toggle={toggleModal} setToggle={setToggleModal}\u003e\r\n        \u003ch3\u003e👋 Hi, I'm your independent modal\u003c/h3\u003e\r\n        \u003cp\u003e\r\n          Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna\r\n          aliqua. Viverra accumsan in nisl nisi scelerisque eu ultrices vitae auctor. Quis vel eros donec ac. Mauris pellentesque\r\n          pulvinar pellentesque habitant morbi tristique senectus.\r\n        \u003c/p\u003e\r\n      \u003c/Modal\u003e\r\n    \u003c/div\u003e\r\n  )\r\n}\r\n```\r\n\r\n#### React installation\r\n\r\nYou can also use the codn modal in your create-react-app. Head to your `public/index.html` file and add `\u003cdiv id=\"modal-portal\" /\u003e` below the `\u003cdiv id=\"root\"\u003e\u003c/div\u003e`.\r\n\r\n```jsx\r\n\u003c!DOCTYPE html\u003e\r\n\u003chtml lang=\"en\"\u003e\r\n  \u003chead\u003e\r\n    \u003cmeta charset=\"utf-8\" /\u003e\r\n    \u003clink rel=\"icon\" href=\"%PUBLIC_URL%/favicon.ico\" /\u003e\r\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\" /\u003e\r\n    \u003cmeta name=\"theme-color\" content=\"#000000\" /\u003e\r\n    \u003cmeta name=\"description\" content=\"Web site created using create-react-app\" /\u003e\r\n    \u003clink rel=\"apple-touch-icon\" href=\"%PUBLIC_URL%/logo192.png\" /\u003e\r\n    \u003clink rel=\"manifest\" href=\"%PUBLIC_URL%/manifest.json\" /\u003e\r\n    \u003ctitle\u003eReact App\u003c/title\u003e\r\n  \u003c/head\u003e\r\n  \u003cbody\u003e\r\n    \u003cnoscript\u003eYou need to enable JavaScript to run this app.\u003c/noscript\u003e\r\n    \u003cdiv id=\"root\"\u003e\u003c/div\u003e\r\n    \u003cdiv id=\"modal-portal\" /\u003e\r\n  \u003c/body\u003e\r\n\u003c/html\u003e\r\n```\r\n\r\nWithin a page or a component, you can now add and use the Modal.\r\n\r\n```js\r\nimport React, { useState } from 'react'\r\nimport { Modal } from 'codn'\r\n// import the styles\r\nimport 'codn/dist/style/green.css'\r\n\r\nfunction App() {\r\n  const [toggleModal, setToggleModal] = useState(false)\r\n  return (\r\n    \u003cdiv className='App'\u003e\r\n      {/* Modal Toggle Button */}\r\n      \u003cbutton onClick={() =\u003e setToggleModal((prev) =\u003e !prev)} className='bg-red-9 px-20px py-10px rounded-10px hover:bg-red-7'\u003e\r\n        Toggle Modal\r\n      \u003c/button\u003e\r\n\r\n      {/* Modal */}\r\n      \u003cModal toggle={toggleModal} setToggle={setToggleModal}\u003e\r\n        \u003cModal.Header className='sans font-900 text-30px fade-in-left animation-duration-500ms animation-forwards'\u003e\r\n          \u003ch3\u003e👋 Hi, I'm your modal\u003c/h3\u003e\r\n        \u003c/Modal.Header\u003e\r\n        \u003cModal.Body className='sans font-400 text-15px text-gray fade-in animation-duration-800ms animation-forwards'\u003e\r\n          \u003cp\u003e\r\n            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna\r\n            aliqua. Viverra accumsan in nisl nisi scelerisque eu ultrices vitae auctor. Quis vel eros donec ac. Mauris\r\n            pellentesque pulvinar pellentesque habitant morbi tristique senectus.\r\n          \u003c/p\u003e\r\n        \u003c/Modal.Body\u003e\r\n        \u003cModal.Footer className='sans font-400 text-10px'\u003e\r\n          \u003ch3\u003ecopyright\u003c/h3\u003e\r\n        \u003c/Modal.Footer\u003e\r\n      \u003c/Modal\u003e\r\n    \u003c/div\u003e\r\n  )\r\n}\r\n\r\nexport default App\r\n```\r\n\r\n## Summary\r\n\r\n1. Import the modal.\r\n2. Add the div with the id=\"modal-portal\":\r\n\r\n- Next.js: Adjust pages/\\_document.js\r\n- React: Adjust public/index.html\r\n\r\n3. In your page/component:\r\n\r\n- Set the react useState to toggle the modal.\r\n- Create a button to activate the modal with one click.\r\n- Create and adjust your personal modal.\r\n\r\n4. Have fun with the sustainable Next.js Modal\r\n\r\n### Modal Props\r\n\r\n| Name                  | Default Value                                         | Description                                                                                                             |\r\n| --------------------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |\r\n| toggle                | -                                                     | useState toggle state                                                                                                   |\r\n| setToggle             | -                                                     | useState toggle setToggle                                                                                               |\r\n| useKeyInput           | true                                                  | Use the default key inputs \"CTRL + k\" to open the modal and \"ESC\" to close the modal                                    |\r\n| shadow                | true                                                  | Set a black shadow modal content                                                                                        |\r\n| modalPadding          | true                                                  | Apply a 20px padding around the modal                                                                                   |\r\n| className             | \"\"                                                    | Use your own className to style the modal content                                                                       |\r\n| backgroundAnimation   | 'fade-in animation-duration-500ms animation-forwards' | Add your custom animation className in order to overwrite the default fade in animation for the background              |\r\n| modalContentAnimation | 'fade-in animation-duration-500ms animation-forwards' | Add your custom animation className in order to overwrite the default fade in animation for the modal content component |\r\n| closeIcon             | `\u003cCloseIcon /\u003e `                                      | Add your own close icon on the top right, may be an svg or your custom component                                        |\r\n| `\u003cModal\u003e`             | `\u003cModal\u003e{children}\u003c/Modal\u003e`                           | This is the Modal component. Add your own child element(s) or use the `\u003cModal.Header\u003e` and `\u003cModal.Body\u003e` inside.       |\r\n| `\u003cModal.Header\u003e`      | `\u003cModal.Header\u003e{children}\u003c/Modal.Header\u003e`             | Add a header text                                                                                                       |\r\n| `\u003cModal.Body\u003e`        | `\u003cModal.Body\u003e{children}\u003c/Modal.Body\u003e`                 | Add body elements                                                                                                       |\r\n| `\u003cModal.Footer\u003e`      | `\u003cModal.Footer\u003e{children}\u003c/Modal.Footer\u003e`             | Add footer elements                                                                                                     |\r\n\r\n### How to use the Input\r\n\r\n![Input preview](./images/samples/input-sample.gif)\r\n\r\n#### Input Features\r\n\r\n- Modern Input UI with label transition animation\r\n- Input and Textarea\r\n\r\nThe example below uses greenCSS for styling. [Download greenCSS](https://www.npmjs.com/package/greencss) or learn more on the [greenCSS website](https://greencss.dev). Alternatively to greenCSS you can insert your own classNames.\r\nThe Accordion can be operated with the keyboard (Tab / Enter) as well as clicked.\r\n\r\n#### Input Example\r\n\r\n⚠️ The width of the input field is 100%. Specify a desired width in the parent element if needed.\r\n⚠️ The input fields are not protected against XSS attacks.\r\n\r\n```js\r\nimport React, { useState } from 'react'\r\nimport { Input, TextArea } from 'codn'\r\n// import the styles\r\nimport 'codn/dist/style/green.css'\r\nimport 'codn/dist/style/input.css'\r\n// if you want to use the greencss classNames:\r\nimport 'greencss/css/greencss.css'\r\n\r\nexport default function AccordionComponent() {\r\n  const [password, setPassword] = useState('')\r\n  const [message, setMessage] = useState('')\r\n  return (\r\n    \u003cdiv className='sans m-auto bg-gray-10 w-60rem rounded-20px shadow-small-gray-9'\u003e\r\n      // Specify your desired width\r\n      \u003cdiv className='w-50rem m-auto py-50px'\u003e\r\n        \u003cInput\r\n          required={true}\r\n          id='password-field'\r\n          minlength={8}\r\n          maxLength={64}\r\n          value={password}\r\n          setValue={setPassword}\r\n          type='password'\r\n          htmlFor='password'\r\n          label='Your Password'\r\n        /\u003e\r\n        \u003cTextArea\r\n          maxLength={500}\r\n          id='message'\r\n          label='Message'\r\n          type='text'\r\n          value={message}\r\n          setValue={setMessage}\r\n          htmlFor='message'\r\n        /\u003e\r\n      \u003c/div\u003e\r\n    \u003c/div\u003e\r\n  )\r\n}\r\n```\r\n\r\n### Input Props\r\n\r\nYou can adjust the default values listed below at any time with your values or classNames. Be aware that you may have to readjust the design. Therefore, a change is only recommended if you really know what you are doing.\r\n\r\n| Name      | Default Value       | Description                                |\r\n| --------- | ------------------- | ------------------------------------------ |\r\n| **label** | **The input label** | Title of your input or textarea            |\r\n| custom    | \"\"                  | Add custom input related properties        |\r\n| required  | false               | Determine if your input is required or not |\r\n| autofocus | false               | Determine if your input is auto selected   |\r\n| shadow    | true                | Set a gray-9 (#eaeaea) shadow              |\r\n| id        | ''                  | ID of your input/textarea                  |\r\n| value     | ''                  | useState value state                       |\r\n| setValue  | ''                  | useState setValue state                    |\r\n| htmlFor   | ''                  | htmlFor state                              |\r\n| minlength | ''                  | Minimum number of characters               |\r\n| maxLength | ''                  | Maximum number of characters               |\r\n| type      | 'text'              | Input field type                           |\r\n| name      | ''                  | Input field name                           |\r\n\r\n### How to use the Cookie Banner\r\n\r\n![cookie banner preview](./images/samples/cookie-sample.jpg)\r\n\r\n#### Cookie Banner Features\r\n\r\n- Uses localstorage to detect if a user has already accepted the cookies\r\n- Adjust the banner position\r\n\r\n#### Cookie Banner Example\r\n\r\n```js\r\nimport React from 'react'\r\nimport { CookieBanner } from 'codn'\r\n// import the styles\r\nimport 'codn/dist/style/green.css'\r\n// if you want to use the greencss classNames:\r\nimport 'greencss/css/greencss.css'\r\n\r\nexport default function CookieComponent() {\r\n  return (\r\n    \u003c\u003e\r\n      \u003cCookieBanner position='top-right' shadow={false} header='greenCSS uses Cookies' buttonText='I want!'\u003e\r\n        \u003cp className='text-15px text-gray'\u003e\r\n          Click “Accept” to enable greenCSS to use cookies in order to personalize this site for you. In this process you agree to\r\n          the storing of cookies and/or data in your local storage. You agree, that we use analytics to enhance site navigation\r\n          and analyze site usage. It helps us to improve the UI/UX experience for you.\r\n        \u003c/p\u003e\r\n      \u003c/CookieBanner\u003e\r\n    \u003c/\u003e\r\n  )\r\n}\r\n```\r\n\r\n### Cookie Banner Props\r\n\r\n| Name         | Default Value                                                                                                                                                                                                                                                     | Description                                                                                                                |\r\n| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |\r\n| position     | 'bottom-right'                                                                                                                                                                                                                                                    | The cookie position, possible locations: 'top-left', 'top-right', 'bottom-left', 'bottom-right'                            |\r\n| shadow       | true                                                                                                                                                                                                                                                              | Set a shadow around the secondary icon                                                                                     |\r\n| header       | '🍪 Our website uses cookies'                                                                                                                                                                                                                                     | Set a custom cookie title                                                                                                  |\r\n| buttonText   | 'Accept'                                                                                                                                                                                                                                                          | Set a custom cookie button text                                                                                            |\r\n| showButton   | true                                                                                                                                                                                                                                                              | Show the button which shows the footer button - if you disable it, localstorage functionality will no longer be available. |\r\n| buttonStyle  | 'cursor-pointer flex py-10px px-25px min-w-50px font-bold transition-duration-200ms transition-all rounded-10px border-1px border-solid border-black my-auto text-center justify-center items-center m-auto text-15px text-black hover:bg-black hover:text-white' | Set a custom cookie button style                                                                                           |\r\n| { children } | Our website use cookies. By continuing, we assume your permission to deploy cookies as detailed in our Privacy Policy.                                                                                                                                            | Set a custom body content                                                                                                  |\r\n| className    | \"\"                                                                                                                                                                                                                                                                | Set additional custom classNames                                                                                           |\r\n\r\n### How to use the Toast\r\n\r\n![Toast preview](./images/samples/toast-sample.webp)\r\n\r\n#### Toast Features\r\n\r\n- Tested with react and next.js\r\n- Lightweight toast / pop-up component\r\n- Progress bar\r\n\r\nThe example below uses greenCSS for styling. [Download greenCSS](https://www.npmjs.com/package/greencss) or learn more on the [greenCSS website](https://greencss.dev). Alternatively to greenCSS you can insert your own classNames.\r\n\r\n#### Toast Example\r\n\r\n```js\r\nimport React, { useState } from 'react'\r\nimport { handleShowToast, Toast } from 'codn'\r\n// import the styles\r\nimport 'codn/dist/style/green.css'\r\n// if you want to use the greencss classNames:\r\nimport 'greencss/css/greencss.css'\r\n\r\nexport default function ToastComponent() {\r\n  const [toastList, setToastList] = useState([])\r\n  return (\r\n    \u003c\u003e\r\n      \u003cbutton onClick={() =\u003e handleShowToast('info', 'Success', 'You did it! codn toast works successfully!', setToastList)}\u003e\r\n        Show warning\r\n      \u003c/button\u003e\r\n      \u003cToast\r\n        toastList={toastList}\r\n        setToastList={setToastList}\r\n        duration={5000}\r\n        position='top-right'\r\n        progressColor='from-blue to-magenta gradient-to-left'\r\n      /\u003e\r\n    \u003c/\u003e\r\n  )\r\n}\r\n```\r\n\r\n### Toast Props\r\n\r\nYou can adjust the default values listed below at any time with your values or classNames. Be aware that you may have to readjust the design. Therefore, a change is only recommended if you really know what you are doing.\r\n\r\n| Name              | Default Value         | Description                                                                                                                                                             |\r\n| ----------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\r\n| handleShowToast() | N/A                   | Function to set the toast type, title, description and the setToastList hook.                                                                                           |\r\n| toastList         | toastList             | useState hook call                                                                                                                                                      |\r\n| setToastList      | setToastList          | useState hook call                                                                                                                                                      |\r\n| duration          | 5000                  | Time to display the toast - in ms                                                                                                                                       |\r\n| progressColor     | ''                    | Default color for info ('bg-blue'), warning 'bg-orange', success ('bg-greencss') or error ('bg-red'). Set your own background-color class if you want to use your color |\r\n| position          | 'top-right'           | Possible positions: 'top-left', 'top-right','bottom-left','bottom-right'                                                                                                |\r\n| shadow            | 'shadow-small-gray-5' | Display a shadow class (gray-5)                                                                                                                                         |\r\n\r\n⚠️ The `handleShowToast()` must be configured for the toast component to work! This function takes 4 parameters:\r\n\r\n- The type: 'success', 'error', 'info' or 'warning'\r\n- The title of your toast\r\n- The description of your toast\r\n- The useState hook\r\n\r\n```js\r\n  const [toastList, setToastList] = useState([])\r\n  ...\r\n\u003cbutton onClick={() =\u003e handleShowToast('info', 'Information Header', 'You did it! The info text appears!', setToastList)}\u003e\r\n  Show information toast\r\n\u003c/button\u003e\r\n...\r\n\u003cToast\r\n...\r\n/\u003e\r\n```\r\n\r\n### How to use the Captcha\r\n\r\n![Toast preview](./images/samples/captcha-sample.webp)\r\n\r\n#### Captcha Features\r\n\r\n- Tested with React and Next.js (SSR)\r\n- Based on canvas\r\n- Generates a secure and sustainable captcha component on the client side.\r\n- No unnecessary API request are made to a backend.\r\n- No data is collected. The privacy of your users is secured.\r\n\r\nThe example below uses greenCSS for styling. [Download greenCSS](https://www.npmjs.com/package/greencss) or learn more on the [greenCSS website](https://greencss.dev). Alternatively to greenCSS you can insert your own classNames.\r\n\r\n#### Captcha Example\r\n\r\n```js\r\nimport React, { useState } from 'react'\r\nimport { Captcha } from 'codn'\r\n// import the styles\r\nimport 'codn/dist/style/green.css'\r\n\r\nexport default function CaptchaComponent() {\r\n  const [captcha, setCaptcha] = useState()\r\n  // check your console!\r\n  console.log(captcha)\r\n  return (\r\n    \u003c\u003e\r\n      \u003cCaptcha setWord={setCaptcha} /\u003e\r\n    \u003c/\u003e\r\n  )\r\n}\r\n```\r\n\r\n### Captcha Props\r\n\r\nYou can adjust the default values listed below at any time with your values or classNames. Be aware that you may have to readjust the design. Therefore, a change is only recommended if you really know what you are doing.\r\n\r\n| Name               | Default Value                                                            | Description                                                  |\r\n| ------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------ |\r\n| setWord            | null                                                                     | useState hook call to verify the user input with the captcha |\r\n| numberOfCharacters | 5                                                                        | Default number of captcha characters                         |\r\n| backgroundColor    | '#101010'                                                                | Default hex color of the canva's background color            |\r\n| fontColor          | '#f0eef5'                                                                | Default hex color of the canva's text color                  |\r\n| charset            | 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!=?+\\*%\u0026' | Default charset regex                                        |\r\n\r\n## Contribute: We Use [Semantic Release](https://github.com/semantic-release/semantic-release)\r\n\r\nWe use semantic versioning for commit messages.\r\n\r\nFor commit messages, use semantig writing:\r\n\r\n| Commit                                                                                        |      Usage       | Version |\r\n| --------------------------------------------------------------------------------------------- | :--------------: | ------- |\r\n| fix(your-change): a small change, p.e. fixed a component, readme or test                      |   Fix Release    | v.0.0.1 |\r\n| feat(your-change): a new feature, p.e. test suite for a component                             | Feature Release  | v.0.1.0 |\r\n| perf(your-change): a breaking change or hotfix \\n BREAKING CHANGE: p.e. added a new component | Breaking Release | v.1.0.0 |\r\n\r\nA breaking change must be written in the footer. p.e.\r\n\r\n`perf(your-change): a breaking change or hotfix\r\n\r\nBREAKING CHANGE: First line of explanation\r\nOther lines of explanations`\r\n\r\nPossible commit values are:\r\n\r\n```json\r\n[\r\n  'build',\r\n  'chore',\r\n  'ci',\r\n  'docs',\r\n  'feat',\r\n  'fix',\r\n  'perf',\r\n  'refactor',\r\n  'revert',\r\n  'style',\r\n  'test'\r\n];\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fse-gl%2Fcodn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fse-gl%2Fcodn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fse-gl%2Fcodn/lists"}