diff --git a/src/back/jdd-components/ordered-blocks/ordered-blocks.css b/src/back/jdd-components/ordered-blocks/ordered-blocks.css new file mode 100644 index 0000000..6e82ad3 --- /dev/null +++ b/src/back/jdd-components/ordered-blocks/ordered-blocks.css @@ -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; +} \ No newline at end of file diff --git a/src/back/jdd-components/ordered-blocks/ordered-blocks.jdd.tsx b/src/back/jdd-components/ordered-blocks/ordered-blocks.jdd.tsx new file mode 100644 index 0000000..c9cb49a --- /dev/null +++ b/src/back/jdd-components/ordered-blocks/ordered-blocks.jdd.tsx @@ -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 { + getArguments() { + return component_arguments; + } + + toHTML({ + args: { list_items, btn2_config, btn_config, header_mode, starting_index }, + jdd_context: { render_markdown, language }, + classes, + }: ComponentToHTMLArgs): FlatTemplatable { + return ( +
+
+
    + {list_items.map(({ name, description, btn_config }, index) => { + const number = String( + index + parseInt(starting_index) + ).padStart(2, "0"); + + return ( +
  1. +
    + + {number} + +

    {name || ""}

    +
    + {render_markdown(language, description)} + {btn_config.text && btn_config.href + ? button({ + text: btn_config.text, + href: btn_config.href, + variant: "accent1", + }) + : null} +
  2. + ); + })} +
+
+ {btn_config.text && btn_config.href ? ( +
+ {button({ + text: btn_config.text, + href: btn_config.href, + variant: "accent1", + })} +
+ ) : null} + {btn2_config.text && btn2_config.href ? ( +
+ {button({ + text: btn2_config.text, + href: btn2_config.href, + variant: "accent1", + })} +
+ ) : null} +
+
+
+ ); + } +} diff --git a/src/front/controllers.ts b/src/front/controllers.ts index 11519b8..3bb7af3 100644 --- a/src/front/controllers.ts +++ b/src/front/controllers.ts @@ -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);