23 lines
1.2 KiB
JavaScript
23 lines
1.2 KiB
JavaScript
import React from 'react';
|
|
import Modal from './Modal';
|
|
import styles from '../styles/GroupModal.module.css';
|
|
|
|
export default function CreateGroupModal({ isOpen, onClose, group, loading, onChange, onSave }) {
|
|
return (
|
|
<Modal isOpen={isOpen} onClose={onClose} disabled={loading}>
|
|
<h3 className={styles.title}>Добавить группу</h3>
|
|
<form onSubmit={onSave} className={styles.form}>
|
|
<label className={styles.label}>Название
|
|
<input type="text" value={group.name} onChange={e => onChange({ ...group, name: e.target.value })} required className={styles.input} />
|
|
</label>
|
|
<label className={styles.label}>Описание
|
|
<input type="text" value={group.description || ''} onChange={e => onChange({ ...group, description: e.target.value })} className={styles.input} />
|
|
</label>
|
|
<div className={styles.actions}>
|
|
<button type="submit" disabled={loading} className={styles.saveBtn}>{loading ? 'Создание...' : 'Создать'}</button>
|
|
<button type="button" onClick={onClose} disabled={loading} className={styles.cancelBtn}>Отмена</button>
|
|
</div>
|
|
</form>
|
|
</Modal>
|
|
);
|
|
}
|