Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize plugin slots #178

Open
24 of 25 tasks
Tracked by #27
arbrandes opened this issue May 9, 2024 · 4 comments
Open
24 of 25 tasks
Tracked by #27

Standardize plugin slots #178

arbrandes opened this issue May 9, 2024 · 4 comments
Assignees
Labels
enhancement Relates to new features or improvements to existing features
Milestone

Comments

@arbrandes
Copy link

arbrandes commented May 9, 2024

Description

With this issue we're aiming to coordinate the following:

Standardize plugin slot name conventions

Every slot should adhere to the following conventions:

  • It should be reasonably easy to deduce what a slot is used for from its slot ID
  • Slot IDs should use snake case: footer_slot
  • Slot IDs should end with _slot

Standardize how slots are exposed

Instead of inserting PluginSlots randomly throughout the code, they should each be implemented in their own subdirectory of plugin-slots, like so:

src/plugin-slots
├── SequenceContainerSlot
│   ├── index.jsx
└── UnitTitleSlot
    ├── index.jsx

The component name itself should be suffixed with Slot.

Add clear documentation

The main README should have a section dedicated to pointing users to the README in the src/plugin-slots directory, whin in turn should contain a list of all slots available in the MFE in question. Each slot entry should then link to the README for each individual slot implementation, as per the directory structure below:

src/plugin-slots
├── README.md
└── UnitTitleSlot
    ├── images
    │   └── post_unit_title.png
    ├── index.jsx
    └── README.md

An individual slot's README should:

  • Explain what the slot's purpose is
  • Give a simple example of a plugin that utilizes that slot
  • Show, with screenshots, what the example plugin would look like on the page

Create slots as an example on every MFE supported by Tutor in Redwood

For each MFE supported by tutor-mfe, we'll give operators the option to use the Footer as a PluginSlot instead of forking frontend-component-footer.

To achieve this, we'll create a separate repository called frontend-slot-footer that provides a <FooterSlot /> implementation with <Footer /> from frontend-component-footer as its default content. Relevant MFEs will then be changed to depend on frontend-slot-footer instead of frontend-component-footer and replace all instances of <Footer /> with <FooterSlot />. This way, users that fork frontend-component-footer for customization will not need to take any action post-merge, while others that want to try out the new slot will be able to do so transparently.

Tasks

Preview Give feedback
  1. released
  2. released
@arbrandes arbrandes converted this from a draft issue May 9, 2024
@arbrandes arbrandes added this to the Redwood.1 milestone May 9, 2024
@arbrandes arbrandes added the enhancement Relates to new features or improvements to existing features label May 9, 2024
@arbrandes
Copy link
Author

We re-examined our stance on asking users that fork frontend-component-footer to take action after this work lands, and are going instead with an approach that takes that customization path into account. From the updated description:

For each MFE supported by tutor-mfe, we'll give operators the option to use the Footer as a PluginSlot instead of forking frontend-component-footer.

To achieve this, we'll create a separate repository called frontend-slot-footer that provides a <FooterSlot /> implementation with <Footer /> from frontend-component-footer as its default content. Relevant MFEs will then be changed to depend on frontend-slot-footer instead of frontend-component-footer and replace all instances of <Footer /> with <FooterSlot />. This way, users that fork frontend-component-footer for customization will not need to take any action post-merge, while others that want to try out the new slot will be able to do so transparently.

@davidjoy
Copy link
Contributor

Would it make sense to just put FooterSlot in the existing footer repository, or in frontend-platform to avoid needing another repository? (I haven't thought this through completely, but figure you have)

@brian-smith-tcril
Copy link

brian-smith-tcril commented May 20, 2024

Would it make sense to just put FooterSlot in the existing footer repository

We tried this first, but ran into issues. The options to make this possible would either be:

  • Make it so the exported Footer component includes the FooterSlot
    • This felt less than ideal from a semantic perspective. It isn't clear as a consumer if you have the slot or not.
  • Export the FooterSlot component as a named export
    • This is what we tried at first, it was a problem for people that use forked footers because their forks didn't export that component, so the MFEs were expecting something the fork didn't provide.

or in frontend-platform

Hadn't considered that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Relates to new features or improvements to existing features
Projects
Status: In progress
Development

No branches or pull requests

3 participants