Skip to content

Commit

Permalink
Tweak PCUI examples
Browse files Browse the repository at this point in the history
  • Loading branch information
willeastcott committed Feb 4, 2024
1 parent 27a815a commit d3024e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/pages/5-examples/5-examples-history.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ In this example you can interact with the input slider to update the progress ba

### Code

```javascript
```jsx
import React, { useState } from 'react';
import ReactDOM from 'react-dom';

Expand Down
8 changes: 3 additions & 5 deletions docs/pages/5-examples/5-examples-todo.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ The todo list below allows you to add items to the list, toggle their 'done' sta

### Code

```javascript

```jsx
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
import { Observer } from '@playcanvas/observer';
Expand Down Expand Up @@ -47,10 +46,9 @@ export const TodoList = (props) => {
items[key].done = !items[key].done;
observer.set('items', items);
};
const textInputLink = { observer, path: 'input' };
return (
<Container class='todo'>
<TextInput blurOnEnter={false} placeholder='enter item' binding={new BindingTwoWay()} link={textInputLink} onChange={addItem}/>
<TextInput blurOnEnter={false} placeholder='enter item' binding={new BindingTwoWay()} link={{ observer, path: 'input' }} onChange={addItem}/>
<SelectInput type="number" options={[{v: 0, t: 'Show all items'}, {v: 1, t: 'Show active items'}, {v: 2, t: 'Show done items'}]} onChange={setListFilter} />
<Container>
{Object.keys(items).map(key => {
Expand All @@ -71,5 +69,5 @@ export const TodoList = (props) => {
);
};

ReactDOM.render(<Todolist />, document.body);
ReactDOM.render(<TodoList />, document.body);
```

0 comments on commit d3024e8

Please sign in to comment.