Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
210 changes: 180 additions & 30 deletions examples/css/browser.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,75 +4,202 @@
box-sizing: border-box;
}

:root {
color-scheme: dark;

--color-bg: #121212; /* page base / behind iframe */
--color-surface: #1a1a1a; /* sidebar */
--color-surface-raised: #242424; /* search input, QR modal, hamburger */
--color-border: #333;
--color-text: #e0e0e0;
--color-text-dim: #999;
--color-accent: #f60; /* PlayCanvas orange */
--color-accent-soft: rgba(255, 102, 0, 0.15);
--color-focus: #ff8533;
}

/* Base layout */
body {
font-family: system-ui, -apple-system, sans-serif;
display: grid;
grid-template-columns: minmax(250px, max-content) 1fr;
grid-template-columns: 300px 1fr;
background: var(--color-bg);
color: var(--color-text);
}

:focus-visible {
outline: 2px solid var(--color-focus);
outline-offset: -2px;
}

/* Hide menu toggle by default */
.menu-toggle {
display: none;
color: #2c3e50;
color: var(--color-text);
}

/* Sidebar */
.sidebar {
background: #f5f5f5;
padding: 20px;
padding-top: max(20px, env(safe-area-inset-top));
padding-left: max(20px, env(safe-area-inset-left));
padding-bottom: max(20px, env(safe-area-inset-bottom));
border-right: 1px solid #ddd;
overflow-y: auto;
min-width: 250px;
width: max-content;
display: flex;
flex-direction: column;
background: var(--color-surface);
border-right: 1px solid var(--color-border);
height: 100dvh;
padding-left: env(safe-area-inset-left);
}

/* Header styles */
.header {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 24px;
padding: 20px 16px 16px;
padding-top: max(20px, env(safe-area-inset-top));
}

.logo {
width: 40px;
height: 40px;
border-radius: 8px;
}

.header h2 {
font-size: 18px;
line-height: 1.2;
font-size: 16px;
line-height: 1.25;
font-weight: 600;
color: #2c3e50;
color: var(--color-text);
}

.github-link {
display: flex;
align-items: center;
justify-content: center;
margin-left: auto;
padding: 6px;
border-radius: 6px;
color: var(--color-text-dim);
transition: color 0.2s;
}

.github-link:hover {
color: var(--color-text);
}

/* Search */
.search {
display: flex;
align-items: center;
position: relative;
margin: 0 16px 12px;
}

.search-icon {
position: absolute;
left: 11px;
color: var(--color-text-dim);
pointer-events: none;
}

#search-input {
width: 100%;
padding: 8px 12px 8px 34px;
font-size: 13px;
font-family: inherit;
color: var(--color-text);
background: var(--color-surface-raised);
border: 1px solid var(--color-border);
border-radius: 6px;
outline: none;
transition: border-color 0.2s;
}

#search-input::placeholder {
color: var(--color-text-dim);
}

#search-input:focus {
border-color: var(--color-accent);
}

/* Example list styles */
#example-list {
flex: 1;
overflow-y: auto;
padding: 0 12px;
padding-bottom: max(12px, env(safe-area-inset-bottom));
scrollbar-width: thin;
scrollbar-color: var(--color-border) transparent;
}

#example-list::-webkit-scrollbar {
width: 8px;
}

#example-list::-webkit-scrollbar-track {
background: transparent;
}

#example-list::-webkit-scrollbar-thumb {
background: var(--color-border);
border-radius: 4px;
}

#example-list::-webkit-scrollbar-thumb:hover {
background: #4a4a4a;
}

.category-title {
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--color-text-dim);
margin: 16px 8px 4px;
}

.category:first-of-type .category-title {
margin-top: 4px;
}

.hidden {
display: none !important;
}

.no-results {
padding: 16px 8px;
font-size: 13px;
color: var(--color-text-dim);
}

