/
Bybaleshqa
/
Forktest
Обзор
Документация
Войти
/
Bybaleshqa
/
Forktest
Код
Запросы
1
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/hooks/examples/OutsideClickExample.tsx
40 строк
923 B
Pavel Uryadyshev
docs: фикс документации по хукам
20 ноя 2024, 15:28
20 ноя 2024, 15:28
5eff7c9
Код
Авторство
О чём код?
import * as React from 'react' import { useOutsideClick, useTheme } from '@v-uik/base' import { Code } from './_Code' export const OutsideClickExample = (): JSX.Element => { const [count, setCount] = React.useState(0) const theme = useTheme() const ref = useOutsideClick(() => { setCount((x) => x + 1) }) return ( <div style={{ display: 'flex', flexDirection: 'column', gap: 8, width: 708 }} > <div style={{ width: 150, height: 150, background: theme.ref.palette.red90, display: 'flex', justifyContent: 'center', alignSelf: 'center', alignItems: 'center', }} > <div ref={ref} style={{ width: 50, height: 50, background: theme.ref.palette.herbal60, }} /> </div> <Code data={count} /> </div> ) }