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

55 lines
1.1 KiB
TypeScript

import React, { useState } from 'react'
import styles from './ModalCopyInput.module.css'
interface Props {
value: string
buttonText?: string
copiedText?: string
onCopy?: (value: string) => void
className?: string
}
/**
* Componente de input con botón de copiar
* Estilo StreamYard: input ancho + botón azul brillante
*/
export const ModalCopyInput: React.FC<Props> = ({
value,
buttonText = 'Copiar',
copiedText = '✓ Copiado',
onCopy,
className = ''
}) => {
const [copied, setCopied] = useState(false)
const handleCopy = async () => {
try {
await navigator.clipboard.writeText(value)
setCopied(true)
onCopy?.(value)
setTimeout(() => setCopied(false), 2000)
} catch (err) {
console.error('Error al copiar:', err)
}
}
return (
<div className={`${styles.container} ${className}`}>
<input
type="text"
value={value}
readOnly
className={styles.input}
/>
<button
onClick={handleCopy}
className={styles.button}
>
{copied ? copiedText : buttonText}
</button>
</div>
)
}
export default ModalCopyInput