feat: support conditional island JSX children (#1355)
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
This commit is contained in:
co-authored by
Asher Gomez
parent
dff80d3a42
commit
11077227b5
@@ -1,9 +1,17 @@
|
||||
import { Signal } from "@preact/signals";
|
||||
import { ComponentChildren } from "preact";
|
||||
|
||||
export interface IslandConditionalProps {
|
||||
show: Signal<boolean>;
|
||||
children?: ComponentChildren;
|
||||
}
|
||||
|
||||
export default function IslandConditional({ show }: IslandConditionalProps) {
|
||||
return show.value ? <>it works</> : null;
|
||||
export default function IslandConditional(
|
||||
{ show, children }: IslandConditionalProps,
|
||||
) {
|
||||
return (
|
||||
<div class="island">
|
||||
{show.value ? <p>island content</p> : <>{children}</>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user