Ability to resuse a node type but style it differently based on the context

Open
#147 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
typescript
Domain
frontend

Research direction

Start with NodeArrayProperty and inspect how its components mapping is handled. Compare the Button.svelte and FooterLink.svelte components, along with the FooterColumn context described in the issue. Define the supported mapping behavior and verify that one node type can be reused while rendering appropriately in each context.

Written by the indexing model from the issue text.

Description

E.g. currently in editable website v2 I have 'nav_item' and 'footer_link', both have label and href, so it could be the same data element. Though i want to render it differently. I also don't want to control it with diffent layouts within one component. So the structure might be fundamentally different (not just the styling). What is the same is the data structure.

E.g. I could let the parent override the component mapping, so that the FooterColumn component can say that the button type should be mapped from the Button.svelte component to FooterLink.svelte.

<NodeArrayProperty
  path={[...path, 'footer_link_columns']}
  components={ button: 'footer_link' }
/>

Not sure if this is the best, but something similiar would be good. If I used the same type in FooterLink Columns and in the menu nav, you can copy and paste entries between the two areas.

Dominant language
TypeScript
Stars
691
Forks
20
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from michael/svedit

All issues in michael/svedit

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.