Skip to content

Commit d83d527

Browse files
authored
fix(docs): add View Code button to showcase lightbox + flip v1.6.0 → v1.6.1 (#17)
Two surfaces flagged on the deployed site: 1. Lightbox missing "View Code" button The regular gallery card already renders both "View PDF" + "View Code" links (renderCard, line 374-375), but the lightbox modal that opens when you click a Featured tile only had "Open PDF". Reading the source on GitHub from a featured example required closing the lightbox and finding the same example in the gallery below. Fixed by: - threading `code` through `renderHighlight` so the highlight button carries `data-code` like the regular card already did; - adding `data-code` to renderCard's preview button too (it was already in scope but never wired through to the lightbox); - adding a `.lightbox-code-link` anchor in `ensureLightbox` alongside the existing `.lightbox-pdf-link`; - extending `openLightbox(screenshot, pdf, code, title)` to set the new link's href, hiding the link when no code URL is available (e.g. "#" placeholder for examples without source). 2. v1.6.0 → v1.6.1 flip `softwareVersion` JSON-LD, `downloadUrl`, install snippets (Maven + Gradle), and the eyebrow tag in the hero all still read `v1.6.0`. Bumped to `v1.6.1` to match the release that's live on JitPack.
1 parent d6c2783 commit d83d527

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

docs/examples.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,15 @@
275275
function renderHighlight(ex, categoryId) {
276276
const screenshot = ex.screenshot || '';
277277
const pdf = ex.pdf || '';
278+
const code = ex.code || '#';
278279
const badge = CATEGORY_BADGE[categoryId] || '';
279280
return [
280281
'<article class="highlight-tile" data-id="' + escAttr(ex.id || '') + '" role="listitem">',
281282
' <button type="button" class="highlight-preview"',
282283
' data-action="lightbox"',
283284
' data-screenshot="' + escAttr(screenshot) + '"',
284285
' data-pdf="' + escAttr(pdf) + '"',
286+
' data-code="' + escAttr(code) + '"',
285287
' data-title="' + escAttr(ex.title || ex.id || '') + '"',
286288
' aria-label="Open preview for ' + escAttr(ex.title || ex.id || '') + '">',
287289
screenshot
@@ -359,6 +361,7 @@
359361
' data-action="lightbox"',
360362
' data-screenshot="' + escAttr(screenshot) + '"',
361363
' data-pdf="' + escAttr(pdf) + '"',
364+
' data-code="' + escAttr(code) + '"',
362365
' data-title="' + escAttr(ex.title || ex.id || '') + '"',
363366
' aria-label="Open preview for ' + escAttr(ex.title || ex.id || '') + '">',
364367
screenshot
@@ -412,7 +415,8 @@
412415
' <header class="lightbox-header">',
413416
' <h4 class="lightbox-title"></h4>',
414417
' <div class="lightbox-actions">',
415-
' <a class="example-action lightbox-pdf-link" target="_blank" rel="noopener">Open PDF</a>',
418+
' <a class="example-action lightbox-pdf-link" target="_blank" rel="noopener" aria-label="Open PDF">Open PDF</a>',
419+
' <a class="example-action example-action-ghost lightbox-code-link" target="_blank" rel="noopener" aria-label="Open source on GitHub">View Code</a>',
416420
' <button class="lightbox-close" type="button" aria-label="Close" data-close>&times;</button>',
417421
' </div>',
418422
' </header>',
@@ -434,12 +438,19 @@
434438
});
435439
return lightbox;
436440
}
437-
function openLightbox(screenshot, pdf, title) {
441+
function openLightbox(screenshot, pdf, code, title) {
438442
const lb = ensureLightbox();
439443
lb.querySelector('.lightbox-image').src = screenshot;
440444
lb.querySelector('.lightbox-image').alt = title + ' preview';
441445
lb.querySelector('.lightbox-title').textContent = title;
442446
lb.querySelector('.lightbox-pdf-link').href = pdf;
447+
const codeLink = lb.querySelector('.lightbox-code-link');
448+
if (code && code !== '#') {
449+
codeLink.href = code;
450+
codeLink.style.display = '';
451+
} else {
452+
codeLink.style.display = 'none';
453+
}
443454
lb.classList.add('is-open');
444455
lb.setAttribute('aria-hidden', 'false');
445456
document.body.classList.add('lightbox-open');
@@ -470,9 +481,10 @@
470481
e.preventDefault();
471482
const screenshot = trigger.dataset.screenshot;
472483
const pdf = trigger.dataset.pdf;
484+
const code = trigger.dataset.code;
473485
const title = trigger.dataset.title;
474486
if (screenshot) {
475-
openLightbox(screenshot, pdf, title);
487+
openLightbox(screenshot, pdf, code, title);
476488
} else if (pdf) {
477489
window.open(pdf, '_blank');
478490
}

docs/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
"applicationSubCategory": "Library",
4545
"operatingSystem": "Cross-platform (JVM 21+)",
4646
"programmingLanguage": "Java",
47-
"softwareVersion": "1.6.0",
47+
"softwareVersion": "1.6.1",
4848
"url": "https://demchaav.github.io/GraphCompose/",
49-
"downloadUrl": "https://jitpack.io/#DemchaAV/GraphCompose/v1.6.0",
49+
"downloadUrl": "https://jitpack.io/#DemchaAV/GraphCompose/v1.6.1",
5050
"image": "https://demchaav.github.io/GraphCompose/assets/logo/graphcompose-logo.png",
5151
"license": "https://github.com/DemchaAV/GraphCompose/blob/main/LICENSE",
5252
"author": {
@@ -151,7 +151,7 @@
151151
<main id="top">
152152
<section class="hero section-shell" aria-labelledby="hero-title">
153153
<div class="hero-copy">
154-
<p class="eyebrow">Java &middot; v1.6 &middot; MIT</p>
154+
<p class="eyebrow">Java &middot; v1.6.1 &middot; MIT</p>
155155
<h1 id="hero-title">Java PDF layout engine for structured business documents.</h1>
156156
<p class="hero-lead">Describe documents. Render polished PDFs. A semantic layout engine for Java services that need <b>structured, paginated, theme-driven</b> output &mdash; CVs, invoices, proposals, reports.</p>
157157
<p class="hero-text">No drawing API. No pixel arithmetic. You compose <code>ParagraphNode</code>, <code>TableNode</code>, <code>SectionNode</code>; GraphCompose handles measurement, pagination, fonts, and PDFBox rendering.</p>
@@ -208,7 +208,7 @@ <h4>Maven</h4>
208208
&lt;dependency&gt;
209209
&lt;groupId&gt;com.github.DemchaAV&lt;/groupId&gt;
210210
&lt;artifactId&gt;GraphCompose&lt;/artifactId&gt;
211-
&lt;version&gt;v1.6.0&lt;/version&gt;
211+
&lt;version&gt;v1.6.1&lt;/version&gt;
212212
&lt;/dependency&gt;</code></pre>
213213
</div>
214214
<div class="install-block">
@@ -219,7 +219,7 @@ <h4>Gradle</h4>
219219

220220
dependencies {
221221
implementation(
222-
'com.github.DemchaAV:GraphCompose:v1.6.0'
222+
'com.github.DemchaAV:GraphCompose:v1.6.1'
223223
)
224224
}</code></pre>
225225
</div>

0 commit comments

Comments
 (0)