presentation/views/grammar.view.ts

presentation/views/grammar.view.ts is a file in Bane's Lab Site. 49 lines of code and 4 definitions.

import { GRAMMAR_DESCRIPTION, GRAMMAR_LICENSE, GRAMMAR_TITLE } from "#configuration/strings/page.strings";
import { GRAMMAR_REPOSITORY, LICENSE_FILE, SITE_URL, pagePath } from "#core/assets/link.assets";
import { mountTabSwitching, renderTabbedPage } from "#presentation/widgets/tab.widget";
import { AUTHOR } from "#configuration/constants/schema.constants";
import { GRAMMAR_META } from "#configuration/strings/tab.strings";
import { GRAMMAR_PAGE } from "#core/ids/page.ids";
import { GRAMMAR_TABS } from "#core/generated/grammar.page.generated";
import { GRAMMAR_TONE } from "#configuration/constants/tab.constants";
import type { PageDefinition } from "#types/page.types";
import type { SchemaEntity } from "#types/schema.types";
import type { TabbedPage } from "#types/tab.types";

const GRAMMAR_ENTITY: SchemaEntity = {
    "@type": "CreativeWork",
    alternateName: GRAMMAR_TITLE,
    creator: AUTHOR,
    description: GRAMMAR_DESCRIPTION,
    license: SITE_URL + LICENSE_FILE,
    name: GRAMMAR_META.title,
    sameAs: GRAMMAR_REPOSITORY,
    url: SITE_URL + pagePath(GRAMMAR_PAGE),
    version: GRAMMAR_META.version,
};

const DEFINITION: TabbedPage = {
    layout: "chapter",
    meta: GRAMMAR_META,
    page: GRAMMAR_PAGE,
    tabs: GRAMMAR_TABS,
    tone: GRAMMAR_TONE,
};

const renderGrammar = function renderGrammar(): Element {
    return renderTabbedPage(DEFINITION);
};

void mountTabSwitching(DEFINITION);

export const PAGE: PageDefinition = {
    article: true,
    content: {
        kind: "tabbed",
        layout: DEFINITION.layout,
        meta: GRAMMAR_META,
        tabs: GRAMMAR_TABS,
        tone: DEFINITION.tone,
    },
    description: GRAMMAR_DESCRIPTION,
    entities: [GRAMMAR_ENTITY],
    id: GRAMMAR_PAGE,
    license: GRAMMAR_LICENSE,
    render: renderGrammar,
    title: GRAMMAR_TITLE,
};