-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(examples): migrate remix to react-router 7 (#6725)
- Loading branch information
1 parent
0e289fa
commit d4c2aa9
Showing
28 changed files
with
2,977 additions
and
6,648 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules | |
/.cache | ||
/build | ||
.env | ||
.react-router/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# UI5 Web Components React - React Router Example | ||
|
||
This example shows how to use the [React Router](https://reactrouter.com/) with UI5 Web Components for React. | ||
This example was previously known as [Remix](https://remix.run/), and got updated to use React Router v7. | ||
|
||
## How to use this template | ||
|
||
```bash | ||
npx degit SAP/ui5-webcomponents-react/examples/react-router-ts#main my-project | ||
cd my-project | ||
``` | ||
|
||
## Getting Started | ||
|
||
First, install the node_modules: | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
Then, run the development server: | ||
|
||
```bash | ||
npm run dev | ||
``` | ||
|
||
## Deployment | ||
|
||
First, build your app for production: | ||
|
||
```sh | ||
npm run build | ||
``` | ||
|
||
Then run the app in production mode: | ||
|
||
```sh | ||
npm start | ||
``` | ||
|
||
Now you'll need to pick a host to deploy it to. | ||
|
||
## Learn More | ||
|
||
- 📖 See the [React router docs](https://reactrouter.com/home). |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ples/remix-ts/app/components/TodoList.tsx → ...act-router-ts/app/components/TodoList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import wcrStyles from '@ui5/webcomponents-react/styles.css?url'; | ||
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from 'react-router'; | ||
import type { Route } from './+types/root'; | ||
import { AppShell } from './components/AppShell'; | ||
import appStyles from './globals.css?url'; | ||
|
||
export const links: Route.LinksFunction = () => [ | ||
{ rel: 'stylesheet', href: appStyles }, | ||
{ rel: 'stylesheet', href: wcrStyles } | ||
]; | ||
|
||
export function Layout({ children }: { children: React.ReactNode }) { | ||
return ( | ||
<html lang="en"> | ||
<head suppressHydrationWarning={true}> | ||
<meta charSet="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<Meta /> | ||
<Links /> | ||
</head> | ||
<body> | ||
{children} | ||
<ScrollRestoration /> | ||
<Scripts /> | ||
</body> | ||
</html> | ||
); | ||
} | ||
|
||
export default function App() { | ||
return ( | ||
<AppShell> | ||
<Outlet /> | ||
</AppShell> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { index, route, type RouteConfig } from '@react-router/dev/routes'; | ||
|
||
export default [index('./routes/index.tsx'), route('todos/:id', './routes/todo.tsx')] satisfies RouteConfig; |
23 changes: 12 additions & 11 deletions
23
examples/remix-ts/app/routes/_index.tsx → ...ples/react-router-ts/app/routes/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.