diff --git a/src/components/arrow-button/ArrowButton.tsx b/src/components/arrow-button/ArrowButton.tsx
index 5e2e0f7..1cc0946 100644
--- a/src/components/arrow-button/ArrowButton.tsx
+++ b/src/components/arrow-button/ArrowButton.tsx
@@ -5,10 +5,14 @@ import styles from './ArrowButton.module.scss';
/** Функция для обработки открытия/закрытия формы */
export type OnClick = () => void;
-export const ArrowButton = () => {
+export interface ArrowButtonProps {
+ onClick?: OnClick
+}
+
+export const ArrowButton = ({ onClick }: ArrowButtonProps) => {
return (
/* Не забываем указаывать role и aria-label атрибуты для интерактивных элементов */
-
void;
+}
+
+export const ArticleParamsForm = ({ onChange }: propsArticleParamsForm) => {
+ const [sidebarIsOpen, setIsSidebarOpen] = useState(false);
+ const [selectedFont, setSelectedFont] = useState(defaultArticleState.fontFamilyOption);
+ const [selectedFontSize, setSelectedFontSize] = useState(defaultArticleState.fontSizeOption);
+ const [selectedFontColor, setSelectedFontColor] = useState(defaultArticleState.fontColor);
+ const [selectedBackgroundColor, setSelectedBackgroundColor] = useState(defaultArticleState.backgroundColor);
+ const [selectedWidthContent, setSelectedWidthContent] = useState(defaultArticleState.contentWidth);
+
+ const rootRef = useRef
(null);
+ let lastStyles = useRef(defaultArticleState);
+
+ useOutsideClickClose({
+ isOpen: sidebarIsOpen,
+ rootRef: rootRef,
+ onClose: () => {
+ setSelectedFont(lastStyles.current.fontFamilyOption)
+ setSelectedFontSize(lastStyles.current.fontSizeOption)
+ setSelectedFontColor(lastStyles.current.fontColor)
+ setSelectedBackgroundColor(lastStyles.current.backgroundColor)
+ setSelectedWidthContent(lastStyles.current.contentWidth)
+ },
+ onChange: setIsSidebarOpen,
+ });
+
+ const toggleSidebar = () => {
+ // Вызов функции для изменения состояния
+ setIsSidebarOpen(!sidebarIsOpen);
+ }
+
+ const submitHandler = (event: React.FormEvent) => {
+ event.preventDefault();
+
+ lastStyles.current = {
+ fontFamilyOption: selectedFont,
+ fontColor: selectedFontColor,
+ backgroundColor: selectedBackgroundColor,
+ contentWidth: selectedWidthContent,
+ fontSizeOption: selectedFontSize,
+ };
+
+ if (onChange) {
+ onChange(lastStyles.current)
+ }
+ }
+
+ const resetHandler = (event: React.FormEvent) => {
+ event.preventDefault();
+ setSelectedFontColor(defaultArticleState.fontColor)
+ setSelectedFont(defaultArticleState.fontFamilyOption)
+ setSelectedFontSize(defaultArticleState.fontSizeOption)
+ setSelectedBackgroundColor(defaultArticleState.backgroundColor)
+ setSelectedWidthContent(defaultArticleState.contentWidth)
+ if (onChange) {
+ onChange(defaultArticleState)
+ }
+ }
-export const ArticleParamsForm = () => {
return (
- <>
-
-