Skip to content

Support customization "Custom styles" without cloning the repoΒ #411

@gasparnagy

Description

@gasparnagy

πŸ€” What's the problem you're trying to solve?

With #409 we have introduced providing custom additional CSS and Javascript.

The custom CSS is great for "theming" and it works. πŸŽ‰

Changing the style of a particular kind of component (described as "Custom styles
"
at react-components) however is not possible with custom css, because there are generated CSS class names on the elements.

The example in react-components shows a solution using the <CustomRendering> object, but for that one would need to setup a clone of this repo and make an custom node.js app to generate the source.

In this particular case, the object provided for the <CustomRendering> override is a plain Javascript object:

{
  DocString: {
    docString: 'acme-docstring'
  }
}

So we could allow somehow to specify this as a customization.

✨ What's your proposed solution?

We haven't found one obvious solution, so more input is needed. (@davidjgoss ?)

What we considered:

  1. Somehow make it customizable through the mustache template: have a template placeholder {{rendering_override}} (?) that is by default initialized with empty string or empty json object and either always have the <CustomRendering> wrapper or somehow make the main.tsx decide if the wrapper is needed.
  2. Make it customizable in a custom script block. E.g. if a custom script block sets window.customRenderingOverride then we wrap the code with <CustomRendering> and use it.

It is not directly related to this, but it would be useful if the React root object and the loaded cucumber react-component namespace would be available in the window object, so that custom scripts can access it.

⛏ Have you considered any alternatives or workarounds?

The alternative is to clone the javascript folder of this repo as an own node.js project and replicate the webpack build process. This would work, but seems to be an overkill for a simple styling (and makes it harder to adopt changes from this repo, e.g. when styles.scss changes).

πŸ“š Any additional context?

I try to capture our discussion with @mpkorstanje today in this issue, so that we don't forget.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions