mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-21 11:15:36 -05:00
add showlace extra style dynamically
This commit is contained in:
@@ -110,6 +110,28 @@ class link(TextElementBase):
|
||||
)
|
||||
|
||||
|
||||
class style(TextElementBase):
|
||||
tag = "style"
|
||||
|
||||
blocking = js_property("blocking")
|
||||
title = js_property("title")
|
||||
nonce = js_property("nonce")
|
||||
media = js_property("media")
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
content=None,
|
||||
blocking=None,
|
||||
title=None,
|
||||
nonce=None,
|
||||
media=None,
|
||||
style=None,
|
||||
**kwargs
|
||||
):
|
||||
super().__init__(content=content, blocking=blocking, title=title,
|
||||
nonce=nonce, media=media, style=style, **kwargs
|
||||
)
|
||||
|
||||
class script(TextElementBase):
|
||||
tag = "script"
|
||||
|
||||
|
||||
@@ -375,8 +375,21 @@ class Icon(ShoeBase):
|
||||
|
||||
|
||||
# Load resources...
|
||||
# <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.12.0/cdn/themes/light.css" />
|
||||
# <script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.12.0/cdn/shoelace-autoloader.js"></script>
|
||||
CSS = """
|
||||
.card-overview {
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
.card-overview small {
|
||||
color: var(--sl-color-neutral-500);
|
||||
}
|
||||
|
||||
.card-overview [slot='footer'] {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
"""
|
||||
def load_resources(parent=None):
|
||||
print("Loading shoelace resources...")
|
||||
if parent is None:
|
||||
@@ -393,4 +406,5 @@ def load_resources(parent=None):
|
||||
type="module",
|
||||
),
|
||||
)
|
||||
parent.append(el.style(CSS))
|
||||
print("Resources loaded!")
|
||||
|
||||
Reference in New Issue
Block a user