123 lines
3.6 KiB
TypeScript
123 lines
3.6 KiB
TypeScript
import { html, cssManager } from '@design.estate/dees-element';
|
|
|
|
export const demoFunc = () => html`
|
|
<style>
|
|
.demo-container {
|
|
padding: 48px;
|
|
background: ${cssManager.bdTheme('#f8f9fa', '#0a0a0a')};
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 40px;
|
|
}
|
|
|
|
.section {
|
|
max-width: 900px;
|
|
width: 100%;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.section-title {
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
margin-bottom: 8px;
|
|
color: ${cssManager.bdTheme('#09090b', '#fafafa')};
|
|
}
|
|
|
|
.section-description {
|
|
font-size: 14px;
|
|
color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.preview-image {
|
|
height: 400px;
|
|
}
|
|
|
|
.preview-pdf {
|
|
height: 600px;
|
|
}
|
|
</style>
|
|
|
|
<div class="demo-container">
|
|
<div class="section">
|
|
<div class="section-title">Image Preview (URL)</div>
|
|
<div class="section-description">Auto-detects image from URL extension and renders with the image viewer.</div>
|
|
<dees-preview
|
|
class="preview-image"
|
|
url="https://images.unsplash.com/photo-1506744038136-46273834b3fb?w=1200"
|
|
filename="landscape.jpg"
|
|
></dees-preview>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<div class="section-title">PDF Preview (URL)</div>
|
|
<div class="section-description">Auto-detects PDF and displays with the PDF viewer including toolbar.</div>
|
|
<dees-preview
|
|
class="preview-pdf"
|
|
url="https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf"
|
|
filename="research-paper.pdf"
|
|
></dees-preview>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<div class="section-title">Code Preview (Text Content)</div>
|
|
<div class="section-description">TypeScript code displayed with syntax highlighting via the codebox.</div>
|
|
<dees-preview
|
|
filename="example.ts"
|
|
language="typescript"
|
|
.textContent=${`import { html, css } from 'lit';
|
|
|
|
export class MyComponent extends LitElement {
|
|
static styles = css\`
|
|
:host {
|
|
display: block;
|
|
padding: 16px;
|
|
}
|
|
\`;
|
|
|
|
render() {
|
|
return html\`<h1>Hello World</h1>\`;
|
|
}
|
|
}`}
|
|
></dees-preview>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<div class="section-title">Audio Preview (URL)</div>
|
|
<div class="section-description">Audio file detected by extension, shown with waveform player.</div>
|
|
<dees-preview
|
|
url="https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3"
|
|
filename="song.mp3"
|
|
></dees-preview>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<div class="section-title">Video Preview (URL)</div>
|
|
<div class="section-description">Video file detected from URL, rendered with custom video controls.</div>
|
|
<dees-preview
|
|
url="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
|
|
filename="big-buck-bunny.mp4"
|
|
></dees-preview>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<div class="section-title">Explicit Type Override</div>
|
|
<div class="section-description">Force content type to 'text' even though the URL has no extension.</div>
|
|
<dees-preview
|
|
contentType="text"
|
|
.textContent=${'This is plain text content.\nIt preserves whitespace and line breaks.\n\nUseful for log files, READMEs, etc.'}
|
|
filename="notes.txt"
|
|
></dees-preview>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<div class="section-title">Unknown Type</div>
|
|
<div class="section-description">When content type cannot be detected, shows a placeholder.</div>
|
|
<dees-preview
|
|
filename="data.bin"
|
|
contentType="unknown"
|
|
></dees-preview>
|
|
</div>
|
|
</div>
|
|
`;
|