Skip to content

Commit b8e3295

Browse files
committed
chore: implementation to test basic islands
1 parent adf0cc9 commit b8e3295

9 files changed

+71
-2
lines changed

playground/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ dist-ssr
2525

2626
.env*
2727
!.env.example
28+
29+
/.islands

playground/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
},
1414
"devDependencies": {
1515
"@preact/preset-vite": "^2.9.1",
16+
"@tailwindcss/forms": "^0.5.9",
1617
"@types/node": "^20.16.10",
1718
"adex": "workspace:*",
1819
"autoprefixer": "^10.4.20",
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { useEffect, useState } from 'preact/hooks'
2+
3+
export function ListIsland() {
4+
const [data, setData] = useState([])
5+
6+
useEffect(() => {
7+
setData([1, 2, 3])
8+
}, [])
9+
10+
return (
11+
<div>
12+
<ul>
13+
{data.map(d => (
14+
<li>{d}</li>
15+
))}
16+
</ul>
17+
</div>
18+
)
19+
}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export function FormIsland() {
2+
const onSubmit = e => {
3+
e.preventDefault()
4+
alert('sumbitted')
5+
}
6+
return (
7+
<div class="flex">
8+
<form class="flex-col gap-2" onSubmit={onSubmit}>
9+
<input name="name" />
10+
<button>Save</button>
11+
</form>
12+
</div>
13+
)
14+
}

playground/src/pages/islands-test.tsx

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { ListIsland } from '../components/FormIsland'
2+
import { FormIsland } from '../components/ListIsland'
3+
4+
export default function IslandsTest() {
5+
return (
6+
<>
7+
<FormIsland />
8+
<ListIsland />
9+
</>
10+
)
11+
}

playground/tailwind.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import forms from '@tailwindcss/forms'
12
/** @type {import('tailwindcss').Config} */
23
export default {
34
content: ['./src/**/*.{js,jsx,ts,tsx}'],
@@ -7,5 +8,5 @@ export default {
78
sans: 'Inter',
89
},
910
},
10-
plugins: [],
11+
plugins: [forms],
1112
}

playground/tsconfig.json

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"compilerOptions": {
33
"allowJs": true,
44
"noEmit": true,
5+
"jsx": "react-jsx",
6+
"jsxImportSource": "preact",
57
"moduleResolution": "Node",
68
"paths": {
79
"adex": ["../adex/vite.js"],

playground/vite.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { providers } from 'adex/fonts'
77
export default defineConfig({
88
plugins: [
99
adex({
10-
islands: false,
10+
islands: true,
1111
fonts: {
1212
providers: [providers.google()],
1313
families: [

pnpm-lock.yaml

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)