Migrate ordered-blocks from old website

Summary: Ref T2921

Reviewers: #testers, kuba-orlik

Reviewed By: #testers, kuba-orlik

Subscribers: kuba-orlik, jenkins-user

Maniphest Tasks: T2921

Differential Revision: https://hub.sealcode.org/D1615
This commit is contained in:
PrzZiomek2 2025-10-30 22:41:19 +01:00
parent 7fcde70b4e
commit 212dd9909a
3 changed files with 283 additions and 0 deletions

View File

@ -0,0 +1,184 @@
.ordered-blocks {
padding-bottom: 96px;
position: relative;
}
.ordered-blocks ol {
list-style-type: none;
padding: 0;
}
.ordered-blocks__body {
margin: 0 auto;
position: relative;
z-index: 2;
}
.ordered-blocks__article-list {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(36ch, 1fr));
padding: 0 24px;
}
.ordered-blocks__buttons {
display: flex;
align-items: center;
justify-content: center;
gap: 24px;
}
.ordered-blocks__button-wrapper {
text-align: center;
}
@container (max-width: 400px) {
.ordered-blocks__article-list {
display: block;
max-width: 100%;
padding: 0;
margin: auto;
}
}
.ordered-blocks .article-list-item {
background-color: var(--main);
padding: 0 24px;
padding-top: 24px;
}
.ordered-blocks .article-list-item__number {
display: block;
font-family: var(--font-sans-serif);
font-feature-settings: "tnum";
font-weight: 800;
font-size: 24px;
line-height: 24px;
padding-bottom: calc(12px - 1px);
border-bottom: 1px solid #000000;
margin-bottom: 12px;
}
.ordered-blocks .article-list-item__image {
padding-bottom: calc(24px - 1px);
border-bottom: 1px solid #000000;
margin-bottom: 12px;
}
.ordered-blocks .article-list-item__image img {
height: 60px;
}
.ordered-blocks .article-list-item--above .article-list-item__image {
border: none;
padding: 0;
margin: 0;
}
.ordered-blocks .article-list-item h3 {
font-size: 20px;
line-height: 24px;
font-family: var(--font-slab-serif);
font-weight: 400;
}
.ordered-blocks .article-list-item p {
font-family: var(--font-sans-serif);
font-size: 15px;
padding-top: 24px;
}
.ordered-blocks .article-list-item--above .header {
display: flex;
flex-flow: row;
padding-bottom: calc(9.6px - 1px);
border-bottom: 1px solid #000000;
margin-bottom: 12px;
align-items: center;
}
.ordered-blocks .article-list-item--purple .article-list-item__image {
border-color: hsl(287.3, 13.1%, 50.8%);
}
.ordered-blocks .article-list-item--above .article-list-item__number {
padding-bottom: 0;
border-bottom: none;
margin-bottom: 0;
}
.ordered-blocks .article-list-item--above p {
padding-top: 0;
}
@media (max-width: 460px) {
.ordered-blocks .article-list-item--above .article-list-item__number {
display: block;
padding-left: 0;
border-bottom: 1px solid #000000;
padding-bottom: calc(12px - 1px);
margin-bottom: 12px;
}
.ordered-blocks .article-list-item--above .header {
display: block;
border: none;
}
.ordered-blocks .article-list-item--above .header h3 {
margin-left: 0;
padding-top: 0;
}
}
.ordered-blocks .article-list-item--purple .header {
border-color: hsl(287.3, 13.1%, 50.8%);
}
.ordered-blocks .article-list-item--purple .article-list-item__number {
color: var(--main-bg-text);
border-color: hsl(287.3, 13.1%, 50.8%);
}
.ordered-blocks .article-list-item--purple h3 {
color: var(--main-bg-text);
}
.ordered-blocks .article-list-item--purple p {
color: hsl(286.4, 15.5%, 83.2%);
}
.ordered-blocks .article-list-item--wild-sand {
background: none;
}
.ordered-blocks .article-list-item--wild-sand .header {
border-color: var(--alto-gray);
}
.ordered-blocks .article-list-item--wild-sand .article-list-item__number {
color: var(--secondary-dark-01);
border-color: var(--alto-gray);
}
.ordered-blocks .article-list-item--wild-sand .article-list-item__image {
border-color: var(--alto-gray);
}
.ordered-blocks .article-list-item--wild-sand h3 {
color: var(--wild-sand-bg-text);
}
.ordered-blocks .article-list-item--above .header h3 {
padding-top: 2.4px;
margin-left: 12px;
}
.ordered-blocks .article-list-item--wild-sand p {
color: var(--dove-gray);
}
.ordered-blocks .article-list-item .button {
margin: 6px auto;
display: block;
}

