Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22406831
custom-css-wrapper.jdd.tsx
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
983 B
Referenced Files
None
Subscribers
None
custom-css-wrapper.jdd.tsx
View Options
import
{
TempstreamJSX
}
from
"tempstream"
;
import
type
{
ComponentToHTMLArgs
}
from
"@sealcode/jdd"
;
import
{
Component
,
ComponentArguments
}
from
"@sealcode/jdd"
;
import
{
v4
as
uuid
}
from
"uuid"
;
const
component_arguments
=
{
custom_css
:
new
ComponentArguments
.
ShortText
(),
content
:
new
ComponentArguments
.
NestedComponent
(),
}
as
const
;
export
class
CustomCssWrapper
extends
Component
<
typeof
component_arguments
>
{
getArguments
()
{
return
component_arguments
;
}
async
toHTML
({
args
:
{
custom_css
,
content
},
classes
,
jdd_context
,
}
:
ComponentToHTMLArgs
<
typeof
component_arguments
>
)
:
Promise
<
string
>
{
const
unique_class
=
`css-wrapper--
${
uuid
()
}
`
;
return
(
<
div
class
=
{[
"custom-css-wrapper"
,
unique_class
,
...
classes
]}
>
{
/* HTML */
`<style>
.
${
unique_class
}
{
${
custom_css
}
}
</style>`
}
{
ComponentArguments
.
NestedComponent
.
render
({
jdd_context
,
data
:
content
as
Record
<
string
,
unknown
>
,
})}
<
/div>
);
}
}
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, Nov 27, 20:22 (3 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1227298
Default Alt Text
custom-css-wrapper.jdd.tsx (983 B)
Attached To
Mode
rAPROXY Assetproxy
Attached
Detach File
Event Timeline