Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork100
Open
Description
I'm trying to pass variables from the component to my CSS, but I'm not receiving the values. Am I doing something wrong, or is this a bug? I've tried changing the variable name and other solutions, but nothing works. At first, I thought this would only work if the CSS was in a separate file, but the documentation has examples of using this function with embedded CSS.
Code:
@register(f"{app_name}:detalhe_conteudo")classConteudoDetalhe(Component):template:types.django_html=""" {% load component_tags %} <div> <div> {% component "portal:card_conteudo_detalhe" conteudo=conteudo %} {% endcomponent %} </div> <div> <h1>{{ conteudo.titulo_brasil }}</h1> <p><strong>Título Original:</strong> {{ conteudo.titulo_original }}</p> {% if not TIPO_LIVRO and not TIPO_CANAL_TV %} <p><strong>Data de Lançamento:</strong> {{ conteudo.data_lancamento }}</p> <p><strong>Classificação Indicativa:</strong> {{ conteudo.classificacao_indicativa|default:"N/A" }}</p> {% endif %} <p><strong>Gêneros:</strong> {% for genero in conteudo.generos.all %} <a href="{% url urlname_conteudos_por_genero pk=genero.pk %}"> #{{ genero.nome }} </a> {% if not forloop.last %}|{% endif %} {% empty %} N/A {% endfor %} </p> <p><strong>Sinopse:</strong> {{ conteudo.sinopse }}</p> </div> </div> {% slot "extras" required / %} """css:types.css=""" main { background: linear-gradient( to bottom, var(--corhex) 0%, rgba(14, 14, 14, 0.8) 60%, rgba(14, 14, 14, 1) 100% ); } @media (max-width: 575.98px) { .col-card-conteudo-detalhe { width: 200px; } } """defget_template_data(self,args:Any,kwargs:Any,slots:Any,context:Context )->Mapping:conteudo=kwargs["conteudo"]urlname_conteudos_por_genero=conteudo.url_portal.urlname_conteudos_por_generoreturn {"conteudo":conteudo,"TIPO_LIVRO":isinstance(conteudo,Livro),"TIPO_CANAL_TV":isinstance(conteudo,CanalTV),"urlname_conteudos_por_genero":urlname_conteudos_por_genero, }defget_css_data(self,args:Any,kwargs:Any,slots:Any,context:Context )->Mapping:conteudo=kwargs["conteudo"]return {"corhex":conteudo.cor_dominante_hex}
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status