Class HeroModule
java.lang.Object
io.mindspice.simplypages.core.HtmlTag
io.mindspice.simplypages.core.Module
io.mindspice.simplypages.modules.HeroModule
- All Implemented Interfaces:
Component
Module for prominent hero/banner page sections with optional CTA links.
Mutability and thread-safety: mutable and not thread-safe. Hero content/button fields are mutable configuration state; mutate within a request-scoped flow. For reuse, stop mutating shared instances and render stable structures with per-request context data.
-
Field Summary
Fields inherited from class HtmlTag
attributes, children, id, innerText, innerTextSlot, selfClosing, tagName, trustedHtml -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidComposes module structure.centered()Centers all content in the hero section.static HeroModulecreate()withBackgroundColor(String color) Sets raw CSS background color.withBackgroundImage(String imageUrl) Sets a background image using raw single-quoted CSS url() interpolation.withCustomContent(Component content) Adds custom content to the hero section.withDescription(String description) Sets the description text displayed below the subtitle.withModuleId(String moduleId) Sets module id and synchronizes the underlyingidattribute.withPrimaryButton(String text, String url) Adds a primary CTA with an application-controlled or separately navigation-validated URL.withSecondaryButton(String text, String url) Adds a secondary CTA with an application-controlled or separately navigation-validated URL.withSubtitle(String subtitle) Sets the subtitle text displayed below the title.Sets optional title consumed byModule.buildContent()implementations.Methods inherited from class Module
build, getModuleId, getTitle, invalidateContent, rebuildContent, render, render, withClass, withMaxWidth, withMinWidth, withWidthMethods inherited from class HtmlTag
addClass, addStyle, addTrustedStyle, getChildrenStream, getId, hxDelete, hxGet, hxInclude, hxPatch, hxPost, hxPushUrl, hxPut, hxScrollTargetTop, hxSwap, hxTarget, hxTrigger, withAttribute, withChild, withId, withInnerText, withInnerText, withUnsafeHtml
-
Constructor Details
-
HeroModule
public HeroModule()
-
-
Method Details
-
create
-
withTitle
Description copied from class:ModuleSets optional title consumed byModule.buildContent()implementations. -
withModuleId
Description copied from class:ModuleSets module id and synchronizes the underlyingidattribute.- Overrides:
withModuleIdin classModule
-
withSubtitle
Sets the subtitle text displayed below the title. -
withDescription
Sets the description text displayed below the subtitle. -
withBackgroundImage
Sets a background image using raw single-quoted CSS url() interpolation. Supply an application-controlled or separately CSS-context-validated value; there is no CSS escaping or Image validation. Image's scheme policy alone does not control CSS syntax.- Parameters:
imageUrl- URL or path to the background image
-
withBackgroundColor
Sets raw CSS background color. Supply an application-controlled or separately CSS-context-validated value; attribute encoding is not declaration-breakout protection.- Parameters:
color- CSS color value
-
withPrimaryButton
Adds a primary CTA with an application-controlled or separately navigation-validated URL. The href is encoded without Link's scheme policy; null uses the existing fragment fallback.- Parameters:
text- button texturl- button link URL
-
withSecondaryButton
Adds a secondary CTA with an application-controlled or separately navigation-validated URL. The href is encoded without Link's scheme policy; null uses the existing fragment fallback.- Parameters:
text- button texturl- button link URL
-
centered
Centers all content in the hero section. -
withCustomContent
Adds custom content to the hero section.- Parameters:
content- custom component to display
-
buildContent
protected void buildContent()Description copied from class:ModuleComposes module structure.Called at most once by
Module.build()unlessModule.rebuildContent()is invoked. Do not rely on this method for per-request mutation.- Specified by:
buildContentin classModule
-