blob: 4d0b62a6005d3982d1109e46b838b57c1fe84864 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
---
// Full Astro Component Syntax:
// https://docs.astro.build/core-concepts/astro-components/
const { initialCount = 0 } = Astro.props;
---
<div class="counter" x-data=`{ count: ${initialCount} }`>
<button x-on:click="count--">-</button>
<pre x-text="count">{ initialCount }</pre>
<button x-on:click="count++">+</button>
</div>
<div class="counter-message">
<slot />
</div>
<style>
.counter {
display: grid;
font-size: 2em;
grid-template-columns: repeat(3, minmax(0, 1fr));
margin-top: 2em;
place-items: center;
}
.counter-message {
text-align: center;
}
</style>
|