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

Enable adjustment of 'settings' values #94

Open
g-elwell opened this issue Aug 15, 2024 · 0 comments
Open

Enable adjustment of 'settings' values #94

g-elwell opened this issue Aug 15, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@g-elwell
Copy link
Member

What problem does this address?

We're currently only providing a UI for adjusting the 'styles' within theme.json.

We should be able to extend our existing architecture to support adjusting 'settings' as well, but first we need to determine some rules around this and decide on the UI for how we want to display these options to a user.

What is your proposed solution?

The theme.json schema currently supports the following settings, which can be applied either at the root site level, or on each block:

"appearanceTools": boolean,
"useRootPaddingAwareAlignments": boolean,
"border": {
  "color": boolean,
  "radius": boolean,
  "style": boolean,
  "width": boolean
},
"color": {
  "background": boolean,
  "custom": boolean,
  "customDuotone": boolean,
  "customGradient": boolean,
  "defaultDuotone": boolean,
  "defaultGradients": boolean,
  "defaultPalette": boolean,
  "duotone": array,
  "gradients": array,
  "link": boolean,
  "palette": array,
  "text": boolean
},
"custom": object,
"layout": {
  "contentSize": string,
  "wideSize": string
},
"spacing": {
  "blockGap": boolean,
  "margin": boolean,
  "padding": boolean,
  "units": array
},
"typography": {
  "customFontSize": boolean,
  "dropCap": boolean,
  "fontFamilies": array,
  "fontSizes": array,
  "fontStyle": boolean,
  "fontWeight": boolean,
  "letterSpacing": boolean,
  "lineHeight": boolean,
  "textDecoration": boolean,
  "textTransform": boolean
},
"dimensions": {
  "aspectRatio": boolean,
  "minHeight": boolean
},
"shadow": {
  "defaultPresets": boolean,
  "presets": array
},
"position": {
  "sticky": boolean
},
"background": {
  "backgroundImage": boolean,
  "backgroundSize": boolean
}

More information on what is supported and what each property does can be found in the live JSON schema - here

Input types

The majority of settings are boolean values to set whether different options are enabled, and can use simple toggle controls. The array options such as color.palette are going to require a 'repeater' UI which will allow users to add/remove items as required, and the UI for the items themselves are generally going to more complex but we should be able to construct them using mostly core WordPress components.

Site vs block level settings

Whilst it's technically valid in the theme.json schema to include any of these settings on any block, some will have no effect depending on what each block supports. Since we're focusing on providing a UI for editing the theme.json, we could begin this feature by supporting everything that is valid in the schema, or make a general decision on what to omit across all blocks. This may still mean we show some things that aren't supported on specific blocks currently, but it's probably best for us to lean towards providing options for whatever the schema supports, providing the overall UI remains clear.

UI placement

Since settings can be applied to both the site or on blocks, it may make sense to show them alongside the menu options, e.g:
image

Alternatively, we could add navigation options in the styles panel, but this would require an additional click to reach the settings view for each item, e.g:
image

Whilst it may be beneficial to include certain settings in the styles panel, ie colour or spacing settings alongside the related styles options, there are also many settings which don't correspond to a style, and ideally all of the settings should be grouped together and displayed in a single area for clarity.

For the actual display of the settings UI, we could consider whether to open this in a modal view, or navigate the styles pane to another route, which would have the advantage of allowing the settings to be shown alongside the preview which may be useful, e.g:
image

Other considerations

Some site settings dictate whether certain UI should be shown to a user. For example, setting border.color to false would disable whether a user is able to set custom border colours within the UI. However, this is intended to apply at the editor level, not the theme level.

Having border.color set to false whilst also having a default border color configured in the theme.json is valid, therefore we shouldn't need to consider hiding any of our styling UI based on changes to settings attributes.

@g-elwell g-elwell added the enhancement New feature or request label Aug 15, 2024
@g-elwell g-elwell added this to the v1.1.0 milestone Aug 15, 2024
@chrishall0 chrishall0 self-assigned this Sep 25, 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

No branches or pull requests

2 participants