export const COUNTER_COMPONENTS = {
preact: {
filename: `src/components/PreactCounter.jsx`,
content: `import { useState } from 'preact/hooks';
export default function PreactCounter() {
const [count, setCount] = useState(0);
const add = () => setCount((i) => i + 1);
const subtract = () => setCount((i) => i - 1);
return (
);
}
`,
},
react: {
filename: `src/components/ReactCounter.jsx`,
content: `import { useState } from 'react';
export default function ReactCounter() {
const [count, setCount] = useState(0);
const add = () => setCount((i) => i + 1);
const subtract = () => setCount((i) => i - 1);
return (
);
}
`,
},
solid: {
filename: `src/components/SolidCounter.jsx`,
content: `import { createSignal } from "solid-js";
export default function SolidCounter() {
const [count, setCount] = createSignal(0);
const add = () => setCount(count() + 1);
const subtract = () => setCount(count() - 1);
return (
);
}
`,
},
svelte: {
filename: `src/components/SvelteCounter.svelte`,
content: `
`,
},
vue: {
filename: `src/components/VueCounter.vue`,
content: `
`,
},
};
export interface Integration {
id: string;
packageName: string;
}
export const FRAMEWORKS: { title: string; value: Integration }[] = [
{
title: 'Preact',
value: { id: 'preact', packageName: '@astrojs/preact' },
},
{
title: 'React',
value: { id: 'react', packageName: '@astrojs/react' },
},
{
title: 'Solid.js',
value: { id: 'solid', packageName: '@astrojs/solid-js' },
},
{
title: 'Svelte',
value: { id: 'svelte', packageName: '@astrojs/svelte' },
},
{
title: 'Vue',
value: { id: 'vue', packageName: '@astrojs/vue' },
},
];