diff --git a/other/custom-elements/TODO.txt b/other/custom-elements/TODO.txt new file mode 100644 index 000000000..bd9a4b67a --- /dev/null +++ b/other/custom-elements/TODO.txt @@ -0,0 +1,2 @@ +TODO: !!! [🧠] `Custom elements` vs `Custom components` vs `Custom html elements` vs `Custom html components` vs `WebGPT components` +TODO: !!! Move this folder to src/?/ \ No newline at end of file diff --git a/other/custom-elements/samples/call-to-action.html b/other/custom-elements/samples/call-to-action.html new file mode 100644 index 000000000..859b45e7a --- /dev/null +++ b/other/custom-elements/samples/call-to-action.html @@ -0,0 +1,61 @@ +ddd Buy 0 sss + + + diff --git a/other/custom-elements/samples/pricing-table.html b/other/custom-elements/samples/pricing-table.html new file mode 100644 index 000000000..a3679235b --- /dev/null +++ b/other/custom-elements/samples/pricing-table.html @@ -0,0 +1,74 @@ + + + Feature 1 + Feature 2 + Feature 3 + Feature 4 + + + Feature 1 + Feature 2 + Feature 3 + Feature 4 + + + Feature 1 + Feature 2 + Feature 3 + Feature 4 + + + Feature 1 + Feature 2 + Feature 3 + Feature 4 + + + + + diff --git a/promptbook/write-website-content-cs.ptbk.md b/promptbook/write-website-content-cs.ptbk.md index a2859a8f0..412a20d81 100644 --- a/promptbook/write-website-content-cs.ptbk.md +++ b/promptbook/write-website-content-cs.ptbk.md @@ -1,9 +1,13 @@ # 🌍 Vytvoření obsahu webové stránky + + + + Instrukce pro vytvoření obsahu webové stránky za pomocí [🌠 Prompt template pipelines](https://github.com/webgptorg/promptbook). - PTBK URL https://ptbk.webgpt.com/cs/write-website-content.ptbk.md@v0.1.0 -- PTBK version 0.0.1 +- PTBK version 0.0.2 - Use chat - Input param `{idea}` Obecná idea webu _v Češtině_ @@ -320,6 +324,15 @@ Zadání webu od zákazníka: - Použijte klíčová slova, avšak ta mají být přirozeně v textu - Jedná se o kompletní obsah stránky, tedy nezapomeňte na všechny důležité informace a prvky, co by měla stránka obsahovat - Použijte nadpisy, odrážky, formátování textu +- Použijte speciální komponenty, viz níže + +## Komponenty + +### Call to action + +\`\`\`markdown +🛒 Koupit +\`\`\` ## Klíčová slova: diff --git a/promptbook/write-website-content.ptbk.md b/promptbook/write-website-content.ptbk.md index 998be7cc9..9781ead5e 100644 --- a/promptbook/write-website-content.ptbk.md +++ b/promptbook/write-website-content.ptbk.md @@ -1,5 +1,8 @@ # 🌍 Creating website content + + + Instructions for creating web page content using [🌠 Prompt template pipelines](https://github.com/webgptorg/promptbook). - PTBK URL https://ptbk.webgpt.com/cs/write-website-content.ptbk.md@v0.1.0 diff --git a/src/components/Content/HtmlContent.tsx b/src/components/Content/HtmlContent.tsx index 598b6994d..f59e0a3c6 100644 --- a/src/components/Content/HtmlContent.tsx +++ b/src/components/Content/HtmlContent.tsx @@ -81,7 +81,11 @@ function HtmlContentEditable(props: Omit) { return; } - if (element.dataset.contentState === 'react-render' || element !== document.activeElement) { + if ( + element.dataset.contentState === 'react-render' || + element !== document.activeElement + // __________________________ <- TODO: !!! [🧠] Also fill content when navigating back to page with content + ) { element.innerHTML = content /* <- Here [3] */; element.dataset.contentState = 'filled'; } diff --git a/src/components/WallpaperContent/WallpaperContent.tsx b/src/components/WallpaperContent/WallpaperContent.tsx index c2e2772cd..e491ec0cf 100644 --- a/src/components/WallpaperContent/WallpaperContent.tsx +++ b/src/components/WallpaperContent/WallpaperContent.tsx @@ -12,6 +12,7 @@ import { Content } from '../Content/Content'; import { MaxdownContent } from '../Content/Maxdown/MaxdownContent'; import { ExportCommentedBlock } from '../ExportComment/ExportCommentedBlock'; import { addFontToContent } from '../ImportFonts/addFontToContent'; +import { InlineScript } from '../InlineScript/InlineScript'; import { Section } from '../Section/Section'; import { getPageContent } from './getPageContent'; import styles from './WallpaperContent.module.css'; @@ -121,6 +122,42 @@ export function WallpaperContentSection() { + + for custom html components + > + {` + + class CallToAction extends HTMLAnchorElement { + constructor() { + super(); + + + console.info('!!! CallToAction.constructor'); + } + + connectedCallback() { + + // TODO: !!! This must work + console.info('Connected to component'); + + + + this.addEventListener('click', () => { + + // TODO: !!! This must work + console.info('Clicked on component'); + }); + } + } + + + console.info('🌟 Defining component'); + customElements.define('call-to-action', CallToAction, { extends: 'a' }); + + `} + ); } diff --git a/src/styles/globals.css b/src/styles/globals.css index b3f84f1cb..6a24aee71 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -38,6 +38,23 @@ a.button { text-decoration: none !important; } +call-to-action { + /* + TODO: !!! This should be part of component OR better organized + TODO: Always align to the middle + */ + border: solid 1px rgba(var(--palette-1-triplet), 0.8); + background-color: rgba(var(--palette-2-triplet), 0.8); + color: rgba(var(--palette-1-triplet), 0.8); + border-radius: 6px; + padding: 7px 18px; + margin: 10px; + cursor: pointer; + display: inline-block; + text-decoration: none; + transition: all 0.2s ease-in-out; +} + .emoji { display: inline !important; width: 1.8em;