Skip to content

Commit 825f451

Browse files
refactor: updates vue examples
1 parent bc921f4 commit 825f451

File tree

30 files changed

+1652
-661
lines changed

30 files changed

+1652
-661
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const NextLogo = () => (
2+
<svg
3+
xmlns="http://www.w3.org/2000/svg"
4+
viewBox="0 0 128 128"
5+
aria-label="Next.js"
6+
role="img"
7+
>
8+
<path d="M64 0C28.7 0 0 28.7 0 64s28.7 64 64 64c11.2 0 21.7-2.9 30.8-7.9L48.4 55.3v36.6h-6.8V41.8h6.8l50.5 75.8C116.4 106.2 128 86.5 128 64c0-35.3-28.7-64-64-64zm22.1 84.6l-7.5-11.3V41.8h7.5v42.8z" />
9+
</svg>
10+
);
11+
12+
export default NextLogo;

frameworks/next/JS/app/components/logos/ReactLogo.jsx

Lines changed: 0 additions & 12 deletions
This file was deleted.

frameworks/next/JS/app/page.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Link from "next/link";
22
import "./page.css";
3+
import NextLogo from "./components/logos/NextLogo";
34
import { NutrientLogo } from "./components/logos/NutrientLogo";
4-
import ReactLogo from "./components/logos/ReactLogo";
55

66
function HomePage() {
77
const examples = [
@@ -58,7 +58,7 @@ function HomePage() {
5858
rel="noopener noreferrer"
5959
className="link-no-style"
6060
>
61-
<ReactLogo />
61+
<NextLogo />
6262
</a>
6363
</div>
6464
</div>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const NextLogo = () => (
2+
<svg
3+
xmlns="http://www.w3.org/2000/svg"
4+
viewBox="0 0 128 128"
5+
aria-label="Next.js"
6+
role="img"
7+
>
8+
<path d="M64 0C28.7 0 0 28.7 0 64s28.7 64 64 64c11.2 0 21.7-2.9 30.8-7.9L48.4 55.3v36.6h-6.8V41.8h6.8l50.5 75.8C116.4 106.2 128 86.5 128 64c0-35.3-28.7-64-64-64zm22.1 84.6l-7.5-11.3V41.8h7.5v42.8z" />
9+
</svg>
10+
);
11+
12+
export default NextLogo;

frameworks/next/TS/app/components/logos/ReactLogo.tsx

Lines changed: 0 additions & 12 deletions
This file was deleted.

frameworks/next/TS/app/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Link from "next/link";
22
import "./page.css";
3+
import NextLogo from "./components/logos/NextLogo";
34
import { NutrientLogo } from "./components/logos/NutrientLogo";
4-
import ReactLogo from "./components/logos/ReactLogo";
55

66
interface Example {
77
path: string;
@@ -65,7 +65,7 @@ function HomePage() {
6565
rel="noopener noreferrer"
6666
className="link-no-style"
6767
>
68-
<ReactLogo />
68+
<NextLogo />
6969
</a>
7070
</div>
7171
</div>

frameworks/react/JS/src/pages/CustomOverlaysPage.jsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,29 @@ import {
44
loadCustomOverlaysViewer,
55
unloadCustomOverlaysViewer,
66
} from "../examples/custom-overlays/implementation";
7+
import { loadNutrientViewer } from "../utils/loadNutrientViewer";
78

89
function CustomOverlaysPage() {
910
const containerRef = useRef(null);
1011

1112
useEffect(() => {
1213
const container = containerRef.current;
13-
const { NutrientViewer } = window;
1414

15-
if (container && NutrientViewer) {
16-
loadCustomOverlaysViewer(NutrientViewer, container);
15+
if (!container) return;
16+
17+
let nutrientViewer;
18+
19+
try {
20+
nutrientViewer = loadNutrientViewer();
21+
22+
loadCustomOverlaysViewer(nutrientViewer, container);
23+
} catch (error) {
24+
console.error("Failed to load Nutrient Viewer:", error);
1725
}
1826

1927
return () => {
20-
if (NutrientViewer && container) {
21-
unloadCustomOverlaysViewer(NutrientViewer, container);
28+
if (nutrientViewer && container) {
29+
unloadCustomOverlaysViewer(nutrientViewer, container);
2230
}
2331
};
2432
}, []);

frameworks/react/TS/src/pages/CustomOverlaysPage.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,29 @@ import {
44
loadCustomOverlaysViewer,
55
unloadCustomOverlaysViewer,
66
} from "../examples/custom-overlays/implementation";
7+
import { loadNutrientViewer } from "../utils/loadNutrientViewer";
78

89
function CustomOverlaysPage() {
910
const containerRef = useRef<HTMLDivElement>(null);
1011

1112
useEffect(() => {
1213
const container = containerRef.current;
13-
const { NutrientViewer } = window;
1414

15-
if (container && NutrientViewer) {
16-
loadCustomOverlaysViewer(NutrientViewer, container);
15+
if (!container) return;
16+
17+
let nutrientViewer: ReturnType<typeof loadNutrientViewer>;
18+
19+
try {
20+
nutrientViewer = loadNutrientViewer();
21+
22+
loadCustomOverlaysViewer(nutrientViewer, container);
23+
} catch (error) {
24+
console.error("Failed to load Nutrient Viewer:", error);
1725
}
1826

1927
return () => {
20-
if (NutrientViewer && container) {
21-
unloadCustomOverlaysViewer(NutrientViewer, container);
28+
if (nutrientViewer && container) {
29+
unloadCustomOverlaysViewer(nutrientViewer, container);
2230
}
2331
};
2432
}, []);

frameworks/react/TS/src/pages/MagazineModePage.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ function MagazineModePage() {
1919
try {
2020
nutrientViewer = loadNutrientViewer();
2121

22-
nutrientViewer.unload(container);
23-
2422
loadMagazineViewer(nutrientViewer, container);
2523
} catch (error) {
2624
console.error("Failed to load Nutrient Viewer:", error);

0 commit comments

Comments
 (0)