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

68 lines
1.6 KiB
TypeScript

import React from 'react'
import styles from './ModalRadioGroup.module.css'
interface RadioOption {
value: string
label: string
icon?: React.ReactNode
}
interface Props {
label?: string
helpIcon?: React.ReactNode
options: RadioOption[]
value: string
onChange: (value: string) => void
name: string
className?: string
}
const ModalRadioGroup: React.FC<Props> = ({
label,
helpIcon,
options,
value,
onChange,
name,
className = ''
}) => {
return (
<div className={`${styles.container} ${className}`}>
{label && (
<div className={styles.labelRow}>
<label className={styles.label}>{label}</label>
{helpIcon && (
<button
type="button"
className={styles.helpButton}
aria-label="Ayuda"
>
{helpIcon}
</button>
)}
</div>
)}
<div className={styles.optionsContainer}>
{options.map((option) => (
<label key={option.value} className={styles.option}>
<input
type="radio"
name={name}
value={option.value}
checked={value === option.value}
onChange={(e) => onChange(e.target.value)}
className={styles.radioInput}
/>
<span className={styles.radioCustom}></span>
{option.icon && <span className={styles.icon}>{option.icon}</span>}
<span className={styles.optionLabel}>{option.label}</span>
</label>
))}
</div>
</div>
)
}
export default ModalRadioGroup