split pages CreateUpdatePost on two part and fixed button map
This commit is contained in:
28
src/components/ClearableField.jsx
Normal file
28
src/components/ClearableField.jsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import CloseIcon from "../components/icons/CloseIcon";
|
||||
|
||||
/**
|
||||
* ClearableField — обёртка над полем ввода, добавляющая справа крестик,
|
||||
* который полностью стирает содержимое поля.
|
||||
*
|
||||
* @param {function} onClear — очистить поле
|
||||
* @param {boolean} visible — показывать ли крестик (обычно наличие значения)
|
||||
* @param {ReactNode} children — само поле ввода (input / textarea)
|
||||
*/
|
||||
export default function ClearableField({ onClear, visible, children }) {
|
||||
return (
|
||||
<div className="f-clr-wrap">
|
||||
{children}
|
||||
{visible && (
|
||||
<button
|
||||
type="button"
|
||||
className="f-clr-btn"
|
||||
onClick={onClear}
|
||||
aria-label="Очистить"
|
||||
tabIndex={-1}
|
||||
>
|
||||
<CloseIcon />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user