Skip to content
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

Feature Request: add css classes to renderer so that they can be styled #8

Open
RezaRahmati opened this issue Apr 29, 2021 · 2 comments

Comments

@RezaRahmati
Copy link

RezaRahmati commented Apr 29, 2021

Hi

Thank you for your component, it save hours and hours .

I have a feature request right now if I need to change the style for example setting line height or add margin or ... there is no way except adding new custom components, while if you could add some classes to the components they could have been styled by css without adding custom components

update

Actually I am able to style it like this, but having classes are more intuitive

ngx-contentful-rich-text {
  line-height: 1.75rem;
  font-size: 1.1rem;

  h5,
  .h5 {
    ngx-contentful-rich-text {
      font-size: 1.5rem;
      font-weight: 500;
    }

    margin-top: 3rem;
    margin-bottom: 1rem;
  }

  p {
    text-align: justify;
  }
}

@guillaume-moreau
Copy link

Hi !

I had the same issue.

I've created a PR for this issue.

@vitorpiovezam
Copy link

vitorpiovezam commented Mar 14, 2022

I could style the document using encapsulation: ViewEncapsulation.None, on my @Component decorators.
Now styles runs like as an ng-deep.
`
@component({
selector: 'mynt-contentful-article',
template: '

<ngx-contentful-rich-text [document]="document">
<ngx-contentful-rich-text [document]="extraDocument">

',
encapsulation: ViewEncapsulation.None,

styles: ['
ngx-contentful-rich-text {
line-height: 1.75rem;
font-size: 1.1rem;
margin-top: 2em;

h1 {
    font-family: Moderat;
    font-size: 32px;
    line-height: 125%;
    color: #F8FDFF;
}

p {
  margin: 20px 0;
}

a {
    color: #5a9dff;
    font-weight: bold;
}

a:hover {
text-decoration: underline;
}
}

']
})
export class FooContentfulArticleComponent { }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants