E527 poc: new content system tryout by mkucmus · Pull Request #2183 · shopware/frontends · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@mkucmus
Copy link
Contributor
@mkucmus mkucmus commented Dec 16, 2025

Summary

Introduces a type-safe, agnostic pattern for content components with shared style configurations.

New Components (5)

  • ContentImage
  • ContentButton
  • ContentText
  • ContentGrid
  • ContentProductCard

New Utilities

  • useContentProperties.ts - Type interfaces for content element properties
  • useContentStyles.ts - Centralized style class mappings
  • useContentFactory.ts - Property extraction with type safety and validation

Features

  • Type Safety: Type-safe property extraction with defined interfaces
  • Shared Styles: Centralized class mappings for consistent styling (alignments, sizes, variants, gaps)
  • Developer Experience: Guaranteed non-undefined values, full TypeScript support
  • Minimal Boilerplate: Clean, declarative component pattern

Documentation

  • CONTENT_COMPONENT_PATTERNS.md - Implementation patterns and usage guide
  • Updated README.md - Examples and best practices

Usage Pattern

const { title, alignment } = extractProperties<TextProperties>(
  props.properties,
  {
    title: { default: "" },
    alignment: { default: "left" },
  }
);

const alignmentClass = computed(() =>
  ALIGNMENT_TEXT_CLASSES[alignment] || ALIGNMENT_TEXT_CLASSES.left
);

Benefits

  • Type-safe property access without manual assertions
  • Reusable style configurations across components
  • Consistent patterns for content element handling
  • Extensible foundation for validation and advanced patterns

@vercel
Copy link
vercel bot commented Dec 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
frontends-demo Ready Ready Preview, Comment Dec 16, 2025 1:20pm
frontends-extended-starter-template Ready Ready Preview, Comment Dec 16, 2025 1:20pm
frontends-vue-starter-template Ready Ready Preview, Comment Dec 16, 2025 1:20pm
1 Skipped Deployment
Project Deployment Review Updated (UTC)
shopware-frontends-docs Skipped Skipped Comment Dec 16, 2025 1:20pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0