bigbite / themer

GNU General Public License v2.0
2 stars 0 forks source link

[BBT-123]: Add functionality to allow editors to manage multiple style variations #51

Closed Joe-Rouse closed 10 months ago

Joe-Rouse commented 10 months ago

This PR branches off the work completed in #50 so that PR should be reviewed and merged before reviewing this PR.

Description

Completes BBT-123 - This PR adds the ability for an editor to manage multiple styles at once, and to select which one of those styles is 'active'. The UI is very basic here and will change in the future, but this PR just focuses on adding the basic functionality.

I've reused the endpoint from BBT-122, but changed it up slightly so it handles both GET & POST requests - a GET request allows us to retrieve all the style variations for the current theme, and a POST request sets the active style variation for the current theme.

Rather than grabbing the globalStylesId using the core __experimentalGetCurrentGlobalStylesId() function, I'm now making a request to our endpoint and finding the post that is published as there should only ever be 1 for the current theme.

Change Log

Steps to test

Screenshots/Videos

https://github.com/bigbite/themer/assets/45216035/7dfe7792-113c-4453-af8f-2240b2d96437

Checklist: