- 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.
53 lines
1.0 KiB
TypeScript
53 lines
1.0 KiB
TypeScript
import React from 'react'
|
|
import styles from './ModalSelect.module.css'
|
|
|
|
interface SelectOption {
|
|
value: string
|
|
label: string
|
|
}
|
|
|
|
interface Props {
|
|
label: string
|
|
value: string
|
|
onChange: (value: string) => void
|
|
options: SelectOption[]
|
|
placeholder?: string
|
|
required?: boolean
|
|
className?: string
|
|
}
|
|
|
|
const ModalSelect: React.FC<Props> = ({
|
|
label,
|
|
value,
|
|
onChange,
|
|
options,
|
|
placeholder,
|
|
required = false,
|
|
className = ''
|
|
}) => {
|
|
return (
|
|
<div className={`${styles.container} ${className}`}>
|
|
<label className={styles.label}>{label}</label>
|
|
<select
|
|
value={value}
|
|
onChange={(e) => onChange(e.target.value)}
|
|
required={required}
|
|
className={styles.select}
|
|
>
|
|
{placeholder && (
|
|
<option value="" disabled>
|
|
{placeholder}
|
|
</option>
|
|
)}
|
|
{options.map((option) => (
|
|
<option key={option.value} value={option.value}>
|
|
{option.label}
|
|
</option>
|
|
))}
|
|
</select>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default ModalSelect
|