View File

@ -0,0 +1,96 @@
import type { FlatTemplatable } from "tempstream";
import { TempstreamJSX } from "tempstream";
import type { ComponentToHTMLArgs } from "@sealcode/jdd";
import { Component, ComponentArguments } from "@sealcode/jdd";
import { button } from "../../elements/button.js";
const component_arguments = {
list_items: new ComponentArguments.List(
new ComponentArguments.Structured({
name: new ComponentArguments.ShortText(),
description: new ComponentArguments.Markdown(),
btn_config: new ComponentArguments.Structured({
text: new ComponentArguments.ShortText(),
href: new ComponentArguments.ShortText(),
}),
})
),
btn_config: new ComponentArguments.Structured({
text: new ComponentArguments.ShortText(),
href: new ComponentArguments.ShortText(),
}),
btn2_config: new ComponentArguments.Structured({
text: new ComponentArguments.ShortText(),
href: new ComponentArguments.ShortText(),
}),
header_mode: new ComponentArguments.Enum(["below", "above"]),
starting_index: new ComponentArguments.ShortText().setExampleValues(["1"]),
} as const;
export class OrderedBlocks extends Component<typeof component_arguments> {
getArguments() {
return component_arguments;
}
toHTML({
args: { list_items, btn2_config, btn_config, header_mode, starting_index },
jdd_context: { render_markdown, language },
classes,
}: ComponentToHTMLArgs<typeof component_arguments>): FlatTemplatable {
return (
<section class={["ordered-blocks", ...classes]}>
<div class="ordered-blocks__body">
<ol class="ordered-blocks__article-list">
{list_items.map(({ name, description, btn_config }, index) => {
const number = String(
index + parseInt(starting_index)
).padStart(2, "0");
return (
<li
key={index}
class={`article-list-item article-list-item--wild-sand article-list-item--${header_mode}`}
>
<div class="header">
<span class="article-list-item__number">
{number}
</span>
<h3>{name || ""}</h3>
</div>
{render_markdown(language, description)}
{btn_config.text && btn_config.href
? button({
text: btn_config.text,
href: btn_config.href,
variant: "accent1",
})
: null}
</li>
);
})}
</ol>
<div class="ordered-blocks__buttons">
{btn_config.text && btn_config.href ? (
<div class="ordered-blocks__button-wrapper">
{button({
text: btn_config.text,
href: btn_config.href,
variant: "accent1",
})}
</div>
) : null}
{btn2_config.text && btn2_config.href ? (
<div class="ordered-blocks__button-wrapper">
{button({
text: btn2_config.text,
href: btn2_config.href,
variant: "accent1",
})}
</div>
) : null}
</div>
</div>
</section>
);
}
}

View File

@ -49,6 +49,9 @@ application.register("submit-on-input", SubmitOnInput);
import { default as Toast } from "./../../node_modules/@sealcode/jdd-editor/src/controllers/toast.stimulus.js";
application.register("toast", Toast);
import { default as PasswordGenerateButton } from "./../../node_modules/@sealcode/sealgen/src/controllers/password-generate-button.stimulus.js";
application.register("password-generate-button", PasswordGenerateButton);
import { default as Monaco } from "./../../node_modules/@sealcode/monaco-wrapper/src/controllers/monaco.stimulus.js";
application.register("monaco", Monaco);