@wordpress/block-library
Version:
Block library for the WordPress editor.
8 lines (7 loc) • 1.91 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../src/tabs-menu-item/save.js"],
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\t// Build CSS custom properties for active/hover colors\n\tconst customColorStyles = {};\n\n\t// Active/hover colors from custom attributes\n\tif ( attributes.customActiveBackgroundColor ) {\n\t\tcustomColorStyles[ '--custom-tab-active-color' ] =\n\t\t\tattributes.customActiveBackgroundColor;\n\t}\n\tif ( attributes.customActiveTextColor ) {\n\t\tcustomColorStyles[ '--custom-tab-active-text-color' ] =\n\t\t\tattributes.customActiveTextColor;\n\t}\n\tif ( attributes.customHoverBackgroundColor ) {\n\t\tcustomColorStyles[ '--custom-tab-hover-color' ] =\n\t\t\tattributes.customHoverBackgroundColor;\n\t}\n\tif ( attributes.customHoverTextColor ) {\n\t\tcustomColorStyles[ '--custom-tab-hover-text-color' ] =\n\t\t\tattributes.customHoverTextColor;\n\t}\n\n\t// useBlockProps.save includes all core style engine classes and styles\n\t// The button content is replaced by PHP during rendering, so we output\n\t// an empty button as a template.\n\tconst blockProps = useBlockProps.save( {\n\t\tclassName: 'wp-block-tabs-menu-item__template',\n\t\tstyle: customColorStyles,\n\t\ttype: 'button',\n\t\trole: 'tab',\n\t} );\n\n\treturn <button { ...blockProps } />;\n}\n"],
"mappings": ";AAGA,SAAS,qBAAqB;AAkCtB;AAhCO,SAAR,KAAuB,EAAE,WAAW,GAAI;AAE9C,QAAM,oBAAoB,CAAC;AAG3B,MAAK,WAAW,6BAA8B;AAC7C,sBAAmB,2BAA4B,IAC9C,WAAW;AAAA,EACb;AACA,MAAK,WAAW,uBAAwB;AACvC,sBAAmB,gCAAiC,IACnD,WAAW;AAAA,EACb;AACA,MAAK,WAAW,4BAA6B;AAC5C,sBAAmB,0BAA2B,IAC7C,WAAW;AAAA,EACb;AACA,MAAK,WAAW,sBAAuB;AACtC,sBAAmB,+BAAgC,IAClD,WAAW;AAAA,EACb;AAKA,QAAM,aAAa,cAAc,KAAM;AAAA,IACtC,WAAW;AAAA,IACX,OAAO;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,EACP,CAAE;AAEF,SAAO,oBAAC,YAAS,GAAG,YAAa;AAClC;",
"names": []
}