mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
feat(sandbox): rebuild sandbox with shell UI and expanded templates (#773)
This commit is contained in:
@@ -4,121 +4,12 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Sandbox</title>
|
||||
<link rel="preconnect" href="https://rsms.me/">
|
||||
<link rel="stylesheet" href="https://rsms.me/inter/inter.css">
|
||||
<link rel="preconnect" href="https://rsms.me/" />
|
||||
<link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
|
||||
<link rel="stylesheet" href="./styles.css" />
|
||||
</head>
|
||||
<body class="font-sans text-neutral-900 flex flex-col h-screen overflow-hidden">
|
||||
<header
|
||||
class="shrink-0 h-12 border-b border-neutral-200 bg-neutral-50 flex items-center justify-between px-4"
|
||||
>
|
||||
<span class="text-sm font-bold tracking-tight">Video.js v10</span>
|
||||
<a
|
||||
href="https://github.com/videojs/v10"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="text-neutral-500 hover:text-neutral-900 transition-colors"
|
||||
aria-label="GitHub repository"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
class="w-5 h-5"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path
|
||||
d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61-.546-1.385-1.335-1.755-1.335-1.755-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
</header>
|
||||
<div class="flex flex-1 overflow-hidden">
|
||||
<nav
|
||||
class="w-48 shrink-0 border-r border-neutral-200 bg-neutral-50 flex flex-col gap-1 p-4 overflow-y-auto"
|
||||
>
|
||||
<span class="text-xs font-bold uppercase tracking-widest text-neutral-400 mb-2"
|
||||
>Sandbox</span
|
||||
>
|
||||
<a
|
||||
href="/html/"
|
||||
data-page="/html/"
|
||||
class="nav-link px-3 py-2 rounded text-sm text-blue-600 hover:bg-neutral-100 hover:text-blue-800 transition-colors"
|
||||
>HTML</a
|
||||
>
|
||||
<a
|
||||
href="/html-background/"
|
||||
data-page="/html-background/"
|
||||
class="nav-link px-3 py-2 rounded text-sm text-blue-600 hover:bg-neutral-100 hover:text-blue-800 transition-colors"
|
||||
>HTML Background</a
|
||||
>
|
||||
<a
|
||||
href="/html-tailwind/"
|
||||
data-page="/html-tailwind/"
|
||||
class="nav-link px-3 py-2 rounded text-sm text-blue-600 hover:bg-neutral-100 hover:text-blue-800 transition-colors"
|
||||
>HTML & Tailwind</a
|
||||
>
|
||||
<a
|
||||
href="/react/"
|
||||
data-page="/react/"
|
||||
class="nav-link px-3 py-2 rounded text-sm text-blue-600 hover:bg-neutral-100 hover:text-blue-800 transition-colors"
|
||||
>React</a
|
||||
>
|
||||
<a
|
||||
href="/react-background/"
|
||||
data-page="/react-background/"
|
||||
class="nav-link px-3 py-2 rounded text-sm text-blue-600 hover:bg-neutral-100 hover:text-blue-800 transition-colors"
|
||||
>React Background</a
|
||||
>
|
||||
<a
|
||||
href="/react-tailwind/"
|
||||
data-page="/react-tailwind/"
|
||||
class="nav-link px-3 py-2 rounded text-sm text-blue-600 hover:bg-neutral-100 hover:text-blue-800 transition-colors"
|
||||
>React & Tailwind</a
|
||||
>
|
||||
</nav>
|
||||
<main class="flex-1 overflow-hidden">
|
||||
<iframe
|
||||
id="preview"
|
||||
src="/html/"
|
||||
class="w-full h-full border-0"
|
||||
title="player demo"
|
||||
></iframe>
|
||||
</main>
|
||||
</div>
|
||||
<script>
|
||||
const iframe = document.getElementById('preview');
|
||||
const links = document.querySelectorAll('.nav-link');
|
||||
|
||||
function setActive(page) {
|
||||
for (const link of links) {
|
||||
const isActive = link.dataset.page === page;
|
||||
link.classList.toggle('bg-neutral-200', isActive);
|
||||
link.classList.toggle('font-semibold', isActive);
|
||||
link.classList.toggle('text-blue-800', isActive);
|
||||
}
|
||||
}
|
||||
|
||||
setActive('/html/');
|
||||
|
||||
for (const link of links) {
|
||||
link.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
const page = link.dataset.page;
|
||||
iframe.src = page;
|
||||
setActive(page);
|
||||
history.replaceState(null, '', page === '/html/' ? '/' : page);
|
||||
});
|
||||
}
|
||||
|
||||
// Restore active state from URL on load
|
||||
const initial =
|
||||
location.pathname === '/' ? '/html/' : location.pathname.replace(/([^/])$/, '$1/');
|
||||
const match = [...links].find((l) => l.dataset.page === initial);
|
||||
if (match) {
|
||||
iframe.src = initial;
|
||||
setActive(initial);
|
||||
}
|
||||
</script>
|
||||
<body class="font-sans text-zinc-950 antialiased h-screen overflow-hidden">
|
||||
<div id="root" class="h-full"></div>
|
||||
<script type="module" src="./main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import { App } from './shell/app';
|
||||
|
||||
createRoot(document.getElementById('root')!).render(<App />);
|
||||
Reference in New Issue
Block a user