@equinor/roma-page-title-module
v0.0.1
Published
This module enables apps to set the page title automatically based on the current route. ```ts type PageTitle = { setTitleArguments(args: Record<string, string | number>): void; setTitle(title: string, route?: Route): void; setDisabled(disabled: boo
Readme
PageTitleModule
Concept
This module enables apps to set the page title automatically based on the current route.
type PageTitle = {
setTitleArguments(args: Record<string, string | number>): void;
setTitle(title: string, route?: Route): void;
setDisabled(disabled: boolean): void;
}Configuration
import { enablePageTitle } from '@equinor/roma-page-title-module';
export const configure: AppModuleInitiator = (configurator, env) => {
enablePageTitle(configurator, (config) => {
config.setInitialTitle(`Apps`);
config.setRoutes([
{ path: '/apps', title: 'Apps' },
{
path: '/apps/:id', // Dynamic route
title: '{name} | Apps', // {name} refers to the argument in the arguments
arguments: { name: 'Loading...' }, // Show "Loading..." in title until app is loaded
},
]);
});
}This library was generated with Nx.
Building
Run nx build page-title-module to build the library.
Running unit tests
Run nx test page-title-module to execute the unit tests via Vitest.
