diff options
Diffstat (limited to 'examples/container-with-vitest/src/components')
3 files changed, 27 insertions, 0 deletions
diff --git a/examples/container-with-vitest/src/components/Card.astro b/examples/container-with-vitest/src/components/Card.astro new file mode 100644 index 000000000..a7e49f41c --- /dev/null +++ b/examples/container-with-vitest/src/components/Card.astro @@ -0,0 +1,8 @@ +--- + +--- + +<div> + This is a card + <slot /> +</div> diff --git a/examples/container-with-vitest/src/components/Counter.jsx b/examples/container-with-vitest/src/components/Counter.jsx new file mode 100644 index 000000000..2148bf3d8 --- /dev/null +++ b/examples/container-with-vitest/src/components/Counter.jsx @@ -0,0 +1,14 @@ +import { useState } from 'react'; + +export default function({ initialCount }) { + const [count, setCount] = useState(initialCount || 0); + return ( + <div className="rounded-t-lg overflow-hidden border-t border-l border-r border-gray-400 text-center p-4"> + <h2 className="font-semibold text-lg">Counter</h2> + <h3 className="font-medium text-lg">Count: {count}</h3> + <button + className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded" + onClick={() => setCount(count + 1)}>Increment</button> + </div> + ) +} diff --git a/examples/container-with-vitest/src/components/ReactWrapper.astro b/examples/container-with-vitest/src/components/ReactWrapper.astro new file mode 100644 index 000000000..73ac6baeb --- /dev/null +++ b/examples/container-with-vitest/src/components/ReactWrapper.astro @@ -0,0 +1,5 @@ +--- +import Counter from './Counter.jsx'; +--- + +<Counter initialCount={5} /> |