WordPress / create-block-theme

A WordPress plugin to create block themes
https://wordpress.org/plugins/create-block-theme/
GNU General Public License v2.0
310 stars 44 forks source link

Handle font licenses when editing theme metadata #649

Closed matiasbenedetto closed 1 month ago

matiasbenedetto commented 1 month ago

What

Why?

To avoid the need of collecting the font licesing information manually.

How

Calls the /font-families/ endpoint and process the data to create the fille the font credits text area. Using a button to get the latest licenses has 2 benefits:

:warning: This PR depends on https://github.com/WordPress/create-block-theme/pull/648 being merged

Screencast

This video features how the font licences can be updated for a theme.

Screencast from 30-05-24 12:00:58.webm

matiasbenedetto commented 1 month ago

I removed the error handling where it was not needed and added it in the function where the license text is requested. If getting the license fails, the UI will throw an alert.

Until merging https://github.com/WordPress/create-block-theme/pull/648 this PR will display this error:

Screencast from 23-05-24 12:20:13.webm

Why an alert? Because the snackbar is behind the modal component and is not visible. As that problem is not easy to fix (reference: https://github.com/WordPress/gutenberg/issues/52609) I think for now the alert is good enough.

Screencast from 23-05-24 12:02:53.webm