lightview
Version:
A reactive UI library with features of Bau, Juris, and HTMX plus safe LLM UI generation
264 lines (244 loc) • 14.1 kB
HTML
<!-- SEO-friendly SPA Shim -->
<script src="/lightview-router.js"></script>
<script>
if (globalThis.LightviewRouter) {
LightviewRouter.base('/index.html');
}
</script>
<!-- Load the page-specific stylesheet -->
<link rel="stylesheet" href="./index.css">
<!-- Gallery Structure -->
<div class="gallery-page">
<div class="gallery-layout">
<!-- Sidebar Overlay -->
<div id="sidebar-overlay" class="sidebar-overlay"></div>
<!-- Sidebar -->
<div id="gallery-sidebar" class="gallery-sidebar" style="visibility: hidden" src="./component-nav.html"></div>
<!-- Main Content -->
<div id="gallery-main" class="gallery-main">
<!-- Header Container -->
<div
style="position: sticky; top: 0; z-index: 30; background: var(--gallery-surface); border-bottom: 1px solid var(--gallery-border); backdrop-filter: blur(8px);">
<!-- Breadcrumbs Row -->
<div style="padding: 0.75rem 1.5rem 0;">
<script>
(() => {
const { Breadcrumbs } = Lightview.tags;
const breadcrumbs = Breadcrumbs({
id: 'page-breadcrumbs',
items: [
{ label: 'Components', href: '/docs/components' },
{ label: 'Hero' }
]
});
document.currentScript.replaceWith(breadcrumbs.domEl);
})();
</script>
</div>
<!-- Title Row -->
<div class="gallery-header"
style="border-bottom: none; height: auto; padding-top: 0.5rem; padding-bottom: 0.75rem;">
<button id="toggle-btn" class="toggle-btn" aria-label="Toggle Sidebar">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="toggle-icon"
style="stroke: currentColor; stroke-width: 2;">
<path stroke-linecap="round" stroke-linejoin="round" d="M15 19l-7-7 7-7" />
<path stroke-linecap="round" stroke-linejoin="round" d="M11 19l-7-7 7-7" />
</svg>
</button>
<h1 class="gallery-title">Hero</h1>
</div>
</div>
<!-- Content -->
<div class="gallery-content">
<div class="section-content" style="max-width: 1000px;">
<p class="text-lg" style="opacity: 0.7; margin-bottom: 1.5rem;">
Hero is a large banner section with centered content.
Perfect for landing pages and feature highlights.
</p>
<!-- Basic Example with Examplify -->
<div class="card bg-base-200" style="margin-bottom: 2rem;">
<div class="card-body">
<h2 class="card-title">Basic Example</h2>
<p class="text-sm" style="opacity: 0.7; margin-bottom: 1rem;">Centered hero with
call-to-action</p>
<!-- Tabs -->
<script>
globalThis.switchSyntaxTab = (tabId) => {
const tabs = ['tagged', 'vdom', 'object'];
tabs.forEach(t => {
const tabEl = document.getElementById(`tab-btn-${t}`);
const contentEl = document.getElementById(`syntax-${t}`);
if (t === tabId) {
tabEl.classList.add('syntax-tab-active');
contentEl.style.display = 'block';
} else {
tabEl.classList.remove('syntax-tab-active');
contentEl.style.display = 'none';
}
});
};
</script>
<div role="tablist" class="syntax-tabs" style="margin-bottom: 1rem;">
<button id="tab-btn-tagged" role="tab" class="syntax-tab syntax-tab-active"
onclick="switchSyntaxTab('tagged')">Tagged</button>
<button id="tab-btn-vdom" role="tab" class="syntax-tab"
onclick="switchSyntaxTab('vdom')">vDOM</button>
<button id="tab-btn-object" role="tab" class="syntax-tab"
onclick="switchSyntaxTab('object')">Object
DOM</button>
</div>
<!-- Tagged Syntax -->
<div id="syntax-tagged">
<pre><script>
examplify(document.currentScript.nextElementSibling, {
at: document.currentScript.parentElement,
scripts: ['/lightview.js', '/lightview-x.js'],
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
type: 'module',
minHeight: 280,
autoRun: true
});
</script><code contenteditable="true">await import('/components/layout/hero.js');
await import('/components/actions/button.js');
const { tags, $ } = Lightview;
const { h1, p, Hero, Button } = tags;
const hero = Hero({ style: 'background-color: oklch(var(--b2)); min-height: 16rem; border-radius: 1rem;' },
Hero.Content({ position: 'center' },
h1({ style: 'font-size: 3rem; line-height: 1; font-weight: 800;' }, '🚀 Hello Lightview'),
p({ style: 'padding: 1.5rem 0; max-width: 28rem;' },
'Build reactive UIs with a lightweight, powerful library.'
),
Button({ color: 'primary' }, 'Get Started')
)
);
$('#example').content(hero);</code></pre>
</div>
<!-- vDOM Syntax -->
<div id="syntax-vdom" style="display: none;">
<pre><script>
examplify(document.currentScript.nextElementSibling, {
at: document.currentScript.parentElement,
scripts: ['/lightview.js', '/lightview-x.js'],
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
type: 'module',
minHeight: 280
});
</script><code contenteditable="true">await import('/components/layout/hero.js');
await import('/components/actions/button.js');
const { $, tags } = Lightview;
const { Hero, Button, h1, p } = tags;
const hero = {
tag: Hero,
attributes: { style: 'background-color: oklch(var(--b2)); min-height: 16rem; border-radius: 1rem;' },
children: [
{
tag: Hero.Content,
attributes: { position: 'center' },
children: [
{ tag: h1, attributes: { style: 'font-size: 3rem; line-height: 1; font-weight: 800;' }, children: ['🚀 Hello Lightview'] },
{
tag: p,
attributes: { style: 'padding: 1.5rem 0; max-width: 28rem' },
children: ['Build reactive UIs with a lightweight, powerful library.']
},
{ tag: Button, attributes: { color: 'primary' }, children: ['Get Started'] }
]
}
]
};
$('#example').content(hero);</code></pre>
</div>
<!-- Object DOM Syntax -->
<div id="syntax-object" style="display: none;">
<pre><script>
examplify(document.currentScript.nextElementSibling, {
at: document.currentScript.parentElement,
scripts: ['/lightview.js', '/lightview-x.js'],
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
type: 'module',
minHeight: 280
});
</script><code contenteditable="true">await import('/components/layout/hero.js');
await import('/components/actions/button.js');
const { $ } = Lightview;
const hero = {
Hero: {
style: 'background-color: oklch(var(--b2)); min-height: 16rem; border-radius: 1rem;',
children: [
{
'Hero.Content': {
position: 'center',
children: [
{ h1: { style: 'font-size: 3rem; line-height: 1; font-weight: 800;', children: ['🚀 Hello Lightview'] } },
{ p: { style: 'padding: 1.5rem 0; max-width: 28rem;', children: ['Build reactive UIs with a lightweight, powerful library.'] } },
{ Button: { color: 'primary', children: ['Get Started'] } }
]
}
}
]
}
};
$('#example').content(hero);</code></pre>
</div>
</div>
</div>
<!-- Props Table -->
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">Sub-components</h2>
<div style="overflow-x: auto; margin-bottom: 2rem;">
<table class="table table-zebra">
<thead>
<tr>
<th>Component</th>
<th>Props</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Hero.Content</code></td>
<td>center</td>
<td>Content container</td>
</tr>
<tr>
<td><code>Hero.Overlay</code></td>
<td>-</td>
<td>Dark overlay for background images</td>
</tr>
</tbody>
</table>
</div>
<!-- Static Examples -->
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">With Figure</h2>
<div class="hero rounded-box"
style="background-color: oklch(var(--b2)); min-height: 16rem; margin-bottom: 2rem;">
<div class="hero-content" style="display: flex; flex-direction: column; gap: 2rem;">
<!-- lg:flex-row replacement with style would normally need media queries, but we can use flex-wrap or just leave as is if simple enough -->
<img src="https://picsum.photos/300/200"
style="max-width: 24rem; border-radius: 0.5rem; box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);"
alt="Hero" />
<div>
<h1 style="font-size: 3rem; line-height: 1; font-weight: 800;">Box Office News!</h1>
<p style="padding: 1.5rem 0;">Provident cupiditate voluptatem et in.</p>
<button class="btn btn-primary">Get Started</button>
</div>
</div>
</div>
<h2 class="text-xl font-bold" style="margin-bottom: 1rem;">With Overlay</h2>
<div class="hero"
style="background-image: url(https://picsum.photos/800/400); min-height: 16rem; border-radius: 1rem; margin-bottom: 2rem; position: relative; overflow: hidden;">
<div class="hero-overlay"
style="background-color: rgba(0,0,0,0.6); position: absolute; inset: 0;"></div>
<div class="hero-content text-center"
style="color: oklch(var(--nc)); position: relative; z-index: 1;">
<div style="max-width: 28rem;">
<h1 style="margin-bottom: 1.25rem; font-size: 3rem; line-height: 1; font-weight: 800;">
Hello there</h1>
<p style="margin-bottom: 1.25rem;">Provident cupiditate voluptatem et in.</p>
<button class="btn btn-primary">Get Started</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>