Sha256: 204e3b5a66828cf94b1f06d03959105fa7f1e30f14910f8de5f94bd8f62d10bf
Contents?: true
Size: 1.22 KB
Versions: 4
Compression:
Stored size: 1.22 KB
Contents
import React from "react"; import * as PageEditor from "../../types/PageEditor"; import * as Pages from "../../types/Pages"; import LocaleLinks from "./LocaleLinks"; interface PageDescriptionProps { state: PageEditor.State; dispatch: (action: PageEditor.Action) => void; children: React.ReactNode; } function editLink(locale: string, page: Pages.Ancestor | Pages.Resource) { return ( <a href={`/admin/${locale}/pages/${page.id}/edit`}> {pageName(locale, page)} </a> ); } function pageName(locale: string, page: Pages.Ancestor | Pages.Resource) { if ("name" in page) { return page.name[locale]; } return page.blocks.name[locale] || <i>Untitled</i>; } export default function PageDescription(props: PageDescriptionProps) { const { state, dispatch, children } = props; const { locale, page } = state; return ( <div className="page-description with_content_tabs"> <LocaleLinks state={state} dispatch={dispatch} /> <h3> {page.ancestors.map((p) => ( <React.Fragment key={p.id}> {editLink(locale, p)} {" ยป "} </React.Fragment> ))} {page.id ? editLink(locale, page) : "New Page"} </h3> {children} </div> ); }
Version data entries
4 entries across 4 versions & 1 rubygems