Skip to content

Commit

Permalink
todo
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasPe committed Jan 8, 2025
1 parent 2d4651b commit e858f93
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
13 changes: 13 additions & 0 deletions stories/components/todo/todo.html.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,16 @@ export const tasksWithInitialId = () => html`
export const ReadOnly = () => html`
<mgt-todo read-only></mgt-todo>
`;

export const events = () => html`
<mgt-todo></mgt-todo>
<script>
const todo = document.querySelector('mgt-todo');
todo.addEventListener('updated', (e) => {
console.log('updated', e);
});
todo.addEventListener('templateRendered', (e) => {
console.log('templateRendered', e);
});
</script>
`;
33 changes: 33 additions & 0 deletions stories/components/todo/todo.react.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,36 @@ export const todos = () => html`
);
</react>
`;

export const events = () => html`
<mgt-todo></mgt-todo>
<react>
import { Todo } from '@microsoft/mgt-react';
export default () => {
const onUpdated = useCallback((e: CustomEvent<undefined>) => {
console.log('updated', e);
});
const onTemplateRendered = useCallback((e: CustomEvent<MgtElement.TemplateRenderedData>) => {
console.log('templateRendered', e);
});
return (
<Todo
updated={onUpdated}
templateRendered={onTemplateRendered}>
</Todo>
);
};
</react>
<script>
const todo = document.querySelector('mgt-todo');
todo.addEventListener('updated', (e) => {
console.log('updated', e);
});
todo.addEventListener('templateRendered', (e) => {
console.log('templateRendered', e);
});
</script>
`;

0 comments on commit e858f93

Please sign in to comment.