Skip to content

Commit e3b555f

Browse files
authored
[examples] Update React examples (#1122)
1 parent 562f1e4 commit e3b555f

File tree

38 files changed

+292
-279
lines changed

38 files changed

+292
-279
lines changed

package-lock.json

Lines changed: 42 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/lit-dev-content/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@
172172
"@lit-labs/ssr": "^3.1.2",
173173
"@lit-labs/ssr-client": "^1.1.1",
174174
"@rollup/plugin-node-resolve": "^15.0.1",
175+
"@types/react": "^18.2.6",
176+
"@types/react-dom": "^18.2.4",
175177
"clean-css": "^5.1.0",
176178
"codemirror": "^5.58.2",
177179
"eleventy-plugin-nesting-toc": "^1.3.0",
@@ -203,7 +205,6 @@
203205
"@material/mwc-formfield": "^0.27.0",
204206
"@material/mwc-snackbar": "^0.27.0",
205207
"@material/mwc-textfield": "^0.27.0",
206-
"@types/react": "^18.0.17",
207208
"@webcomponents/template-shadowroot": "^0.2.1",
208209
"algoliasearch": "^4.14.2",
209210
"lit": "^2.7.4",

packages/lit-dev-content/samples/examples/motion-carousel/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "/samples/base.json",
33
"title": "Carousel Transitions",
44
"description": "Animated carousel.",
5-
"section": "Motion",
5+
"section": "@lit-labs/motion",
66
"files": {
77
"motion-carousel.ts": {},
88
"styles.ts": {},

packages/lit-dev-content/samples/examples/motion-grid/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "/samples/base.json",
33
"title": "Grid Layout Transitions",
44
"description": "Animate css grid layouts.",
5-
"section": "Motion",
5+
"section": "@lit-labs/motion",
66
"files": {
77
"motion-grid.ts": {},
88
"styles.ts": {},

packages/lit-dev-content/samples/examples/motion-hero/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "/samples/base.json",
33
"title": "List/Detail Hero Transition",
44
"description": "Hero animation.",
5-
"section": "Motion",
5+
"section": "@lit-labs/motion",
66
"files": {
77
"motion-hero.ts": {},
88
"styles.ts": {},

packages/lit-dev-content/samples/examples/motion-in-out/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "/samples/base.json",
33
"title": "Lit Logo Animation",
44
"description": "Animate elements when they go in and out of the page.",
5-
"section": "Motion",
5+
"section": "@lit-labs/motion",
66
"files": {
77
"motion-lit.ts": {},
88
"styles.ts": {},

packages/lit-dev-content/samples/examples/motion-list/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "/samples/base.json",
33
"title": "List Item Animation",
44
"description": "Animate list items.",
5-
"section": "Motion",
5+
"section": "@lit-labs/motion",
66
"files": {
77
"motion-list.ts": {},
88
"styles.ts": {},

packages/lit-dev-content/samples/examples/motion-simple/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "/samples/base.json",
33
"title": "Sliding Circle",
44
"description": "Simple `animate()` directive example.",
5-
"section": "Motion",
5+
"section": "@lit-labs/motion",
66
"files": {
77
"motion-slide.ts": {},
88
"index.html": {},

packages/lit-dev-content/samples/examples/motion-todos/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "/samples/base.json",
33
"title": "Todos List Transitions",
44
"description": "Animated list of todos.",
5-
"section": "Motion",
5+
"section": "@lit-labs/motion",
66
"files": {
77
"motion-todos.ts": {},
88
"styles.ts": {},
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
import {React, ReactDOM} from './react.js';
1+
import React from 'https://esm.sh/react@18';
2+
import {createRoot} from 'https://esm.sh/react-dom@18/client';
23
import {createComponent} from '@lit-labs/react';
34
import {DemoGreeting as DemoGreetingWC} from './demo-greeting.js';
45

6+
// Creates a React component from a Lit component
57
const DemoGreeting = createComponent({
68
react: React,
79
tagName: 'demo-greeting',
8-
elementClass: DemoGreetingWC
10+
elementClass: DemoGreetingWC,
911
});
1012

11-
const node = document.querySelector('#app');
12-
const root = ReactDOM.createRoot(node!);
13+
const root = createRoot(document.getElementById('app')!);
1314

14-
root.render(<DemoGreeting name={'React'}></DemoGreeting>);
15+
root.render(<DemoGreeting name="React" />);

0 commit comments

Comments
 (0)