Skip to content

Commit

Permalink
chore(uix) - update package version and code (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
mahaveer0496 authored Mar 4, 2022
1 parent 5488eb8 commit f440ece
Show file tree
Hide file tree
Showing 9 changed files with 2,136 additions and 108 deletions.
2 changes: 1 addition & 1 deletion uix-basic-input/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start": "next start"
},
"dependencies": {
"@graphcms/uix-react-sdk": "0.0.19",
"@graphcms/uix-react-sdk": "^0.2.5",
"next": "10.2.3",
"react": "17.0.2",
"react-dom": "17.0.2"
Expand Down
38 changes: 14 additions & 24 deletions uix-basic-input/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,28 @@
// @ts-check
import {
Wrapper,
useUiExtension,
FieldExtensionType,
FieldExtensionFeature,
useFieldExtension,
ExtensionType,
} from '@graphcms/uix-react-sdk';
import { useRouter } from 'next/router';

function MyField() {
const { value, onChange } = useUiExtension();

return (
<input
value={value}
onChange={({ target: { value: val } }) => onChange(val)}
/>
);
const { value, onChange } = useFieldExtension();
return <input value={value} onChange={(e) => onChange(e.target.value)} />;
}

export default function MyCustomInputExtensionPage() {
const router = useRouter();

const { extensionUid } = router.query;

if (!extensionUid) return null;

const declaration = {
extensionType: 'field',
fieldType: FieldExtensionType.STRING,
name: 'My custom field',
features: [FieldExtensionFeature.FieldRenderer],
};
/** @type {import('@graphcms/uix-react-sdk').FieldExtensionDeclaration} */
const declaration = {
extensionType: ExtensionType.field,
fieldType: FieldExtensionType.STRING,
name: 'My custom field',
features: [FieldExtensionFeature.FieldRenderer],
};

export default function MyCustomInputExtensionPage() {
return (
<Wrapper uid={extensionUid} declaration={declaration}>
<Wrapper declaration={declaration}>
<MyField />
</Wrapper>
);
Expand Down
Loading

0 comments on commit f440ece

Please sign in to comment.