Skip to content

Commit f8bf410

Browse files
committed
fixup!
1 parent 8d3b7f5 commit f8bf410

4 files changed

Lines changed: 21 additions & 7 deletions

File tree

src/generators/web/constants.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const JSX_IMPORTS = {
2424
},
2525
CodeTabs: {
2626
name: 'CodeTabs',
27-
source: '@node-core/ui-components/MDX/CodeTabs',
27+
source: resolve(ROOT, './ui/components/CodeTabs'),
2828
},
2929
MDXTooltip: {
3030
name: 'MDXTooltip',
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import CodeTabs from '@node-core/ui-components/MDX/CodeTabs';
2+
3+
import withIsland from '../islands/withIsland.jsx';
4+
5+
export default withIsland(CodeTabs, {
6+
name: 'CodeTabs',
7+
on: { interaction: 'pointerover,focusin,touchstart' },
8+
});

src/generators/web/ui/islands/runtime.mjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ Island.addInitType('preact', async island => {
4343
// script has to go before the tree it describes is diffed against them.
4444
script?.remove();
4545

46-
const slot = island.querySelector('island-slot');
46+
const slots = [...island.querySelectorAll('island-slot')].filter(
47+
slot => slot.closest('is-land') === island
48+
);
4749

48-
if (slot) {
49-
props.children = h(Slot, { html: slot.innerHTML });
50+
if (slots.length) {
51+
props.children = slots.map(slot => h(Slot, { html: slot.innerHTML }));
5052
}
5153

5254
try {

src/generators/web/ui/islands/withIsland.jsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { toChildArray } from 'preact';
2+
13
import { server } from '#theme/config';
24

35
/**
@@ -45,9 +47,11 @@ export default (Component, { name, on }) => {
4547
)}
4648

4749
<Component {...props}>
48-
{children != null && (
49-
<island-slot defer-hydration>{children}</island-slot>
50-
)}
50+
{toChildArray(children).map((child, index) => (
51+
<island-slot defer-hydration key={index}>
52+
{child}
53+
</island-slot>
54+
))}
5155
</Component>
5256
</is-land>
5357
);

0 commit comments

Comments
 (0)