Skip to content

Commit 3e90258

Browse files
authored
Merge pull request web-fragments#55 from 1000hz/e2e-shell-conditional-content
Update e2e shell app remix route to include route-specific content
2 parents 0d97d5b + 215a8a3 commit 3e90258

File tree

2 files changed

+43
-22
lines changed

2 files changed

+43
-22
lines changed

e2e/pierced-react/fragments/remix/app/routes/remix-page_.details.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export default function Index() {
6666
color: "#fff",
6767
}}
6868
>
69-
Go to /remix-page 👉
69+
👈 Go to /remix-page
7070
</Link>
7171
</div>
7272
<p>Current Route: /remix-page/details</p>

e2e/pierced-react/src/routes/remix.tsx

+42-21
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@ import { useState } from "react";
22
import reactLogo from "../assets/react.svg";
33
import remixLogo from "../assets/remix.svg";
44
import "../App.css";
5-
import { useNavigate } from "react-router-dom";
5+
import { Link, Route, Routes } from "react-router-dom";
66

77
function App() {
88
const [count, setCount] = useState(0);
99
const [showHost, setShowHost] = useState(false);
10-
const navigate = useNavigate();
11-
12-
const goToDetails = () => {
13-
navigate("/remix-page/details");
14-
};
15-
1610
const toggleShowHost = () => {
1711
setShowHost(!showHost);
1812
};
@@ -28,20 +22,47 @@ function App() {
2822
</a>
2923
</div>
3024
<h1>React + Remix</h1>
31-
<button
32-
onClick={goToDetails}
33-
style={{
34-
display: "block",
35-
padding: "0.5rem",
36-
margin: "1rem auto",
37-
backgroundColor: "#333",
38-
borderRadius: "5px",
39-
fontSize: "1rem",
40-
color: "#fff",
41-
}}
42-
>
43-
Go to /remix-page/details 👉
44-
</button>
25+
<Routes>
26+
<Route
27+
index
28+
element={
29+
<Link
30+
to="/remix-page/details"
31+
style={{
32+
display: "inline-block",
33+
padding: "0.5rem",
34+
margin: "1rem auto",
35+
backgroundColor: "#333",
36+
borderRadius: "5px",
37+
fontSize: "1rem",
38+
color: "#fff",
39+
}}
40+
>
41+
Go to /remix-page/details 👉
42+
</Link>
43+
}
44+
/>
45+
<Route
46+
path="/details"
47+
element={
48+
<Link
49+
to="/remix-page"
50+
style={{
51+
display: "inline-block",
52+
padding: "0.5rem",
53+
margin: "1rem auto",
54+
backgroundColor: "#333",
55+
borderRadius: "5px",
56+
fontSize: "1rem",
57+
color: "#fff",
58+
}}
59+
>
60+
👈 Go to /remix-page
61+
</Link>
62+
}
63+
/>
64+
</Routes>
65+
4566
<p
4667
style={{
4768
fontSize: "1rem",

0 commit comments

Comments
 (0)