diff --git a/src/components/boris/BorisSuperpowers/index.tsx b/src/components/boris/BorisSuperpowers/index.tsx index 513e36be..db95c548 100644 --- a/src/components/boris/BorisSuperpowers/index.tsx +++ b/src/components/boris/BorisSuperpowers/index.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React, { FC, useCallback } from 'react'; import styles from './styles.module.scss'; import { Toggle } from '~/components/input/Toggle'; @@ -7,21 +7,31 @@ interface IProps { onChange?: (val: boolean) => void; } -const BorisSuperpowers: FC = ({ active, onChange }) => ( -
-
- -
+const BorisSuperpowers: FC = ({ active, onChange }) => { + const onToggle = useCallback(() => { + if (!onChange) { + return; + } -
-
Суперспособности
- {active ? ( -
Включи, чтобы видеть будущее
- ) : ( -
Ты видишь всё, что скрыто
- )} + onChange(!active); + }, [onChange, active]); + + return ( +
+
+ +
+ +
+
Суперспособности
+ {active ? ( +
Включи, чтобы видеть будущее
+ ) : ( +
Ты видишь всё, что скрыто
+ )} +
-
-); + ); +}; export { BorisSuperpowers };