Skip to content

Commit

Permalink
feat: Updated 2 files
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] committed Apr 26, 2024
1 parent d1e5252 commit cda8ae7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/PersistentCheckbox.js
Expand Up @@ -2,6 +2,13 @@ import { Component } from '@wordpress/element';

import { getValue, setValue } from './localStorage';

/**
* Renders a checkbox that persists its checked state in localStorage.
*
* Props:
* id (string): The unique ID of the checkbox. Used as the localStorage key.
* label (React.Element): The label to display next to the checkbox.
*/
export default class PersistentCheckbox extends Component {
constructor( props ) {
super( props );
Expand Down
6 changes: 6 additions & 0 deletions src/PersistentCheckboxList.js
Expand Up @@ -2,6 +2,12 @@ import md5 from 'md5';

import PersistentCheckbox from './PersistentCheckbox';

/**
* Renders a list of PersistentCheckbox components.
*
* Props:
* labels (string[]): An array of labels to render checkboxes for.
*/
export default function PersistentCheckboxList( { labels } ) {
const listId = `list-${ md5( labels.join( '' ) ) }`;
const style = { listStyleType: 'none', marginLeft: 0 };
Expand Down

0 comments on commit cda8ae7

Please sign in to comment.