Skip to content

Component composition

cosmos-digital-services should be shared-component first.

  1. Use @cosmos/ui-astro when behavior or presentation is reusable.
  2. Use app-local components in src/components only when app-specific and not a good shared fit.
  3. Keep route files in src/pages focused on composition, not large inline logic.

Most page sections are imported from @cosmos/ui-astro:

  • Layout/navigation: SeoHead, Header, Footer.
  • Marketing sections: Hero, CTA, Services, InfoGridSection, ListPanelSection, etc.
  • Common layout blocks: CenteredTextHeadAndDescription, TwoColumn, LeftAlignedText.

Theme runtime behavior comes from @cosmos/theme/runtime in Layout.astro.

  • src/components/marketing/ComparisonSection.astro is app-local.
  • App-specific page logic/scripts and worker integration behavior remain local to this workspace.

Create app-local when all are true:

  • The behavior is tied to this app’s route/content model.
  • Reuse outside this app is unlikely.
  • Extracting to shared package would add friction without clear value.

Otherwise, prefer extending @cosmos/ui-astro and consuming it here.

  • Why shared vs local was chosen.
  • Any new props/contracts added.
  • Which routes depend on the change.