Files
site-builder/craft/src/editor/NoticeHost.tsx
T
shadowdaoandClaude Sonnet 5.5 21c2776c88 feat(site-builder): block registry, notices, local prefs, project extras, overlay slot
Add an exported block registry (keywords, search, insertBlock) consumed by
BlocksPanel, a NoticeProvider/NoticeHost toast stack, a guarded localStorage
prefs helper, a ProjectExtras store persisted as project.json 'extras', and a
CanvasOverlays mount point.

Refs #38
Refs #41
Refs #49
Refs #48
Refs #57
Refs #58

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-07 11:14:51 -07:00

34 lines
1.0 KiB
TypeScript

import React from 'react';
import { useNotices } from '../state/NoticeContext';
/** Renders the active notice stack (bottom-left; above the bars on mobile). */
export const NoticeHost: React.FC = () => {
const { notices, dismiss } = useNotices();
if (notices.length === 0) return null;
return (
<div className="notice-host">
{notices.map((n) => (
<div
key={n.id}
className={`notice-item ${n.kind}`}
role={n.kind === 'error' ? 'alert' : 'status'}
>
<span className="notice-text">{n.message}</span>
{n.actionLabel && (
<button
type="button"
className="notice-action"
onClick={() => { n.onAction?.(); dismiss(n.id); }}
>
{n.actionLabel}
</button>
)}
<button type="button" className="notice-dismiss" aria-label="Dismiss" onClick={() => dismiss(n.id)}>
<i className="fa fa-times" aria-hidden="true" />
</button>
</div>
))}
</div>
);
};