mirror of
https://github.com/django-components/django-components.git
synced 2025-09-26 07:29:09 +00:00
refactor: Use top-level exports as public API (#562)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
d819f3ff49
commit
e771a0aaaf
30 changed files with 615 additions and 598 deletions
|
@ -15,12 +15,14 @@
|
|||
|
||||
And components that make use of `abc.html` via `include` or `extends`:
|
||||
```py
|
||||
@component.register("my_comp_extends")
|
||||
class MyCompWithExtends(component.Component):
|
||||
from django_components import Component, register
|
||||
|
||||
@register("my_comp_extends")
|
||||
class MyCompWithExtends(Component):
|
||||
template = """{% extends "abc.html" %}"""
|
||||
|
||||
@component.register("my_comp_include")
|
||||
class MyCompWithInclude(component.Component):
|
||||
@register("my_comp_include")
|
||||
class MyCompWithInclude(Component):
|
||||
template = """{% include "abc.html" %}"""
|
||||
```
|
||||
|
||||
|
@ -61,8 +63,8 @@
|
|||
and component `my_comp`:
|
||||
|
||||
```py
|
||||
@component.register("my_comp")
|
||||
class MyComp(component.Component):
|
||||
@register("my_comp")
|
||||
class MyComp(Component):
|
||||
template_name = "abc.html"
|
||||
```
|
||||
|
||||
|
@ -108,8 +110,8 @@
|
|||
`abc.html` will render `OVERRIDEN`:
|
||||
|
||||
````py
|
||||
@component.register("my_comp")
|
||||
class MyComp(component.Component):
|
||||
@register("my_comp")
|
||||
class MyComp(Component):
|
||||
template_name = """
|
||||
{% extends "abc.html" %}
|
||||
|
||||
|
@ -125,8 +127,8 @@
|
|||
new `slots` inside these "overriding" blocks:
|
||||
|
||||
```py
|
||||
@component.register("my_comp")
|
||||
class MyComp(component.Component):
|
||||
@register("my_comp")
|
||||
class MyComp(Component):
|
||||
template_name = """
|
||||
{% extends "abc.html" %}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue