From 64a1045101a53547a4046a24a5b265108908925b Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Tue, 28 Nov 2023 12:53:29 +0100 Subject: [PATCH 01/15] Branch custom-html-components From 8de14331d888558894375a7d2d44f543bc981cd4 Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Tue, 28 Nov 2023 13:29:48 +0100 Subject: [PATCH 02/15] Define custom element --- promptbook/write-website-content-cs.ptbk.md | 15 +++++++- promptbook/write-website-content.ptbk.md | 3 ++ .../WallpaperContent/WallpaperContent.tsx | 34 +++++++++++++++++++ src/styles/globals.css | 17 ++++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) 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/WallpaperContent/WallpaperContent.tsx b/src/components/WallpaperContent/WallpaperContent.tsx index c2e2772cd..6609cff30 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,39 @@ export function WallpaperContentSection() { + + for custom html components + > + {` + + class CallToAction extends HTMLAnchorElement { + constructor() { + super(); + } + + 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; From eef164a664876cbc5a3c16bd6a51917d2db3f29d Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Tue, 28 Nov 2023 13:41:07 +0100 Subject: [PATCH 03/15] Sandbox for custom components --- other/custom-elements/TODO.txt | 2 + .../samples/call-to-action.html | 47 +++++++++++++++++++ .../WallpaperContent/WallpaperContent.tsx | 3 ++ 3 files changed, 52 insertions(+) create mode 100644 other/custom-elements/TODO.txt create mode 100644 other/custom-elements/samples/call-to-action.html 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..334294569 --- /dev/null +++ b/other/custom-elements/samples/call-to-action.html @@ -0,0 +1,47 @@ +Buy 0 + + + + +Buy 1 diff --git a/src/components/WallpaperContent/WallpaperContent.tsx b/src/components/WallpaperContent/WallpaperContent.tsx index 6609cff30..e491ec0cf 100644 --- a/src/components/WallpaperContent/WallpaperContent.tsx +++ b/src/components/WallpaperContent/WallpaperContent.tsx @@ -132,6 +132,9 @@ export function WallpaperContentSection() { class CallToAction extends HTMLAnchorElement { constructor() { super(); + + + console.info('!!! CallToAction.constructor'); } connectedCallback() { From ff478c37d8471659617f4b4dd1daaa530f475f28 Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Tue, 28 Nov 2023 23:04:33 +0100 Subject: [PATCH 04/15] Using shadow root in --- .../samples/call-to-action.html | 52 ++++++++------ .../samples/pricing-table.html | 68 +++++++++++++++++++ 2 files changed, 101 insertions(+), 19 deletions(-) create mode 100644 other/custom-elements/samples/pricing-table.html diff --git a/other/custom-elements/samples/call-to-action.html b/other/custom-elements/samples/call-to-action.html index 334294569..859b45e7a 100644 --- a/other/custom-elements/samples/call-to-action.html +++ b/other/custom-elements/samples/call-to-action.html @@ -1,8 +1,8 @@ -Buy 0 +ddd Buy 0 sss - -Buy 1 diff --git a/other/custom-elements/samples/pricing-table.html b/other/custom-elements/samples/pricing-table.html new file mode 100644 index 000000000..0ce832ae2 --- /dev/null +++ b/other/custom-elements/samples/pricing-table.html @@ -0,0 +1,68 @@ + + + Feature 1 + Feature 2 + Feature 3 + Feature 4 + + + Feature 1 + Feature 2 + Feature 3 + Feature 4 + + + Feature 1 + Feature 2 + Feature 3 + Feature 4 + + + + + From 41362adc0f40fe08eee04ec91cda87c5b284be3e Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Wed, 29 Nov 2023 09:48:07 +0100 Subject: [PATCH 05/15] Pricing table --- other/custom-elements/samples/pricing-table.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/other/custom-elements/samples/pricing-table.html b/other/custom-elements/samples/pricing-table.html index 0ce832ae2..a3679235b 100644 --- a/other/custom-elements/samples/pricing-table.html +++ b/other/custom-elements/samples/pricing-table.html @@ -1,17 +1,23 @@ - + 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 From a336efca7358735e4d0a249c365358b3ff90f7af Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Wed, 29 Nov 2023 16:08:09 +0100 Subject: [PATCH 06/15] NON working PricingTable --- .../samples/pricing-table.html | 4 + .../custom-elements/samples/pricing-table.js | 125 ++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 other/custom-elements/samples/pricing-table.js diff --git a/other/custom-elements/samples/pricing-table.html b/other/custom-elements/samples/pricing-table.html index a3679235b..c51c0e37f 100644 --- a/other/custom-elements/samples/pricing-table.html +++ b/other/custom-elements/samples/pricing-table.html @@ -1,3 +1,5 @@ + + Feature 1 @@ -25,6 +27,7 @@ + diff --git a/other/custom-elements/samples/pricing-table.js b/other/custom-elements/samples/pricing-table.js new file mode 100644 index 000000000..d8ccfa6ff --- /dev/null +++ b/other/custom-elements/samples/pricing-table.js @@ -0,0 +1,125 @@ + // Define the PricingTable class + class PricingTable extends HTMLElement { + constructor() { + super(); + + // Create a shadow DOM + const shadow = this.attachShadow({mode: 'open'}); + + // Create a container for the pricing plans + const container = document.createElement('div'); + container.setAttribute('class', 'pricing-container'); + + // Append the container to the shadow DOM + shadow.appendChild(container); + } + } + + // Define the PricingPlan class + class PricingPlan extends HTMLElement { + constructor() { + super(); + + // Create a shadow DOM + const shadow = this.attachShadow({mode: 'open'}); + + // Create a container for the pricing plan + const container = document.createElement('div'); + container.setAttribute('class', 'pricing-plan'); + + // Get the label and price attributes + const label = this.getAttribute('label'); + const price = this.getAttribute('price'); + const suppressed = this.hasAttribute('suppressed'); + + // Create the HTML for the pricing plan + container.innerHTML = ` +
+

${label}

+

${price}

+
+
+ +
+ `; + + // Add a suppressed class if the plan is suppressed + if (suppressed) { + container.classList.add('suppressed'); + } + + // Append the container to the shadow DOM + shadow.appendChild(container); + } + } + + // Define the PricingFeature class + class PricingFeature extends HTMLElement { + constructor() { + super(); + + // Create a shadow DOM + const shadow = this.attachShadow({mode: 'open'}); + + // Create a container for the pricing feature + const container = document.createElement('div'); + container.setAttribute('class', 'pricing-feature'); + + // Set the content of the container to the text content of the feature + container.textContent = this.textContent; + + // Append the container to the shadow DOM + shadow.appendChild(container); + } + } + + // Define the styles for the custom elements + const styles = ` + .pricing-container { + display: flex; + justify-content: space-around; + margin: 20px; + } + + .pricing-plan { + border: 1px solid #ccc; + border-radius: 8px; + padding: 20px; + text-align: center; + flex: 1; + } + + .suppressed { + opacity: 0.5; + } + + .plan-header { + border-bottom: 1px solid #ccc; + padding-bottom: 10px; + margin-bottom: 10px; + } + + .plan-header h2 { + margin: 0; + } + + .plan-features { + text-align: left; + } + + .pricing-feature { + margin: 5px 0; + } + `; + + // Create a style element and set the styles + const style = document.createElement('style'); + style.textContent = styles; + + // Register the custom elements + customElements.define('pricing-table', PricingTable); + customElements.define('pricing-plan', PricingPlan); + customElements.define('pricing-feature', PricingFeature); + + // Append the style element to the document head + document.head.appendChild(style); \ No newline at end of file From 5c471156393a0a3f01e277f90af9b11153d64cbf Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Thu, 30 Nov 2023 09:29:56 +0100 Subject: [PATCH 07/15] Pricing table as code --- .../custom-elements/samples/pricing-table.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 other/custom-elements/samples/pricing-table.md diff --git a/other/custom-elements/samples/pricing-table.md b/other/custom-elements/samples/pricing-table.md new file mode 100644 index 000000000..b78f50fb4 --- /dev/null +++ b/other/custom-elements/samples/pricing-table.md @@ -0,0 +1,27 @@ +# Some cool product + +## Pricing as code + + + ### Free + + - Feature 1 + - Feature 2 + - Feature 3 + - Feature 4 + + #### Basic + + - 197,- Kč / měsíc + - Feature 1 + - Feature 2 + + #### Advanced + + - 500,- Kč / měsíc + + #### Enterprise + + - 1500,- Kč / měsíc + + From b766f7edbb6c475d3192ce835743f0a1283f564d Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Thu, 30 Nov 2023 09:32:39 +0100 Subject: [PATCH 08/15] Variants of pricing table --- .../custom-elements/samples/pricing-table.md | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/other/custom-elements/samples/pricing-table.md b/other/custom-elements/samples/pricing-table.md index b78f50fb4..a70b06912 100644 --- a/other/custom-elements/samples/pricing-table.md +++ b/other/custom-elements/samples/pricing-table.md @@ -1,6 +1,6 @@ # Some cool product -## Pricing as code +## Pricing as ### Free @@ -25,3 +25,55 @@ - 1500,- Kč / měsíc + +## Pricing as
+ +
+ +# Free + +- Feature 1 +- Feature 2 +- Feature 3 +- Feature 4 + +## Basic + +- 197,- Kč / měsíc +- Feature 1 +- Feature 2 + +## Advanced + +- 500,- Kč / měsíc + +## Enterprise + +- 1500,- Kč / měsíc + +
+ +## Pricing as block + +```markdown +# Free + +- Feature 1 +- Feature 2 +- Feature 3 +- Feature 4 + +## Basic + +- 197,- Kč / měsíc +- Feature 1 +- Feature 2 + +## Advanced + +- 500,- Kč / měsíc + +## Enterprise + +- 1500,- Kč / měsíc +``` From 5fa511245d1fd0395e096b321e49f8ee07c60fe5 Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Sun, 10 Dec 2023 16:54:08 +0100 Subject: [PATCH 09/15] Moving files --- other/{custom-elements => webgpt-components}/TODO.txt | 3 ++- .../call-to-action}/call-to-action.html | 0 .../pricing-table}/pricing-table.html | 0 .../pricing-table}/pricing-table.js | 0 .../pricing-table}/pricing-table.md | 0 5 files changed, 2 insertions(+), 1 deletion(-) rename other/{custom-elements => webgpt-components}/TODO.txt (65%) rename other/{custom-elements/samples => webgpt-components/call-to-action}/call-to-action.html (100%) rename other/{custom-elements/samples => webgpt-components/pricing-table}/pricing-table.html (100%) rename other/{custom-elements/samples => webgpt-components/pricing-table}/pricing-table.js (100%) rename other/{custom-elements/samples => webgpt-components/pricing-table}/pricing-table.md (100%) diff --git a/other/custom-elements/TODO.txt b/other/webgpt-components/TODO.txt similarity index 65% rename from other/custom-elements/TODO.txt rename to other/webgpt-components/TODO.txt index bd9a4b67a..166099490 100644 --- a/other/custom-elements/TODO.txt +++ b/other/webgpt-components/TODO.txt @@ -1,2 +1,3 @@ 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 +TODO: !!! Move this folder to src/?/ +TODO: !!! People webgpt component \ No newline at end of file diff --git a/other/custom-elements/samples/call-to-action.html b/other/webgpt-components/call-to-action/call-to-action.html similarity index 100% rename from other/custom-elements/samples/call-to-action.html rename to other/webgpt-components/call-to-action/call-to-action.html diff --git a/other/custom-elements/samples/pricing-table.html b/other/webgpt-components/pricing-table/pricing-table.html similarity index 100% rename from other/custom-elements/samples/pricing-table.html rename to other/webgpt-components/pricing-table/pricing-table.html diff --git a/other/custom-elements/samples/pricing-table.js b/other/webgpt-components/pricing-table/pricing-table.js similarity index 100% rename from other/custom-elements/samples/pricing-table.js rename to other/webgpt-components/pricing-table/pricing-table.js diff --git a/other/custom-elements/samples/pricing-table.md b/other/webgpt-components/pricing-table/pricing-table.md similarity index 100% rename from other/custom-elements/samples/pricing-table.md rename to other/webgpt-components/pricing-table/pricing-table.md From 8a463d3cbcbbe241be9d2b993b52673ee610830e Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Sun, 10 Dec 2023 16:58:47 +0100 Subject: [PATCH 10/15] Pricing table --- .../pricing-table/pricing-table.css | 19 +++++ .../pricing-table/pricing-table.html | 72 +++++++++++++------ 2 files changed, 71 insertions(+), 20 deletions(-) create mode 100644 other/webgpt-components/pricing-table/pricing-table.css diff --git a/other/webgpt-components/pricing-table/pricing-table.css b/other/webgpt-components/pricing-table/pricing-table.css new file mode 100644 index 000000000..b4827db9a --- /dev/null +++ b/other/webgpt-components/pricing-table/pricing-table.css @@ -0,0 +1,19 @@ +pricing-table { + display: flex; +} + +pricing-plan { + border: solid 1px red; + + display: flex; + flex-direction: column; + align-items: center; + + border-radius: 15px; +} + +pricing-feature { + border: solid 1px red; + + padding: 10px; +} \ No newline at end of file diff --git a/other/webgpt-components/pricing-table/pricing-table.html b/other/webgpt-components/pricing-table/pricing-table.html index c51c0e37f..145876f32 100644 --- a/other/webgpt-components/pricing-table/pricing-table.html +++ b/other/webgpt-components/pricing-table/pricing-table.html @@ -1,29 +1,61 @@ + - - Feature 1 - Feature 2 - Feature 3 - Feature 4 + + Zadarmo / navždy + + + + + + + + - - Feature 1 - Feature 2 - Feature 3 - Feature 4 + + 49,- Kč / web / měsíc + + + + + + + + - - Feature 1 - Feature 2 - Feature 3 - Feature 4 + + 159,- Kč / web / měsíc + + + + + + + + - - Feature 1 - Feature 2 - Feature 3 - Feature 4 + + 599,- Kč / web / měsíc + + + + + + + + + + + 699,- Kč / měsíc + + + + + + + + From b01dfad6a4c4bbf188be9e7a3c565e1f09aa2210 Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Sun, 10 Dec 2023 17:07:04 +0100 Subject: [PATCH 11/15] Working on webgpt-components pricing table --- other/webgpt-components/TODO.txt | 3 + .../pricing-table/pricing-table.css | 19 --- .../pricing-table/pricing-table.html | 15 +- .../pricing-table/pricing-table.js | 135 +++--------------- .../pricing-table/pricing-table.module.css | 23 +++ 5 files changed, 61 insertions(+), 134 deletions(-) delete mode 100644 other/webgpt-components/pricing-table/pricing-table.css create mode 100644 other/webgpt-components/pricing-table/pricing-table.module.css diff --git a/other/webgpt-components/TODO.txt b/other/webgpt-components/TODO.txt index 166099490..38fdf78a1 100644 --- a/other/webgpt-components/TODO.txt +++ b/other/webgpt-components/TODO.txt @@ -1,3 +1,6 @@ + +TODO: !!! Index all webgpt components +TODO: !!! Use webgpt components in export TODO: !!! [🧠] `Custom elements` vs `Custom components` vs `Custom html elements` vs `Custom html components` vs `WebGPT components` TODO: !!! Move this folder to src/?/ TODO: !!! People webgpt component \ No newline at end of file diff --git a/other/webgpt-components/pricing-table/pricing-table.css b/other/webgpt-components/pricing-table/pricing-table.css deleted file mode 100644 index b4827db9a..000000000 --- a/other/webgpt-components/pricing-table/pricing-table.css +++ /dev/null @@ -1,19 +0,0 @@ -pricing-table { - display: flex; -} - -pricing-plan { - border: solid 1px red; - - display: flex; - flex-direction: column; - align-items: center; - - border-radius: 15px; -} - -pricing-feature { - border: solid 1px red; - - padding: 10px; -} \ No newline at end of file diff --git a/other/webgpt-components/pricing-table/pricing-table.html b/other/webgpt-components/pricing-table/pricing-table.html index 145876f32..75f9529c8 100644 --- a/other/webgpt-components/pricing-table/pricing-table.html +++ b/other/webgpt-components/pricing-table/pricing-table.html @@ -1,5 +1,5 @@ - + @@ -59,6 +59,19 @@ + + + Zadarmo / navždy + + + + + + + + + +