Refactored LCPDataGrid

This commit is contained in:
Jeremy Rangel
2025-01-24 03:06:04 -08:00
parent 23944b0052
commit be3a4fb9ff
12 changed files with 427 additions and 689 deletions

View File

@ -28,7 +28,9 @@ const LCPChartBlockSettings = ({ attributes, setAttributes }) => {
renderYGrid,
xGridColor,
yGridColor,
legendFontSize
legendFontSize,
includeDataChart,
allowChartDataDownload
} = attributes;
// Set local state for legend location and alignment (for UI updates)
@ -53,7 +55,24 @@ const LCPChartBlockSettings = ({ attributes, setAttributes }) => {
// Render the component
return (
<div>
{/* Grid Settings Panel */}
{/* Front-end Chart Settings */}
<PanelBody title={__('Grid', 'lcp')} initialOpen={false}>
{/* Render the chart on the front-end */}
<ToggleControl
label={__('Include Data Chart', 'lcp')}
checked={includeDataChart}
onChange={(value) =>
setAttributes({ includeDataChart: value })}
/>
{/* Allow chart data download */}
<ToggleControl
label={__('Allow Chart Data Download', 'lcp')}
checked={allowChartDataDownload}
onChange={(value) =>
setAttributes({ allowChartDataDownload: value })}
/>
</PanelBody>
{/* Grid Settings Panel */}
<PanelBody title={__('Grid', 'lcp')} initialOpen={false}>
{/* Render X-Grid */}
<ToggleControl