feat(site): call-to-action, link to mcfly
This commit is contained in:
parent
d0e458ff87
commit
44617ed999
5 changed files with 42 additions and 7 deletions
18
site/src/components/call-to-action.html
Normal file
18
site/src/components/call-to-action.html
Normal 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>
|
10
site/src/components/my-counter.js
Normal file
10
site/src/components/my-counter.js
Normal 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>`;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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>
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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 "https://unpkg.com/web-component-base@1.13.0/WebComponent.min.js";
|
||||||
|
|
||||||
export class Counter extends WebComponent {
|
export class Counter extends WebComponent {
|
||||||
static properties = ["count"];
|
static properties = ["count"];
|
||||||
onInit() {
|
onInit() {
|
||||||
|
@ -52,7 +54,10 @@ export class Counter extends WebComponent {
|
||||||
get template() {
|
get template() {
|
||||||
return `<button>${this.props.count}</button>`;
|
return `<button>${this.props.count}</button>`;
|
||||||
}
|
}
|
||||||
}</pre>
|
}
|
||||||
|
|
||||||
|
customElements.define("my-counter", Counter);
|
||||||
|
</pre>
|
||||||
</code-block>
|
</code-block>
|
||||||
</main>
|
</main>
|
||||||
<my-footer>
|
<my-footer>
|
||||||
|
|
Loading…
Reference in a new issue