Skip to content

Commit 95436ea

Browse files
committed
📝 fix docs for @coven/pair
1 parent 99c4754 commit 95436ea

File tree

5 files changed

+43
-7
lines changed

5 files changed

+43
-7
lines changed

.github/workflows/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
publish:
10-
runs-on: ubuntu-latest
10+
runs-on: macos-latest
1111
permissions:
1212
contents: read
1313
id-token: write

@coven/pair/README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ Currently supported frameworks:
1919
### Preact
2020

2121
```tsx
22-
import { createElement } from "preact";
23-
import { useState } from "preact/hooks";
22+
/** @jsxImportSource preact */
2423
import { pair } from "@coven/pair/preact";
24+
import { useState } from "preact/hooks";
2525

2626
const useCount = (initialCount: number) => {
2727
const [count, setCount] = useState(initialCount);
@@ -53,9 +53,11 @@ const Component = ({ array = [] }) => (
5353
### React
5454

5555
```tsx
56-
// @deno-types="@types/react"
57-
import { createElement, useState } from "react";
56+
/** @jsxImportSource react */
57+
/** @jsxImportSourceTypes @types/react */
5858
import { pair } from "@coven/pair/react";
59+
// @deno-types="@types/react"
60+
import { useState } from "react";
5961

6062
const useCount = (initialCount: number) => {
6163
const [count, setCount] = useState(initialCount);

@coven/pair/preact/pair.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { PairedComponentProperties } from "./PairedComponentProperties.ts";
66
*
77
* @example
88
* ```tsx
9-
* import { createElement } from "preact";
9+
* /** @jsxImportSource preact *\/
1010
* import { useState } from "preact/hooks";
1111
*
1212
* const useCount = (initialCount: number) => {

@coven/pair/react/pair.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import type { PairedComponentProperties } from "./PairedComponentProperties.ts";
88
*
99
* @example
1010
* ```tsx
11-
* import { createElement, useState } from "react";
11+
* /** @jsxImportSource react *\/
12+
* /** @jsxImportSourceTypes @types/react *\/
13+
* // @deno-types="@types/react"
14+
* import { useState } from "react";
1215
*
1316
* const useCount = (initialCount: number) => {
1417
* const [count, setCount] = useState(initialCount);

@coven/pair/test.tsx

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/** @jsxImportSource react */
2+
/** @jsxImportSourceTypes @types/react */
3+
import { pair } from "@coven/pair/react";
4+
// @deno-types="@types/react"
5+
import { useState } from "react";
6+
7+
const useCount = (initialCount: number) => {
8+
const [count, setCount] = useState(initialCount);
9+
10+
return { onClick: () => setCount(count + 1), children: count };
11+
};
12+
13+
const PairedCount = pair(useCount);
14+
15+
const Component = ({ array = [] }) => (
16+
<ul>
17+
{array.map((key) => (
18+
<PairedCount key={key}>
19+
{(usePairedCount) => {
20+
const props = usePairedCount(key);
21+
22+
return (
23+
<li>
24+
<button type="button" {...props} />
25+
</li>
26+
);
27+
}}
28+
</PairedCount>
29+
))}
30+
</ul>
31+
);

0 commit comments

Comments
 (0)