UI polish Phase 2: deeper restyle (guides toggle, pages/layers panels, topbar, modal, context menu) #7
@@ -119,6 +119,13 @@ export function treeToCraftState(tree: SerializedTreeNode): string {
|
|||||||
// Container), so there was no menu to edit and the empty zone rendered as a
|
// Container), so there was no menu to edit and the empty zone rendered as a
|
||||||
// stray band above the page. Seeding a real Navbar gives every new site an
|
// stray band above the page. Seeding a real Navbar gives every new site an
|
||||||
// editable menu-with-links out of the box (and removes the empty-header gap).
|
// editable menu-with-links out of the box (and removes the empty-header gap).
|
||||||
|
//
|
||||||
|
// Item 15: the nav used to link Home/About/Services/Contact, but a brand
|
||||||
|
// new site only has a "Home" page -- About/Services/Contact were dead links
|
||||||
|
// on first click. Rather than seeding three empty placeholder pages nobody
|
||||||
|
// asked for, the simpler default is a nav with just the one real page (Home)
|
||||||
|
// plus a CTA button, which is inert (`href: '#'`) rather than pointing at a
|
||||||
|
// page that doesn't exist. Users add pages/links as their site grows.
|
||||||
// Node shape matches treeToCraftState() / Craft's actions.deserialize().
|
// Node shape matches treeToCraftState() / Craft's actions.deserialize().
|
||||||
export const DEFAULT_HEADER_STATE = JSON.stringify({
|
export const DEFAULT_HEADER_STATE = JSON.stringify({
|
||||||
ROOT: {
|
ROOT: {
|
||||||
@@ -144,9 +151,7 @@ export const DEFAULT_HEADER_STATE = JSON.stringify({
|
|||||||
logoFontSize: '20px',
|
logoFontSize: '20px',
|
||||||
links: [
|
links: [
|
||||||
{ text: 'Home', href: '/' },
|
{ text: 'Home', href: '/' },
|
||||||
{ text: 'About', href: '#about' },
|
{ text: 'Get Started', href: '#', isCta: true },
|
||||||
{ text: 'Services', href: '#services' },
|
|
||||||
{ text: 'Contact', href: '#contact', isCta: true },
|
|
||||||
],
|
],
|
||||||
backgroundColor: '#ffffff',
|
backgroundColor: '#ffffff',
|
||||||
textColor: '#3f3f46',
|
textColor: '#3f3f46',
|
||||||
|
|||||||
@@ -23,8 +23,14 @@ describe('DEFAULT_HEADER_STATE seed', () => {
|
|||||||
const { html } = exportBodyHtml(DEFAULT_HEADER_STATE);
|
const { html } = exportBodyHtml(DEFAULT_HEADER_STATE);
|
||||||
expect(html).toContain('<nav');
|
expect(html).toContain('<nav');
|
||||||
expect(html).toContain('MySite');
|
expect(html).toContain('MySite');
|
||||||
for (const link of ['Home', 'About', 'Services', 'Contact']) {
|
// Item 15: the default nav only links pages/anchors that actually exist
|
||||||
|
// on a brand new site (just "Home") plus an inert CTA -- no dead links
|
||||||
|
// to About/Services/Contact pages that were never seeded.
|
||||||
|
for (const link of ['Home', 'Get Started']) {
|
||||||
expect(html).toContain(link);
|
expect(html).toContain(link);
|
||||||
}
|
}
|
||||||
|
expect(html).not.toContain('About');
|
||||||
|
expect(html).not.toContain('Services');
|
||||||
|
expect(html).not.toContain('Contact');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user