Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F996501
nice-box.jdd.tsx
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
nice-box.jdd.tsx
View Options
import
{
TempstreamJSX
}
from
"tempstream"
;
import
type
{
ComponentToHTMLArgs
,
ExtractStructuredComponentArgumentsParsed
,
JDDContext
,
}
from
"@sealcode/jdd"
;
import
{
Component
,
ComponentArguments
}
from
"@sealcode/jdd"
;
const
component_arguments
=
{
title
:
new
ComponentArguments
.
ShortText
(),
content
:
new
ComponentArguments
.
Markdown
(),
images
:
new
ComponentArguments
.
List
(
new
ComponentArguments
.
Structured
({
image
:
new
ComponentArguments
.
Image
(),
alt
:
new
ComponentArguments
.
ShortText
(),
})
),
}
as
const
;
export
class
NiceBox
extends
Component
<
typeof
component_arguments
>
{
getArguments
()
{
return
component_arguments
;
}
getTitle
(
_
:
JDDContext
,
args
:
ExtractStructuredComponentArgumentsParsed
<
typeof
component_arguments
>
)
{
return
args
.
title
||
null
;
}
async
toHTML
({
args
:
{
title
,
content
,
images
},
classes
,
jdd_context
:
{
render_markdown
,
render_image
,
language
},
index
,
}
:
ComponentToHTMLArgs
<
typeof
component_arguments
>
)
:
Promise
<
string
>
{
return
(
<
div
class
=
{[
"nice-box"
,
...
classes
]}
style
=
{
`--jdd-index:
${
index
}
`
}
>
<
h2
>
{
title
}
<
/h2>
<
div
>
{
render_markdown
(
language
,
content
)}
<
/div>
{
images
.
map
((
image
)
=>
render_image
(
image
.
image
,
{
container
:
{
width
:
200
,
height
:
200
,
objectFit
:
"contain"
,
},
alt
:
image
?
.
alt
||
""
,
})
)}
<
/div>
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Tue, Dec 24, 14:04 (12 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557289
Default Alt Text
nice-box.jdd.tsx (1 KB)
Attached To
Mode
rREWRITE Configurable rewriter
Attached
Detach File
Event Timeline
Log In to Comment