1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00
vault-frontend/src/components/boris/BorisSuperpowers/index.tsx
2022-01-19 12:30:04 +07:00

39 lines
1,023 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { FC, useCallback } from 'react';
import { Toggle } from '~/components/input/Toggle';
import styles from './styles.module.scss';
interface IProps {
active?: boolean;
onChange?: (val: boolean) => void;
}
const BorisSuperpowers: FC<IProps> = ({ active, onChange }) => {
const onToggle = useCallback(() => {
if (!onChange) {
return;
}
onChange(!active);
}, [onChange, active]);
return (
<div className={styles.wrap}>
<div className={styles.toggle}>
<Toggle value={active} handler={onChange} color="primary" />
</div>
<div className={styles.left} onClick={onToggle}>
<div className={styles.title}>Суперспособности</div>
{active ? (
<div className={styles.subtitle}>Ты видишь всё, что скрыто</div>
) : (
<div className={styles.subtitle}>Включи, чтобы видеть будущее</div>
)}
</div>
</div>
);
};
export { BorisSuperpowers };