.example-link {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 12px;
margin: 4px 0;
border-radius: 4px;
color: #2c3e50;
gap: 8px;
padding: 7px 8px 7px 12px;
margin: 1px 0;
border-radius: 6px;
color: var(--color-text);
font-size: 14px;
text-decoration: none;
transition: background-color 0.2s;
transition: background-color 0.15s;
}

.example-link:hover {
background-color: #ffe0cc;
background-color: var(--color-accent-soft);
}

.example-link.active {
background-color: #ff8533;
background-color: var(--color-accent);
color: white;
}

.link-buttons {
display: flex;
gap: 4px;
flex-shrink: 0;
}

.qr-button,
.open-in-new {
display: flex;
Expand All @@ -92,7 +219,7 @@ body {
.qr-button:hover,
.open-in-new:hover {
opacity: 1;
background: rgba(0, 0, 0, 0.1);
background: rgba(255, 255, 255, 0.1);
}

.qr-button svg,
Expand All @@ -110,6 +237,12 @@ body {
width: 100%;
height: 100%;
border: none;
background: var(--color-bg);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
display: none;
}

/* Mobile styles */
Expand All @@ -127,8 +260,8 @@ body {
left: max(16px, env(safe-area-inset-left));
width: 40px;
height: 40px;
background: rgba(255, 255, 255, 0.9);
border: 1px solid #ddd;
background: rgba(26, 26, 26, 0.9);
border: 1px solid var(--color-border);
border-radius: 8px;
z-index: 999;
cursor: pointer;
Expand All @@ -151,6 +284,15 @@ body {

.sidebar.open {
transform: translateX(0);
box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

.sidebar-overlay.open {
display: block;
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 999;
}

.main {
Expand All @@ -168,14 +310,15 @@ body {
left: 50%;
transform: translate(-50%, -50%);
padding: 0;
border: none;
border-radius: 8px;
background: white;
border: 1px solid var(--color-border);
border-radius: 12px;
background: var(--color-surface-raised);
color: var(--color-text);
margin: 0;
}

#qr-modal::backdrop {
background: rgba(0, 0, 0, 0.5);
background: rgba(0, 0, 0, 0.7);
}

.qr-modal-content {
Expand All @@ -185,7 +328,14 @@ body {

.qr-modal-content p {
margin-top: 16px;
color: #2c3e50;
font-size: 14px;
color: var(--color-text-dim);
}

#qr-code {
background: #fff;
padding: 12px;
border-radius: 8px;
}

#qr-code img {
Expand Down
20 changes: 15 additions & 5 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<meta property="og:type" content="website">

<!-- Theme Color for Mobile Browsers -->
<meta name="theme-color" content="#ffffff">
<meta name="theme-color" content="#1a1a1a">

<!-- PWA -->
<meta name="mobile-web-app-capable" content="yes">
Expand All @@ -37,11 +37,21 @@
<aside class="sidebar">
<header class="header">
<img src="img/playcanvas.png" alt="PlayCanvas Logo" class="logo">
<div>
<h2>PlayCanvas<br>Web Components</h2>
</div>
<h2>PlayCanvas<br>Web Components</h2>
<a class="github-link" href="https://github.com/playcanvas/web-components" target="_blank" rel="noopener" aria-label="View on GitHub">
<svg width="20" height="20" viewBox="0 0 16 16" aria-hidden="true">
<path fill="currentColor" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"/>
</svg>
</a>
</header>
<nav id="example-list"></nav>
<div class="search">
<svg class="search-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true">
<circle cx="11" cy="11" r="8"/>
<line x1="21" y1="21" x2="16.65" y2="16.65"/>
</svg>
<input type="search" id="search-input" placeholder="Search examples" autocomplete="off" spellcheck="false" aria-label="Search examples">
</div>
<nav id="example-list" aria-label="Examples"></nav>
</aside>
<main class="main">
<iframe id="example-frame" allow="fullscreen; xr-spatial-tracking;"></iframe>
Expand Down
Loading