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: Authentication Status VueAll the configuration options described there can be set using the
authStatusVueproperty, except for theauthproperty, which is set automatically. 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 Handling 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. 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. 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. logoIconandlogoBackground-
These images will be used as background and in the header section.
Styling
When using this component, it is essential to assign a unique class (via the class property of the
start definition object). This class is also used for elements rendered in the body of the document
(popovers, tooltips, dropdowns). Without this class, these elements cannot be styled accurately.
This class is referred to as root in the following examples and should, of course, be given a
locally unique name, which is defined using the CSS Modules mechanism as :local(.root).
To style all popovers, tooltips, and dropdowns for all components used, you can use the following:
Every stage where a component is loaded (all except header), the component has the class
component and all stages also use their id as class name:
The specific ways in which the individual elements of a stage can be styled are explained in the sections on each stage in the next chapter.
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. You can access the internal HTML structure using CSS as
follows:
More details about the classes that will be used to handle the window controls overlay feature: CodeCoupler Application Basics PWA Handling.
Stage logo
Just an img element which loads the image passed via the logoIcon option. You can access the
internal HTML structure using CSS as follows:
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:
All SVG icons scale relative to the font size. Adjusting the font size causes the icons to adjust accordingly.
You can access the internal HTML structure using CSS as follows:
The boilerplate already includes a basic style that displays the launcher as a vertical list. For more details on the internal structure of the launcher component, see here: Launcher
Stage main
We load components into the main stage, which may 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.
Therefore, we set the following options for the main stage:
{
start: {
settings: {
$auth: {
module: this.#options.auth,
controller: AuthControllerDestroy
}
}
},
levels: {
background: {
class: "background",
start: { settings: { $auth: { restrictions: { required: false } } } }
}
}
}
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.
You can access the internal HTML structure using CSS as follows:
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 status button components are loaded. All stages with status buttons also have an
individual class, as well as a general class, status-button. This allows all status buttons to be
styled centrally, if necessary:
All SVG icons scale relative to the font size. Adjusting the font size causes the icons to adjust accordingly.
Stage status-sw
The @codecoupler-pro/app-service-worker-loader-vue
component is loaded into this stage. You can configure the component with the option swLoaderVue.
Read more about this in the description of the swLoaderVue option.
You can access the internal HTML structure using CSS as follows:
Details about the internal structure of the service worker status button can be found here: Service Worker Loader Vue
Stage status-pwa
The @codecoupler-pro/app-pwa-vue component is loaded into this stage. You
can configure the component with the option pwaVue. Read more about this in the description of
the pwaVue option.
You can access the internal HTML structure using CSS as follows:
Details about the internal structure of the PWA status buttons can be found here: PWA Handling Vue
Stage status-auth
The @codecoupler/auth-status-vue component is loaded into this stage.
You can configure the component with the option authStatusVue. Read more about this in the description
of the authStatusVue option.
You can access the internal HTML structure using CSS as follows:
Details about the internal structure of the authentication status buttons can be found here: Authentication Status Vue