Skip to content

Commit 63c1f70

Browse files
committed
docs: update README.md
1 parent 726ca79 commit 63c1f70

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const Component = () => (<JsonViewer value={object}/>)
4444
### Customizable data type
4545

4646
```tsx
47-
import JsonViewer from '@textea/json-viewer'
47+
import { JsonViewer, createDataType } from '@textea/json-viewer'
4848

4949
const object = {
5050
// what if I want to inspect a image?
@@ -56,14 +56,14 @@ const Component = () => (
5656
value={object}
5757
// just define it
5858
valueTypes={[
59-
{
60-
is: (value) =>
61-
typeof value === 'string' &&
59+
createDataType(
60+
(value) => typeof value === 'string' &&
6261
value.startsWith('https://i.imgur.com'),
63-
Component: (props) => {
64-
return <img height="50px" src={props.value} alt={props.value}/>;
65-
},
66-
},
62+
(props) => {
63+
return <Image height={50} width={50} src={props.value}
64+
alt={props.value}/>
65+
}
66+
)
6767
]}
6868
/>
6969
)
@@ -128,10 +128,10 @@ const Component = () => (
128128

129129
- [X] 100% TypeScript
130130
- [X] Customizable
131-
- [X] `keyRenderer` for customize key renderer
132-
- [X] `valueTypes` for customize any value types you want
133-
- [X] `light | dark | base16` Theme support
134-
- [ ] custom metadata
131+
- [X] `keyRenderer` for customize key renderer
132+
- [X] `valueTypes` for customize any value types you want
133+
- [X] `light | dark | base16` Theme support
134+
- [ ] custom metadata
135135
- [X] Support `Next.js` SSR
136136
- [X] `onChange` props allow users to edit value
137137
- [X] Inspect `object`, `Array`, primitive type, even `Map` and `Set` by default.

0 commit comments

Comments
 (0)