feat(site): call-to-action, link to mcfly

This commit is contained in:
Ayo 2023-11-23 08:06:29 +01:00
parent d0e458ff87
commit 44617ed999
5 changed files with 42 additions and 7 deletions

View file

@ -0,0 +1,18 @@
<div style="
padding: 1em;
margin: 1em 0;
text-align: center;
width: 100%;
">
<a
style="
background-color: var(--color-primary);
color: white;
padding: 1em;
border-radius: 5px;
text-decoration: none;
"
href="https://www.npmjs.com/package/web-component-base#readme">
Learn More
</a>
</div>

View file

@ -0,0 +1,10 @@
class Counter extends WebComponent {
static properties = ["count"];
onInit() {
this.props.count = 0;
this.onclick = () => ++this.props.count;
}
get template() {
return `<button>${this.props.count}</button>`;
}
}

View file

@ -1,9 +1,8 @@
<footer style="text-align: right; font-style: italic; padding: 0.5em 1em"> <footer style="text-align: right; font-style: italic; padding: 0.5em 1em">
<p> <p>
<small <small
>✨ Star on >Built with
<a href="https://github.com/ayoayco/web-component-base">GitHub</a> to <a href="https://github.com/ayoayco/McFly">McFly</a>, the no-framework framework</small
support!</small
><br /> ><br />
<slot /> <slot />
</p> </p>

View file

@ -22,6 +22,9 @@
content="A zero-dependency, ~600 Bytes (minified & gzipped), JS base class for creating reactive custom elements easily" content="A zero-dependency, ~600 Bytes (minified & gzipped), JS base class for creating reactive custom elements easily"
/> />
<style> <style>
:root {
--color-primary: #3054bf;
}
body { body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
max-width: 40em; max-width: 40em;

View file

@ -31,18 +31,20 @@
tiny package tiny package
</a> </a>
provides zero-dependency, ~600 Bytes (minified & gzipped), JS base class provides zero-dependency, ~600 Bytes (minified & gzipped), JS base class
for creating reactive custom elements easily for creating reactive custom elements easily.
</p> </p>
<call-to-action></call-to-action>
<p> <p>
When you extend the WebComponent class for your component, you only have When you extend the WebComponent class for your component, you only have
to define the template and properties. Any change in any property value to define the template and properties. Any change in any property value
will automatically cause just the component UI to render. will automatically cause just the component UI to render.
</p> </p>
<p>The result is a reactive UI on property changes.</p> <p>The result is a reactive UI on property changes: <my-counter></my-counter></p>
<code-block language="js"> <code-block language="js">
<pre> <pre>
import WebComponent from &quot;https://unpkg.com/web-component-base@1.13.0/WebComponent.min.js&quot;;
export class Counter extends WebComponent { export class Counter extends WebComponent {
static properties = [&quot;count&quot;]; static properties = [&quot;count&quot;];
onInit() { onInit() {
@ -52,7 +54,10 @@ export class Counter extends WebComponent {
get template() { get template() {
return `&lt;button&gt;${this.props.count}&lt;/button&gt;`; return `&lt;button&gt;${this.props.count}&lt;/button&gt;`;
} }
}</pre> }
customElements.define(&quot;my-counter&quot;, Counter);
</pre>
</code-block> </code-block>
</main> </main>
<my-footer> <my-footer>