Skip to content

[RFC] Proposal: Decompose super-components #6848

Open
@susnux

Description

@susnux

Proposal: decompose "super" components.

A super-component is a large component that tries to do too much work for different, sometimes very narrow, cases.

Why

Such components often have tens of props, complex implementation and 1000-2000+ lines of code, while 200-400 is a limit for a good component.

Examples

  • NcActions, covers:
    • Simple menus, including navigation and inline feature
    • Custom menus with custom button contents
    • Dialogs with forms
  • NcAvatar
    • Minimal: just an image
    • Maximum: user metadata fetching + user status + contacts menu
  • NcAppSidebar
    • On one hand - a universal sidebar
    • On another - contents Files-specific app features such as "favorite"
    • Same with NcModal with viewer-only features
  • NcSelect

What to do

  • Decompose to base components and more specific components
    • e.g. NcSelect => NcSelect + NcSelectUsers
  • Make a base component extendable and customize in place where needed
    • e.g. NcAppSidebar for Files app use cases

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionNeed advices, opinions or ideas on this topic

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions