feat(blocks): add Localized type support to full-guide blocks
Widens prose props on FleetDiagram, HandoffTable, PhasePanel, RouteTable, SkillPackage, and WorktreeMap to accept {en, pt} as well as string, and conditionally renders language spans. Non-prose props (id, code, etc) were left as strings.
This commit is contained in:
@@ -7,12 +7,14 @@
|
||||
// paired with a `<article>` detail panel by the parent page; this component
|
||||
// renders only the picker.
|
||||
|
||||
type Localized = { en: string; pt: string };
|
||||
|
||||
interface PackageFile {
|
||||
id: 'skill' | 'references' | 'scripts' | 'assets' | string;
|
||||
/** Path rendered inside `<code>`, e.g. "SKILL.md". */
|
||||
path: string;
|
||||
/** Helper copy under the path. */
|
||||
small: string;
|
||||
small: string | Localized;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
@@ -34,7 +36,18 @@ const { files, initial = files[0]?.id ?? 'skill' } = Astro.props;
|
||||
aria-selected={file.id === initial}
|
||||
>
|
||||
<code>{file.path}</code>
|
||||
<small>{file.small}</small>
|
||||
<small>
|
||||
{typeof file.small === 'string' ? (
|
||||
file.small
|
||||
) : (
|
||||
<>
|
||||
<span data-language-content="en">{file.small.en}</span>
|
||||
<span data-language-content="pt" hidden>
|
||||
{file.small.pt}
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
</small>
|
||||
</button>
|
||||
))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user