Cesar Mendivil e43686e36d feat(modal-parts): add modular components for modal UI
- Introduced ModalDestinationButton for destination selection with customizable icons and labels.
- Added ModalInput for text input with optional character counter.
- Implemented ModalLink for reusable links styled as underlined text.
- Created ModalPlatformCard for platform selection with badges.
- Developed ModalRadioGroup for radio button groups with custom styling.
- Added ModalSection for grouping modal content with optional labels.
- Implemented ModalSelect for dropdown selections with custom styling.
- Created ModalShareButtons for sharing options via Gmail, Email, and Messenger.
- Developed ModalTextarea for multi-line text input with character counter.
- Introduced ModalToggle for toggle switches with optional help text and links.
- Updated README.md with component descriptions, usage examples, and design guidelines.
- Added index.ts for centralized exports of modal components.
2025-11-06 00:32:08 -07:00

62 lines
1.4 KiB
TypeScript

import React from 'react'
import styles from './ModalCheckbox.module.css'
interface Props {
checked: boolean
onChange: (checked: boolean) => void
label: string
helpIcon?: React.ReactNode
subtext?: string
className?: string
}
const ModalCheckbox: React.FC<Props> = ({
checked,
onChange,
label,
helpIcon,
subtext,
className = ''
}) => {
return (
<div className={`${styles.container} ${className}`}>
<label className={styles.labelWrapper}>
<input
type="checkbox"
checked={checked}
onChange={(e) => onChange(e.target.checked)}
className={styles.input}
/>
<span className={styles.checkbox}>
{checked && (
<svg width="12" height="10" viewBox="0 0 12 10" fill="none">
<path
d="M1 5L4.5 8.5L11 1"
stroke="white"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
)}
</span>
<span className={styles.label}>
{label}
{helpIcon && (
<button
type="button"
className={styles.helpButton}
aria-label="Ayuda"
>
{helpIcon}
</button>
)}
</span>
</label>
{subtext && <p className={styles.subtext}>{subtext}</p>}
</div>
)
}
export default ModalCheckbox