/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/block-library/src/tab-list/save.js
43 строки
1 KB
Marco Ciampini
ESLint: Replace strict config with bulk suppressions (#81248)
07 авг 2026, 14:34
Не верифицирован
07 авг 2026, 14:34
7f43eaf
Код
Авторство
О чём код?
import clsx from 'clsx'; import { RichText, useBlockProps, __experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles, __experimentalGetColorClassesAndStyles as getColorClassesAndStyles, __experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles, } from '@wordpress/block-editor'; export default function save( { attributes } ) { const { tabs } = attributes; const blockProps = useBlockProps.save( { role: 'tablist', } ); const colorProps = getColorClassesAndStyles( attributes ); const borderProps = getBorderClassesAndStyles( attributes ); const spacingProps = getSpacingClassesAndStyles( attributes ); const buttonClassName = clsx( colorProps.className, borderProps.className ); const buttonStyle = { ...colorProps.style, ...borderProps.style, ...spacingProps.style, }; return ( <div { ...blockProps }> { tabs.map( ( tab, index ) => ( <RichText.Content key={ index } className={ buttonClassName || undefined } style={ buttonStyle } tagName="button" value={ tab.label } type="button" role="tab" /> ) ) } </div> ); }