Rename block .editor files to .config
Also drop the color and leftSideBarVisible overrides from PageEditor. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014xjLo7mFxZXfPDCHuKX4Dz
This commit is contained in:
co-authored by
Claude Opus 5
parent
3bc61066f0
commit
69ca137c7d
@@ -0,0 +1,78 @@
|
||||
import { ComponentConfig } from '@reacteditor/core';
|
||||
import { Menu } from 'lucide-react';
|
||||
import Header from '@/components/shopify/header';
|
||||
|
||||
export type HeaderBlockProps = {
|
||||
storeName?: string;
|
||||
logoUrl?: string;
|
||||
showAnnouncement?: 'yes' | 'no';
|
||||
announcement?: string;
|
||||
announcementUrl?: string;
|
||||
links?: Array<{ label: string; url: string }>;
|
||||
};
|
||||
|
||||
const headerEditor: ComponentConfig<HeaderBlockProps> = {
|
||||
label: 'Header',
|
||||
icon: <Menu size={16} />,
|
||||
category: 'navigation',
|
||||
global: true,
|
||||
defaultProps: {
|
||||
storeName: 'Shop',
|
||||
logoUrl: '',
|
||||
showAnnouncement: 'yes',
|
||||
announcement: 'Free shipping on orders over $100',
|
||||
announcementUrl: '',
|
||||
links: [
|
||||
{ label: 'Products', url: '/' },
|
||||
{ label: 'Collections', url: '/collections' },
|
||||
],
|
||||
},
|
||||
fields: {
|
||||
storeName: { label: 'Store name', type: 'text', contentEditable: true },
|
||||
logoUrl: { label: 'Logo', type: 'image' },
|
||||
showAnnouncement: {
|
||||
label: 'Announcement bar',
|
||||
type: 'radio',
|
||||
options: [
|
||||
{ label: 'Show', value: 'yes' },
|
||||
{ label: 'Hide', value: 'no' },
|
||||
],
|
||||
},
|
||||
announcement: {
|
||||
label: 'Announcement',
|
||||
type: 'text',
|
||||
// Keep this a string so blank copy can hide the announcement.
|
||||
placeholder: 'Leave empty to hide the bar',
|
||||
},
|
||||
announcementUrl: { label: 'Announcement link', type: 'text' },
|
||||
links: {
|
||||
label: 'Navigation links',
|
||||
type: 'array',
|
||||
defaultItemProps: { label: 'Link', url: '/' },
|
||||
getItemSummary: (item) => item?.label || 'Link',
|
||||
arrayFields: {
|
||||
label: { label: 'Label', type: 'text', contentEditable: true },
|
||||
url: { label: 'Link', type: 'text' },
|
||||
},
|
||||
},
|
||||
},
|
||||
render: ({
|
||||
storeName,
|
||||
logoUrl,
|
||||
showAnnouncement,
|
||||
announcement,
|
||||
announcementUrl,
|
||||
links,
|
||||
}) => (
|
||||
<Header
|
||||
storeName={storeName}
|
||||
logoUrl={logoUrl}
|
||||
links={links}
|
||||
showAnnouncement={showAnnouncement}
|
||||
announcement={announcement}
|
||||
announcementUrl={announcementUrl}
|
||||
/>
|
||||
),
|
||||
};
|
||||
|
||||
export default headerEditor;
|
||||
Reference in New Issue
Block a user