Documentation ¶
Overview ¶
Package ui provides a set of components to organize an application layout.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // The padding of block-like components in px. BlockPadding = 30 // The padding of block-like components in px when app width is <= 480px. BlockMobilePadding = 18 // The content width of block-like components in px. BlockContentWidth = 580 // The horizontal padding of base-like components in px. BaseHPadding = 36 // The horizontal padding of base-like components in px when app width is <= 480px. BaseMobileHPadding = 12 // The horizontal padding of base-like ad components in px. BaseAdHPadding = BaseHPadding / 2 // The vertical padding of base-like components in px. BaseVPadding = 12 // The default icon size in px. DefaultIconSize = 24 // The default icon space. DefaultIconSpace = 6 // The default width for flow items in px. DefaultFlowItemWidth = 372 )
Functions ¶
This section is empty.
Types ¶
type IAdsenseDisplay ¶
type IAdsenseDisplay interface { app.UI // Sets the ID. ID(v string) IAdsenseDisplay // Sets the class. Multiple classes can be defined by successive calls. Class(v string) IAdsenseDisplay // Sets the AdSense slot. Client(v string) IAdsenseDisplay // Sets the AdSense slot. Slot(v string) IAdsenseDisplay }
IAdsenseDisplay is the interface that describes a responsive Adsense display unit.
Note that the Adsense script must be loaded in the app.Handler.RawHeaders.
func AdsenseDisplay ¶
func AdsenseDisplay() IAdsenseDisplay
AdsenseDisplay creates a responsive Adsense display unit.
type IBase ¶
type IBase interface { app.UI // Sets the ID. ID(v string) IBase // Sets the class. Multiple classes can be defined by successive calls. Class(v string) IBase // The content. Content(v ...app.UI) IBase }
IBase is the interface that describes a component that serves as a base for a content.
type IBlock ¶
type IBlock interface { app.UI // Sets the ID. ID(v string) IBlock // Sets the class. Multiple classes can be defined by successive calls. Class(v string) IBlock // Aligns content to the top. Top() IBlock // Aligns content to the middle. Middle() IBlock // Sets whether there is padding. Default is true. Padding(v bool) IBlock // The maximum content width. Default is 540px. MaxContentWidth(px int) IBlock // Sets the content. Content(v ...app.UI) IBlock }
Block is the interface that describes a block of content.
type IFlow ¶
type IFlow interface { app.UI // Sets the ID. ID(v string) IFlow // Sets the class. Multiple classes can be defined by successive calls. Class(v string) IFlow // Sets the width in px for the content items. // Default is 300px. ItemWidth(px int) IFlow // Sets the space between content elements in px. Spacing(px int) IFlow // Makes the items occupy all the available space when the content has only // one row. StretchItems() IFlow // Sets the content. Content(elems ...app.UI) IFlow }
IFlow is the interface that describes a container that displays its items as a flow.
type IFlyer ¶
type IFlyer interface { app.UI // Sets the ID. ID(v string) IFlyer // Sets the class. Multiple classes can be defined by successive calls. Class(v string) IFlyer // Sets the header height in px. Default is 90px. HeaderHeight(px int) IFlyer // Sets the premium ad height. Default is 250px PremiumHeight(px int) IFlyer FooterHeight(px int) IFlyer // Sets the banner space located at the top. Banner(v ...app.UI) IFlyer // Sets the premium space located under the banner. Premium(v ...app.UI) IFlyer // Sets a bonus space located under the premium space and displayed when // there is enough space. Bonus(v ...app.UI) IFlyer }
IFlyer is the interface that describes a base with ad spaces surrounded by placeholder header and footer.
type IIcon ¶
type IIcon interface { app.UI // Sets the ID. ID(v string) IIcon // Sets the class. Multiple classes can be defined by successive calls. Class(v string) IIcon // Sets the style. Multiple styles can be defined by successive calls. Style(k, v string) IIcon // Sets the icon horizontal and vertical size in px. Size(px int) IIcon // Sets the SVG code or the source location. Src(v string) IIcon }
IIcon is the interface that describes an icon.
type ILink ¶
type ILink interface { app.UI // Sets the ID. ID(v string) ILink // Sets the class. Multiple classes can be defined by successive calls. Class(v string) ILink // Sets the style. Multiple styles can be defined by successive calls. Style(k, v string) ILink // Sets the icon SVG code or its source path. Icon(v string) ILink // Sets the icon size. IconSize(px int) ILink // Sets the space between the icon and the label. IconSpace(px int) ILink // Sets the content vertical padding. Padding(v int) ILink // Sets the label. Label(v string) ILink // Set the tooltip. Help(v string) ILink // Sets the href to go when the link is clicked Href(v string) ILink // Sets the event handler called when the link is clicked. OnClick(v app.EventHandler) ILink }
ILink is the interface that describes a clickable link.
type ILoader ¶
type ILoader interface { app.UI // Sets the ID. ID(v string) ILoader // Sets the class. Multiple classes can be defined by successive calls. Class(v string) ILoader // Sets the style. Multiple styles can be defined by successive calls. Style(k, v string) ILoader // Reports whether the loader is active. Loading(v bool) ILoader // Sets the size of the rotating circle in px. Default is 60px. Size(px int) ILoader // Sets the color of the rotating head. Default is white. Color(v string) ILoader // Sets the time it take to fully rotate. Default is 500ms. Speed(v time.Duration) ILoader // Sets the space between the loader and the label in px. Default is 18px. Spacing(px int) ILoader // Sets the label. Default is "Loading...". Label(v string) ILoader // Sets the error that occured during loading. Err(err error) ILoader // Sets the error icon. ErrIcon(v string) ILoader }
type IScroll ¶
type IScroll interface { app.UI // Sets the ID. ID(v string) IScroll // Sets the class. Multiple classes can be defined by successive calls. Class(v string) IScroll // Sets the header height in px. Default is 90px. HeaderHeight(px int) IScroll // Sets the header. Header(v ...app.UI) IScroll // Sets the content. Content(v ...app.UI) IScroll FooterHeight(px int) IScroll Footer(v ...app.UI) IScroll }
IScroll is the interface that describes a base with a scrollable content surrounded by a fixed header and footer.
type IShell ¶
type IShell interface { app.UI // Sets the ID. ID(v string) IShell // Sets the class. Multiple classes can be defined by successive calls. Class(v string) IShell // Sets the width in px for the menu and index panes. // Default is 270px. PaneWidth(px int) IShell // Sets the width in px for the ads pane. AdsWidth(px int) IShell // Customizes the hamburger menu button with the given element. // Default is ☰. HamburgerButton(v app.UI) IShell // Sets the hamburger menu content. HamburgerMenu(v ...app.UI) IShell // Sets the menu pane content. Menu(v ...app.UI) IShell // Sets the index pane content. Index(v ...app.UI) IShell // Sets the content. Content(v ...app.UI) IShell // Sets the ads pane. Ads(v ...app.UI) IShell }
IShell is the interface that describes a layout that responsively displays a content with a menu pane, an index page, and a hamburger menu.
type IStack ¶
type IStack interface { app.UI // Sets the ID. ID(v string) IStack // Sets the class. Multiple classes can be defined by successive calls. Class(v string) IStack // Sets the style. Multiple styles can be defined by successive calls. Style(k, v string) IStack // Left aligns the content on the left. Left() IStack // Center aligns the content on the horizontal center. Center() IStack // Right aligns the content on the right. Right() IStack // Top aligns the content on the top. Top() IStack // Middle aligns the content on the vertical center. Middle() IStack // Bottom aligns the content on the bottom. Bottom() IStack // Stretch stretches the content vertically. Stretch() IStack // Sets the content. Content(elems ...app.UI) IStack }
IStack is the interface that describes a container that displays its items as stacked panels.