CodeCoupler Costa Components Header & Sidebar 🔒
This component is ideal for use as a root application component. It creates a Flexbox-based layout with a sidebar and header. The layout is suitable for both PWA applications and applications that require authentication.
The following stages (id's and classnames) are provided:
Get Started
Here is an example of how this component could be loaded into the root stage and which properties of the Start Definition Object should be set:
Options
apps: Object-
Applications registry of the root component and used by the sidebar. The
@codecoupler/launchercomponent is loaded into the stagesidebarwhich will display n application start menu- auth: AuthenticationModuleandauthStatusVue: Object-
Define an authentication module in the option
auththat applies to components loaded in the custom header and main stage.If an authentication module is configured, the
@codecoupler/auth-status-vuecomponent is used to display a login/logout button and status information. You can find all the configuration options (Vue props) for this component here: Auth Status VueAll the configuration options described there can be set using the
authStatusVueproperty, except for theauthproperty, which is set automatically.Hint: You can also control the debugging property
showIconsvia the URL. To display all icons regardless of the current authentication status, add the hash#debug-all-iconsto your URL. pwa: PWAandpwaVue: Object-
To configure the use of PWA features, use the
pwaoption and assign a@codecoupler-pro/pwainstance.If PWA features have been enabled, the
@codecoupler-pro/app-pwa-vuecomponent is loaded into the stagepwa-statusand is used to display a button for installing a PWA. You can find all the configuration options (Vue props) for this component here: PWA VueHint: Handling the installation prompt works only in chromium based browsers!
All the configuration options described there can be set using the
pwaVueproperty, except for thepwaproperty, which is set automatically.of the current PWA status and in other than chromium-based browsers add the hash
#debug-all-iconsto your url. swLoader: ServiceWorkerLoaderandswLoaderVue: Object-
To configure the loading of a service worker, use the
swLoaderoption and assign a@codecoupler-pro/app-service-workerinstance.If a service worker is used, the
@codecoupler-pro/app-service-worker-vuecomponent is loaded into the stagestatus-swand is used to display a button for updating the service worker if needed and display status information. You can find all the configuration options (Vue props) for this component here: Service Worker Loader VueAll the configuration options described there can be set using the
swLoaderVueoption, except for theswLoaderproperty, which is set automatically.Hint: You can also control the debugging property
showIconsvia the URL. To display all icons regardless of the current service worker status, add the hash#debug-all-iconsto your URL.Hint: You can also control the debugging property
swDebugUpdateAvailablevia the URL. To simulate an available service worker update, add the hash#debug-sw-updateto your URL. launcher: Object-
Configuration options for the launcher component loaded into the sidebar stage. You can find all the configuration options for this component here: Launcher
You should not set the following options as they will be set automatically:
registry,identity,popoverClasses,tooltipClasses.Hint: You can also control the debugging property
debugvia the URL. To keep all tooltips and popovers open, add the hash#debug-launcherto your URL. logoIconandlogoBackground-
These images will be used as background and in the header section.
classes-
With the option
classesyou have the possibility to set classnames for elements that will be rendered into the body:- statusAuthDropdown: Dropdown of the authentication status component (See Auth Status Vue).
- statusSwDropdown: Dropdown of the service worker status component (See Service Worker Loader Vue).
- statusSwPopover: Popover of the service worker status component (See Service Worker Loader Vue).
- launcherTooltip: Tooltips of the launcher component (See Launcher).
- launcherPopover: Popvers of the launcher component (See Launcher).
Styling
Every stage where a component is loaded (all except header), the component has the class
component:
All stages also use their id as class name.
Stage "wco-header":
Stage "logo":
Stage "sidebar"
The background layer of the main stage has the class background:
Stages with status buttons also have the general class status-button:
You can select a specific status button stage by adding the identifier: "& .status-button.identifier {}". Possible identifiers:
- status-sw
- status-pwa
- status-auth
You can select a specific icon inside a status button stage by adding the identifier: "& span.icon.identifier {}". Possible identifiers:
- login
- loading
- user
- error
- desktop
- mobile
- ok
- update
Stages
Stage wco-header
This stage is hidden by default and is displayed only if PWA features are enabled and the site runs
as standalone PWA application in windows control overlay mode; it represents the title bar of the
PWA application.
It is a simple line of text containing the image from the passed via logoIcon option and the
current title from document.title in the form <img ...><span>...</span>.
More details about the classes that will be used to handle this stage: CodeCoupler Application Basics PWA Handling.
Hint: You can display the wco-header regardless of the current PWA mode, add the hash
#debug-wco-header to your URL. Note, however, that the height of the header does not correspond to
the final result. This is not possible unless the PWA is running in windows control overlay mode,
in which case the variable env(titlebar-area-height) cannot be resolved.
Stage logo
Just an img element which loads the image passed via the logoIcon option.
Stage sidebar
The @codecoupler/launcher component is loaded into this stage. You can configure the component
with the option launcher. Read more about this in the description of the launcher option.
The stage will be configured as scrollable:
Stage main
We load components into the stage main that do require authentication. If the user is not
authenticated or has logged out, these components should be destroyed. However, we make an exception
for the background layer.
We load a centered image into the background layer that was passed via logoBackground option.
We will assign a background class to the background layer element to enable more specific styling.
Therefore, we set the following options for the main stage:
{
start: {
settings: {
$auth: {
module: this.#options.auth,
restrictions: { required: true },
controller: AuthControllerDestroy
}
}
},
levels: {
background: {
class: "background",
start: { settings: { $auth: { restrictions: { required: false } } } }
}
}
}
Stage custom-header
We do not load any additional components into the custom-header stage. This stage is intended for
custom components. However, components are not destroyed but merely hidden when authentication is
not present. For this purpose, we use a special controller that does not block the initialization
phase. This means the components can be loaded as early as possible. Therefore, we set the following
options:
{
start: {
settings: {
$auth: {
module: this.#options.auth,
restrictions: { disabled: true },
controller: AuthControllerHide
}
}
}
}
Stages status-pwa, status-sw and status-auth
This is where the components described above are loaded. Read more about this in the descriptions of
the pwa, swLoader, and auth options.