/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/components/src/flex/flex-item/hook.ts
32 строки
824 B
Marco Ciampini
ESLint: Replace strict config with bulk suppressions (#81248)
07 авг 2026, 14:34
Не верифицирован
07 авг 2026, 14:34
7f43eaf
Код
Авторство
О чём код?
import clsx from 'clsx'; import type { WordPressComponentProps } from '../../context'; import { useContextSystem } from '../../context'; import { useFlexContext } from '../context'; import type { FlexItemProps } from '../types'; import styles from '../style.module.scss'; export function useFlexItem( props: WordPressComponentProps< FlexItemProps, 'div' > ) { const { className, display: displayProp, isBlock = false, style, ...otherProps } = useContextSystem( props, 'FlexItem' ); const contextDisplay = useFlexContext().flexItemDisplay; const display = displayProp || contextDisplay; const itemStyle = { ...style, '--wp-components-flex-item-display': display || 'block', }; return { ...otherProps, className: clsx( styles.item, isBlock && styles.block, className ), style: itemStyle, }; }