'Moving LoginComponent to another slot
Because of design requirements, we want to show the LoginComponent as part of the SiteLinks slot (above the main navigation). I went deep into the source code and found this component has a static mapping to the SiteLogin slot
export const defaultCmsContentProviders: ValueProvider[] = [
...
provideCmsStructure({
componentId: 'LoginComponent',
pageSlotPosition: 'SiteLogin',
}),
];
I have removed this provider from my set up, because redefining a provideCmsStructure with my slot name doesn't work.
I have defined a new ValueProvider[] for my project,
export const myCmsContentProviders: ValueProvider[] = [
provideCmsStructure({
componentId: 'HamburgerMenuComponent',
pageSlotPosition: 'PreHeader',
}),
provideCmsStructure({
componentId: 'LoginComponent',
pageSlotPosition: 'SiteLinks',
}),
];
This shows the hamburger on mobile, but doesn't add the LoginComponent to the SiteLinks slot..
Has anyone succeeded in moving this component?
We are running spartacus 4.0 (greenfield)
Solution 1:[1]
I created a new page where I didn't want the Header to appear. I looked everywhere in my impexes to try to find out why this LoginComponent was being added even though I don't have a Header. In the end, it was hardcoded in the Spartacus library using provideCmsStructure and I still don't know how to remove it besides replacing it with a custom empty Component.
provideCmsStructure({
componentId: 'EmptyComponent',
pageSlotPosition: 'SiteLogin',
}),
Surely there's a better way...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Hugh |
