ngx-skeleton-loader icon indicating copy to clipboard operation
ngx-skeleton-loader copied to clipboard

Component theme should not replace forRoot theme

Open tek-moglykisvergad opened this issue 3 years ago • 0 comments

I'm submitting a ... (check one with "x")

  • [ ] bug report => search github for a similar issue or PR before submitting
  • [x] feature request

Current behavior

If a theme is specified in forRoot, it will be completely overridden by a component's theme.

For example:

Module:

imports: [
  ...
  NgxSkeletonLoaderModule.forRoot({ theme: { 'background-color': '#ff0000', opacity: '0.9' } }),
  ...
],

Component's html:

  <ngx-skeleton-loader
    [theme]="{ 
      'border-radius': '5px',
      height: '50px',
      opacity: '0.5'
      border: '1px solid white'
    }"
  ></ngx-skeleton-loader>

In this case, background-color would be removed, despite the component's theme not containing a value for it.

Expected behavior

The theme defined in forRoot should not be replaced completely by the component's theme.

In the example above, I would expect opacity to be overridden, but background-color to be preserved.

Reproduction of the problem

What is the motivation / use case for changing the behavior?

This would be valuable in cases where we want to define properties that should be applied for each component, while also allowing a component to specify its own properties.

Please tell us about your environment:

  • Browser: all

  • Language: all

  • Node (if applicable): node --version = 16.13.0

tek-moglykisvergad avatar Dec 16 '21 19:12 tek-moglykisvergad