-
Notifications
You must be signed in to change notification settings - Fork 355
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
Add style fields to theme modules #358
Conversation
|
||
.card { | ||
{% if module.styles.card.background.background_type == "color" && module.styles.card.background.color.color %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we support .css
on color field?
I may be remembering wrong. Your code though would still function just fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I'm aware of. I've generally been following this doc for where the .css
property is supported and I tried following the original PR. We do have the .css
for gradient. I'm happy to update if .css
is available for the color field. That would be nice to keep the code a bit shorter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read through all of the code, it all looked good and made sense. I didn't see any issues.
I have not tested the changes in my own account. Given the amount of CSS and HTML changes to support the new fields. I think it's worth myself or someone else testing the branch in their account first. I will try to spend some time to test this tomorrow.
Thanks for checking this out Jon! Here is an example page if you wanted a quick reference to the editor. Please excuse my beautiful choice of test styles 😆 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested in Chrome, Firefox, and Safari. Looked good.
Did notice an issue completely unrelated to the stylefields change.
The menu module when used outside of the header - because it's closer to the left side of the page, the dropdown gets cut off.
This is unlikely to happen in real sites often, but an easy solution is to add a :first-child
selector and transform:unset;
You will need to also move the :before
so that it lines up better with the first <li>
Is there a way to set a style when adding a module to a template? How would you modify this to make the text color white? {% dnd_module path='@hubspot/header', header_tag='h1', value='title', horizontal_alignment="CENTER" %}{% end_dnd_module %} |
Hi @JacobLett, this update adds style fields to the modules in the boilerplate. You set style field values at the template level very similarly to content fields, more on this can be found at: Right now default modules do not yet use style fields. So you would need to use CSS or a custom module instead and add a style field. When modules use style fields you'll notice a field group in the fields.json or in the Design Manager fields listed as "Styles". |
|
Types of change
Description
This pull request implements the new style fields feature on the boilerplate's modules. The style fields feature allows developers to add style related fields in the "style" tab of a module.
Best practices
Changelog
Sign up to participate in the style fields beta
Notes
We're currently omitting adding style fields to the menu as we are aiming to do a larger rebuild in the near future that will include some accessibility improvements.
Checklist
People to notify
CC: @TheWebTech