import { Editor } from '@components/common/Editor.js';
import { Row } from '@components/common/form/Editor.js';
import { WidgetEmptyState } from '@components/common/page-builder/index.js';
import React from 'react';
interface TextBlockProps {
textWidget: {
text: Row[];
className: string;
};
}
export default function TextBlock({
textWidget: { text, className }
}: TextBlockProps) {
// A freshly dropped text block has no rows — render an empty div on the live
// storefront, but a helpful placeholder in the editor so it isn't invisible.
const hasContent =
Array.isArray(text) &&
text.some((row) =>
row?.columns?.some((col) => (col?.data?.blocks?.length ?? 0) > 0)
);
if (!hasContent) {
return (