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

[BBT-53] Add a new ButtonExport component and corresponding rest endpoint #13

Merged
merged 3 commits into from
Jul 19, 2023

Conversation

chrishbite
Copy link
Contributor

@chrishbite chrishbite commented Jul 12, 2023

Description

Fixes BBT-53

Allows a user to export an updated theme.json file with the layers merged and flattened.

The ButtonExport component is reusable and can be placed anywhere, for this PR it has been added next to the other buttons.

<ButtonExport />

Change Log

  • A new reusable ButtonExport component
  • New **/themer/v1/export rest route

Steps to test

Notes: As the main UI for themer isn't implemented yet, suggest to use the Site Editor for the below testing steps to check functionality of the export on the TwentyTwenty-Three theme.

  1. Use the Reset to defaults button to reset all user styles/settings and save
  2. Add multiple custom colours via Styles > Colours > Palette
  3. Set Styles > Colours > Colours > * options to random colours from the palette
  4. Set a couple of Styles > Typography > Elements to random settings
  5. Change Styles > Blocks > Paragraph options
  6. Save
  7. Click the Export theme.json button on the Themer admin page
  8. Save the file to your machine
  9. Use the Reset to defaults button to reset all user styles/settings again and save
  10. Refresh both Themer and Site Editor pages (they should now be back to default styles from the themes theme.json)
  11. Open up the twentytwentythree/theme.json file and replace with exported files content
  12. Refresh both Themer and Site Editor pages
  13. Confirm that the Settings now reflect the changes made previously and were exported

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

allows an updated copy of theme.json to be exported and saved via the plugin dashboard
@chrishbite chrishbite added the enhancement New feature or request label Jul 12, 2023
Copy link
Member

@g-elwell g-elwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works great, my only request is that we update all the class usage in class-rest-api.php to use the same format. Happy to go with the declarative approach and avoid \ if you don't mind updating the other class references in this file?

@chrishbite
Copy link
Contributor Author

This works great, my only request is that we update all the class usage in class-rest-api.php to use the same format. Happy to go with the declarative approach and avoid \ if you don't mind updating the other class references in this file?

Updated those usages and references @g-elwell 👍

@chrishbite chrishbite requested a review from g-elwell July 17, 2023 09:12
Copy link
Member

@g-elwell g-elwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrishbite cheers! Just noticed this one is targeting main, can you update to target release/1.0.0 ?

@chrishbite chrishbite changed the base branch from main to release/1.0.0 July 17, 2023 14:06
@chrishbite chrishbite marked this pull request as draft July 17, 2023 14:07
@chrishbite chrishbite changed the base branch from release/1.0.0 to main July 18, 2023 08:54
@chrishbite chrishbite changed the base branch from main to release/1.0.0 July 18, 2023 08:54
@chrishbite chrishbite marked this pull request as ready for review July 18, 2023 08:55
@chrishbite chrishbite requested a review from g-elwell July 18, 2023 08:55
Copy link
Member

@g-elwell g-elwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chrishbite chrishbite merged commit fe99d1e into release/1.0.0 Jul 19, 2023
@g-elwell g-elwell mentioned this pull request Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants