catalog icon indicating copy to clipboard operation
catalog copied to clipboard

Add a way to set custom css classes

Open equinusocio opened this issue 7 years ago • 7 comments

Hi, since we ca set a custom css it could be useful having a way to set custom css classes to each speciment and use our CSS.

Something like

```html|class-MyClass

And

```html
class: "MyClass"

equinusocio avatar Jan 29 '18 17:01 equinusocio

Can you describe the exact need for this? To which element would this class be applied?

jstcki avatar Jan 29 '18 19:01 jstcki

Whit a custom css class we can target elements easily because now 80% are inline style or classnames generated with CSS modules or something similar. The custom class should be applied to the speciment outer container. Right now we have to do this to customise some speciment:

  .rmq-270de115 + div {
    border-left: 1px solid rgb(238, 238, 238);
  }

equinusocio avatar Jan 30 '18 13:01 equinusocio

Okay, that makes sense.

We'll change the styling approach anyway in the next few months (replace Radium with something else) …

So I wonder if making customizations like this is something we should support better. For example by exposing a way to override styles through the theme configuration itself or by adding readable and stable class names to all elements, so they can be targeted directly with CSS.

jstcki avatar Jan 30 '18 14:01 jstcki

What about using css custom properties? You can expose specimens css properties that uses the css power.

.SpecimentRoot {
  --specimentName-background: var(--catalog-specimentname-background, #FFF);
}

.SpecimentInnerElement {
  background-color: var(--specimentName-background);
}

You will expose just the decoupled "api" --catalog-specimentname-background

equinusocio avatar Jan 30 '18 14:01 equinusocio

Yes, that would also be a good option. But currently we're still supporting IE11, and custom properties don't work there.

jstcki avatar Jan 30 '18 14:01 jstcki

You can transpile the custom properties. You will lose the runtime editing, but is not needed at all.

equinusocio avatar Jan 30 '18 14:01 equinusocio

YES!!! Please support custom classes, this would be a huge help when trying to customize for our brand and styling.

dlewand691 avatar Aug 23 '18 12:08 dlewand691