first commit

This commit is contained in:
2026-06-03 08:52:59 -07:00
parent 9a77f29133
commit 7ee48a2785
34 changed files with 3800 additions and 229 deletions
-210
View File
@@ -1,210 +0,0 @@
---
import astroLogo from '../assets/astro.svg';
import background from '../assets/background.svg';
---
<div id="container">
<img id="background" src={background.src} alt="" fetchpriority="high" />
<main>
<section id="hero">
<a href="https://astro.build"
><img src={astroLogo.src} width="115" height="48" alt="Astro Homepage" /></a
>
<h1>
To get started, open the <code><pre>src/pages</pre></code> directory in your project.
</h1>
<section id="links">
<a class="button" href="https://docs.astro.build">Read our docs</a>
<a href="https://astro.build/chat"
>Join our Discord <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 127.14 96.36"
><path
fill="currentColor"
d="M107.7 8.07A105.15 105.15 0 0 0 81.47 0a72.06 72.06 0 0 0-3.36 6.83 97.68 97.68 0 0 0-29.11 0A72.37 72.37 0 0 0 45.64 0a105.89 105.89 0 0 0-26.25 8.09C2.79 32.65-1.71 56.6.54 80.21a105.73 105.73 0 0 0 32.17 16.15 77.7 77.7 0 0 0 6.89-11.11 68.42 68.42 0 0 1-10.85-5.18c.91-.66 1.8-1.34 2.66-2a75.57 75.57 0 0 0 64.32 0c.87.71 1.76 1.39 2.66 2a68.68 68.68 0 0 1-10.87 5.19 77 77 0 0 0 6.89 11.1 105.25 105.25 0 0 0 32.19-16.14c2.64-27.38-4.51-51.11-18.9-72.15ZM42.45 65.69C36.18 65.69 31 60 31 53s5-12.74 11.43-12.74S54 46 53.89 53s-5.05 12.69-11.44 12.69Zm42.24 0C78.41 65.69 73.25 60 73.25 53s5-12.74 11.44-12.74S96.23 46 96.12 53s-5.04 12.69-11.43 12.69Z"
></path></svg
>
</a>
</section>
</section>
</main>
<a href="https://astro.build/blog/astro-6-beta/" id="news" class="box">
<svg width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg"
><path
d="M24.667 12c1.333 1.414 2 3.192 2 5.334 0 4.62-4.934 5.7-7.334 12C18.444 28.567 18 27.456 18 26c0-4.642 6.667-7.053 6.667-14Zm-5.334-5.333c1.6 1.65 2.4 3.43 2.4 5.333 0 6.602-8.06 7.59-6.4 17.334C13.111 27.787 12 25.564 12 22.666c0-4.434 7.333-8 7.333-16Zm-6-5.333C15.111 3.555 16 5.556 16 7.333c0 8.333-11.333 10.962-5.333 22-3.488-.774-6-4-6-8 0-8.667 8.666-10 8.666-20Z"
fill="#111827"></path></svg
>
<h2>What's New in Astro 6.0?</h2>
<p>
Redesigned dev server, fonts, live collections, built-in CSP support, and more! Click to
explore Astro 6.0's new features.
</p>
</a>
</div>
<style>
#background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
filter: blur(100px);
}
#container {
font-family: Inter, Roboto, 'Helvetica Neue', 'Arial Nova', 'Nimbus Sans', Arial, sans-serif;
height: 100%;
}
main {
height: 100%;
display: flex;
justify-content: center;
}
#hero {
display: flex;
align-items: start;
flex-direction: column;
justify-content: center;
padding: 16px;
}
h1 {
font-size: 22px;
margin-top: 0.25em;
}
#links {
display: flex;
gap: 16px;
}
#links a {
display: flex;
align-items: center;
padding: 10px 12px;
color: #111827;
text-decoration: none;
transition: color 0.2s;
}
#links a:hover {
color: rgb(78, 80, 86);
}
#links a svg {
height: 1em;
margin-left: 8px;
}
#links a.button {
color: white;
background: linear-gradient(83.21deg, #3245ff 0%, #bc52ee 100%);
box-shadow:
inset 0 0 0 1px rgba(255, 255, 255, 0.12),
inset 0 -2px 0 rgba(0, 0, 0, 0.24);
border-radius: 10px;
}
#links a.button:hover {
color: rgb(230, 230, 230);
box-shadow: none;
}
pre {
font-family:
ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono',
monospace;
font-weight: normal;
background: linear-gradient(14deg, #d83333 0%, #f041ff 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin: 0;
}
h2 {
margin: 0 0 1em;
font-weight: normal;
color: #111827;
font-size: 20px;
}
p {
color: #4b5563;
font-size: 16px;
line-height: 24px;
letter-spacing: -0.006em;
margin: 0;
}
code {
display: inline-block;
background:
linear-gradient(66.77deg, #f3cddd 0%, #f5cee7 100%) padding-box,
linear-gradient(155deg, #d83333 0%, #f041ff 18%, #f5cee7 45%) border-box;
border-radius: 8px;
border: 1px solid transparent;
padding: 6px 8px;
}
.box {
padding: 16px;
background: rgba(255, 255, 255, 1);
border-radius: 16px;
border: 1px solid white;
}
#news {
position: absolute;
bottom: 16px;
right: 16px;
max-width: 300px;
text-decoration: none;
transition: background 0.2s;
backdrop-filter: blur(50px);
}
#news:hover {
background: rgba(255, 255, 255, 0.55);
}
@media screen and (max-height: 368px) {
#news {
display: none;
}
}
@media screen and (max-width: 768px) {
#container {
display: flex;
flex-direction: column;
}
#hero {
display: block;
padding-top: 10%;
}
#links {
flex-wrap: wrap;
}
#links a.button {
padding: 14px 18px;
}
#news {
right: 16px;
left: 16px;
bottom: 2.5rem;
max-width: 100%;
}
h1 {
line-height: 1.5;
}
}
</style>
+20 -11
View File
@@ -1,23 +1,32 @@
---
interface Props {
title?: string;
description?: string;
}
const {
title = 'GenQBar — QR & Barcode Generator',
description = 'Free client-side QR code and barcode generator. No server, no tracking.',
} = Astro.props;
---
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content={description} />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="icon" href="/favicon.ico" />
<meta name="generator" content={Astro.generator} />
<title>Astro Basics</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap"
rel="stylesheet"
/>
<title>{title}</title>
</head>
<body>
<slot />
</body>
</html>
<style>
html,
body {
margin: 0;
width: 100%;
height: 100%;
}
</style>
+273 -5
View File
@@ -1,11 +1,279 @@
---
import Welcome from '../components/Welcome.astro';
import Layout from '../layouts/Layout.astro';
// Welcome to Astro! Wondering what to do next? Check out the Astro documentation at https://docs.astro.build
// Don't want to use any of this? Delete everything in this file, the `assets`, `components`, and `layouts` directories, and start fresh.
import '../styles/app.css';
---
<Layout>
<Welcome />
<nav class="nav">
<span class="nav-logo">GenQBar</span>
<a href="https://buglabs.dev" class="nav-back">← BugLabs.dev</a>
</nav>
<main class="container">
<h1 class="page-title">QR & Barcode Generator</h1>
<!-- Tab switcher -->
<div class="tab-switcher" role="tablist">
<button class="tab active" data-tab="qr" role="tab" aria-selected="true">
QR Code
</button>
<button class="tab" data-tab="barcode" role="tab" aria-selected="false">
Barcode
</button>
</div>
<!-- ── QR Code Panel ── -->
<section class="panel active" id="panel-qr" role="tabpanel">
<div class="panel-inner">
<div class="form-group">
<label for="qr-text">Text or URL</label>
<input
type="text"
id="qr-text"
placeholder="https://buglabs.dev"
autocomplete="off"
spellcheck="false"
/>
</div>
<div class="form-row">
<div class="form-group">
<label for="qr-ecl">Error Correction</label>
<div class="select-wrapper">
<select id="qr-ecl">
<option value="L">L — Low (7%)</option>
<option value="M" selected>M — Medium (15%)</option>
<option value="Q">Q — Quartile (25%)</option>
<option value="H">H — High (30%)</option>
</select>
</div>
</div>
<div class="form-group">
<label for="qr-size">Size</label>
<div class="select-wrapper">
<select id="qr-size">
<option value="128">128 px</option>
<option value="256" selected>256 px</option>
<option value="512">512 px</option>
</select>
</div>
</div>
</div>
<div class="preview" id="qr-preview">
<span class="preview-placeholder">Enter text above to generate a QR code</span>
</div>
<button class="btn-download" id="qr-download" disabled>Download SVG</button>
</div>
</section>
<!-- ── Barcode Panel ── -->
<section class="panel" id="panel-barcode" role="tabpanel">
<div class="panel-inner">
<div class="form-group">
<label for="bc-text">Value</label>
<input
type="text"
id="bc-text"
placeholder="123456789012"
autocomplete="off"
spellcheck="false"
/>
<span class="error-msg" id="bc-error"></span>
</div>
<div class="form-row">
<div class="form-group">
<label for="bc-format">Format</label>
<div class="select-wrapper">
<select id="bc-format">
<option value="CODE128">CODE128 (auto)</option>
<option value="CODE39">CODE39</option>
<option value="EAN13">EAN-13</option>
<option value="EAN8">EAN-8</option>
<option value="UPC">UPC-A</option>
</select>
</div>
</div>
<div class="form-group">
<label>Show Value</label>
<div class="toggle-row">
<label class="toggle" aria-label="Toggle display value">
<input type="checkbox" id="bc-display-value" checked />
<span class="toggle-track">
<span class="toggle-knob"></span>
</span>
</label>
<span class="toggle-label-text" id="bc-display-label">On</span>
</div>
</div>
</div>
<div class="preview" id="bc-preview">
<span class="preview-placeholder">Enter a value above to generate a barcode</span>
</div>
<button class="btn-download" id="bc-download" disabled>Download SVG</button>
</div>
</section>
</main>
</Layout>
<script>
import QRCode from 'qrcode';
import JsBarcode from 'jsbarcode';
// ── Element references ──────────────────────────────────────────────────
const qrText = document.getElementById('qr-text') as HTMLInputElement;
const qrEcl = document.getElementById('qr-ecl') as HTMLSelectElement;
const qrSize = document.getElementById('qr-size') as HTMLSelectElement;
const qrPreview = document.getElementById('qr-preview') as HTMLElement;
const qrDownload = document.getElementById('qr-download') as HTMLButtonElement;
const bcText = document.getElementById('bc-text') as HTMLInputElement;
const bcFormat = document.getElementById('bc-format') as HTMLSelectElement;
const bcDisplayValue = document.getElementById('bc-display-value') as HTMLInputElement;
const bcDisplayLabel = document.getElementById('bc-display-label') as HTMLElement;
const bcPreview = document.getElementById('bc-preview') as HTMLElement;
const bcDownload = document.getElementById('bc-download') as HTMLButtonElement;
const bcError = document.getElementById('bc-error') as HTMLElement;
// ── QR Code generation ──────────────────────────────────────────────────
async function generateQR(): Promise<void> {
const text = qrText.value.trim();
if (!text) {
qrPreview.innerHTML =
'<span class="preview-placeholder">Enter text above to generate a QR code</span>';
qrDownload.disabled = true;
return;
}
const size = parseInt(qrSize.value, 10);
const ecl = qrEcl.value as 'L' | 'M' | 'Q' | 'H';
try {
const svgString: string = await QRCode.toString(text, {
type: 'svg',
errorCorrectionLevel: ecl,
width: size,
margin: 2,
});
qrPreview.innerHTML = svgString;
qrDownload.disabled = false;
} catch {
qrPreview.innerHTML =
'<span class="preview-placeholder">Could not generate QR code for this input.</span>';
qrDownload.disabled = true;
}
}
// ── Barcode generation ──────────────────────────────────────────────────
function generateBarcode(): void {
const text = bcText.value.trim();
bcError.textContent = '';
bcError.classList.remove('visible');
if (!text) {
bcPreview.innerHTML =
'<span class="preview-placeholder">Enter a value above to generate a barcode</span>';
bcDownload.disabled = true;
return;
}
const svgEl = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
try {
JsBarcode(svgEl, text, {
format: bcFormat.value,
displayValue: bcDisplayValue.checked,
lineColor: '#000000',
background: '#ffffff',
width: 2,
height: 80,
fontSize: 14,
font: 'Space Grotesk, system-ui, sans-serif',
textAlign: 'center',
textPosition: 'bottom',
textMargin: 4,
margin: 10,
});
bcPreview.innerHTML = '';
bcPreview.appendChild(svgEl);
bcDownload.disabled = false;
} catch (err) {
const msg = err instanceof Error ? err.message : 'Invalid value for this format';
bcError.textContent = msg;
bcError.classList.add('visible');
bcPreview.innerHTML =
'<span class="preview-placeholder">Fix the error above and try again.</span>';
bcDownload.disabled = true;
}
}
// ── Live preview with debounce ──────────────────────────────────────────
let qrDebounce: ReturnType<typeof setTimeout>;
let bcDebounce: ReturnType<typeof setTimeout>;
qrText.addEventListener('input', () => {
clearTimeout(qrDebounce);
qrDebounce = setTimeout(generateQR, 300);
});
qrEcl.addEventListener('change', generateQR);
qrSize.addEventListener('change', generateQR);
bcText.addEventListener('input', () => {
clearTimeout(bcDebounce);
bcDebounce = setTimeout(generateBarcode, 300);
});
bcFormat.addEventListener('change', generateBarcode);
bcDisplayValue.addEventListener('change', () => {
bcDisplayLabel.textContent = bcDisplayValue.checked ? 'On' : 'Off';
generateBarcode();
});
// ── Tab switching ───────────────────────────────────────────────────────
const tabs = document.querySelectorAll<HTMLButtonElement>('.tab');
const panels = document.querySelectorAll<HTMLElement>('.panel');
tabs.forEach((tab) => {
tab.addEventListener('click', () => {
tabs.forEach((t) => {
t.classList.remove('active');
t.setAttribute('aria-selected', 'false');
});
panels.forEach((p) => p.classList.remove('active'));
tab.classList.add('active');
tab.setAttribute('aria-selected', 'true');
const targetId = `panel-${tab.dataset.tab}`;
document.getElementById(targetId)?.classList.add('active');
});
});
// ── SVG download ────────────────────────────────────────────────────────
function downloadSVG(container: HTMLElement, filename: string): void {
const svg = container.querySelector('svg');
if (!svg) return;
const serializer = new XMLSerializer();
const svgStr = serializer.serializeToString(svg);
const blob = new Blob([svgStr], { type: 'image/svg+xml;charset=utf-8' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = filename;
a.click();
URL.revokeObjectURL(url);
}
qrDownload.addEventListener('click', () => downloadSVG(qrPreview, 'qrcode.svg'));
bcDownload.addEventListener('click', () => downloadSVG(bcPreview, 'barcode.svg'));
</script>
+346
View File
@@ -0,0 +1,346 @@
:root {
--font-body: 'Space Grotesk', system-ui, sans-serif;
--font-mono: 'Space Mono', 'Courier New', monospace;
--color-bg: #ffffff;
--color-text: #000000;
--accent-red: #ff0000;
--accent-green: #00522b;
--border: 3px solid #000000;
--shadow: 5px 5px #000000;
--shadow-hover: 3px 3px #000000;
--gap: 1.5rem;
}
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
}
body {
font-family: var(--font-body);
background: var(--color-bg);
color: var(--color-text);
min-height: 100vh;
line-height: 1.5;
}
/* ── Nav ── */
.nav {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 2rem;
border-bottom: var(--border);
}
.nav-logo {
font-size: 1.4rem;
font-weight: 700;
letter-spacing: -0.02em;
font-family: var(--font-mono);
}
.nav-back {
display: inline-block;
padding: 0.4rem 0.9rem;
border: var(--border);
box-shadow: var(--shadow-hover);
font-weight: 700;
font-size: 0.85rem;
text-decoration: none;
color: var(--color-text);
transition: box-shadow 0.1s, transform 0.1s;
}
.nav-back:hover {
box-shadow: none;
transform: translate(3px, 3px);
}
/* ── Main container ── */
.container {
max-width: 860px;
margin: 0 auto;
padding: 2.5rem 2rem 4rem;
}
.page-title {
font-size: clamp(1.6rem, 4vw, 2.4rem);
font-weight: 700;
letter-spacing: -0.03em;
margin-bottom: 2rem;
}
/* ── Tab switcher ── */
.tab-switcher {
display: inline-flex;
border: var(--border);
box-shadow: var(--shadow);
margin-bottom: 2rem;
}
.tab {
padding: 0.7rem 1.6rem;
font-family: var(--font-body);
font-size: 0.95rem;
font-weight: 700;
background: var(--color-bg);
color: var(--color-text);
border: none;
cursor: pointer;
text-transform: uppercase;
letter-spacing: 0.04em;
transition: background 0.1s, color 0.1s;
}
.tab + .tab {
border-left: var(--border);
}
.tab.active,
.tab[aria-selected='true'] {
background: var(--color-text);
color: var(--color-bg);
}
/* ── Panel ── */
.panel {
display: none;
}
.panel.active {
display: block;
}
.panel-inner {
border: var(--border);
box-shadow: var(--shadow);
padding: 2rem;
}
/* ── Form elements ── */
.form-group {
margin-bottom: 1.5rem;
}
.form-row {
display: flex;
gap: 1.2rem;
}
.form-row .form-group {
flex: 1;
}
label {
display: block;
font-weight: 700;
font-size: 0.8rem;
text-transform: uppercase;
letter-spacing: 0.07em;
margin-bottom: 0.5rem;
}
input[type='text'],
select {
width: 100%;
border: var(--border);
padding: 0.65rem 0.9rem;
font-family: var(--font-body);
font-size: 1rem;
background: var(--color-bg);
color: var(--color-text);
box-shadow: var(--shadow);
outline: none;
appearance: none;
-webkit-appearance: none;
transition: box-shadow 0.1s, transform 0.1s;
}
input[type='text']:focus,
select:focus {
box-shadow: var(--shadow-hover);
transform: translate(2px, 2px);
}
/* custom select arrow */
.select-wrapper {
position: relative;
}
.select-wrapper::after {
content: '▾';
position: absolute;
right: 0.9rem;
top: 50%;
transform: translateY(-50%);
pointer-events: none;
font-size: 0.9rem;
font-weight: 700;
}
.select-wrapper select {
padding-right: 2.2rem;
cursor: pointer;
}
/* ── Toggle ── */
.toggle-row {
display: flex;
align-items: center;
gap: 0.75rem;
margin-top: 0.5rem;
}
.toggle {
position: relative;
display: inline-block;
width: 48px;
height: 26px;
cursor: pointer;
flex-shrink: 0;
}
.toggle input {
opacity: 0;
width: 0;
height: 0;
position: absolute;
}
.toggle-track {
position: absolute;
inset: 0;
border: var(--border);
background: var(--color-bg);
transition: background 0.15s;
}
.toggle-knob {
position: absolute;
top: 2px;
left: 2px;
width: 16px;
height: 16px;
background: var(--color-text);
transition: transform 0.15s;
}
.toggle input:checked + .toggle-track {
background: var(--color-text);
}
.toggle input:checked + .toggle-track .toggle-knob {
transform: translateX(22px);
background: var(--color-bg);
}
.toggle-label-text {
font-weight: 700;
font-size: 0.8rem;
text-transform: uppercase;
letter-spacing: 0.07em;
}
/* ── Preview ── */
.preview {
border: var(--border);
box-shadow: var(--shadow);
min-height: 220px;
display: flex;
align-items: center;
justify-content: center;
margin-top: 0.5rem;
margin-bottom: 1.5rem;
background: var(--color-bg);
overflow: hidden;
}
.preview svg {
max-width: 100%;
height: auto;
display: block;
}
.preview-placeholder {
font-family: var(--font-mono);
font-size: 0.85rem;
color: #666;
text-align: center;
padding: 1rem;
}
/* ── Error ── */
.error-msg {
display: none;
color: var(--accent-red);
font-weight: 700;
font-size: 0.82rem;
margin-top: 0.4rem;
font-family: var(--font-mono);
}
.error-msg.visible {
display: block;
}
/* ── Buttons ── */
.btn-download {
display: inline-block;
background: var(--accent-red);
color: #ffffff;
border: var(--border);
box-shadow: var(--shadow);
padding: 0.75rem 1.8rem;
font-family: var(--font-body);
font-weight: 700;
font-size: 0.95rem;
text-transform: uppercase;
letter-spacing: 0.06em;
cursor: pointer;
transition: box-shadow 0.1s, transform 0.1s;
}
.btn-download:hover:not(:disabled) {
box-shadow: var(--shadow-hover);
transform: translate(2px, 2px);
}
.btn-download:disabled {
opacity: 0.4;
cursor: not-allowed;
box-shadow: none;
}
/* ── Responsive ── */
@media (max-width: 600px) {
.nav {
padding: 0.8rem 1rem;
}
.container {
padding: 1.5rem 1rem 3rem;
}
.panel-inner {
padding: 1.2rem;
}
.form-row {
flex-direction: column;
gap: 0;
}
.tab {
padding: 0.6rem 1rem;
font-size: 0.85rem;
}
}