unlcms / project-herbie

Drupal 10 implementation at the University of Nebraska–Lincoln
https://cms.unl.edu
GNU General Public License v2.0
5 stars 6 forks source link

Extend DCF Layouts to account for dark backgrounds and to add margin between blocks #110

Closed macburgee1 closed 4 years ago

macburgee1 commented 4 years ago

Section title should be displayed in inverse on dark backgrounds Add default margin between blocks in each column Add section setting to override default margin in each column

macburgee1 commented 4 years ago

DCF layouts are provided by the dcf_layouts module. DCF classes are provided by the dcf_classes module. The margin between blocks is something that'll be added dcf_layouts.

The inverse behavior is trickier. There are two ways to tackle that:

  1. Override the layout templates in unl_five_herbie
  2. Extend the dcf_classes module to include classes which should trigger inverse behavior. Then in dcf_layouts, apply the 'dcf-inverse' class accordingly in individual template files.

I'm leaning toward option 2

ericras commented 4 years ago

I think we want something like #2 but I was thinking about it in slightly different terms:

Instead of configuring a set of classes that trigger the inverse behavior, my thought is that .dcf-inverse triggers the behavior. Assigning it as one of the section classes (or within a package) puts it on the wrapper (which doesn't do anything other than change the

text color) but also triggers the application of it to the child elements.

I don't think we need to define that .dcf-bg-scarlet and .dcf-bg-gray etc trigger the behavior because in those cases you would be picking .dcf-inverse from the list too.

macburgee1 commented 4 years ago

When I add dcf-inverse to the section (alongside unl-bg-scarlet), paragraph text changes to white, but <h2> elements are unchanged. And if I recall correctly, that may be by design. Or are you suggesting we check for the dcf-inverse class at the section level when rendering the section's <h2>, and add the class to the <h2> if it's present at the section level?

ericras commented 4 years ago

Yes the later. Check for dcf-inverse at the section level and then apply it to h2 within that section.

macburgee1 commented 4 years ago

Currently, the DCF margin classes, which can be used to designate the amount of vertical margin between blocks in the same region, are hard-coded. Would there be a benefit in moving them to config?

ericras commented 4 years ago

They could be but maybe this is something that falls under, "not everything needs to be configurable, we can have some fixed defaults." I would lean toward the later.

macburgee1 commented 4 years ago

I've made the suggested change. Section and title attributes are now initialized at the beginning of the build method. Before the change, the behavior is as described (i.e. inverse class is not applied to title). After the change, the behavior is corrected (i.e. inverse class is applied to title).