Skip to content

Commit

Permalink
Update Github Link
Browse files Browse the repository at this point in the history
The "see it on github!" link was not updated.
  • Loading branch information
greggman committed Mar 9, 2024
1 parent e8e1d1b commit 00a6c8b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function getElem(

const sampleListElem = getElem('#samplelist');
const sampleElem = getElem('#sample');
const githubElem = getElem('#src') as HTMLAnchorElement;
const introElem = getElem('#intro');
const codeTabsElem = getElem('#codeTabs');
const sourcesElem = getElem('#sources');
Expand Down Expand Up @@ -130,6 +131,15 @@ function setSampleIFrame(
sampleContainerElem.appendChild(el('iframe', { src }));
sampleContainerElem.style.height = sources.length > 0 ? '600px' : '100%';

if (url) {
// If it's remote example, hide the github link and assume it's in the description.
githubElem.style.display = 'none';
} else {
// It's a local sample so show the github link.
githubElem.style.display = '';
githubElem.href = `https://github.com/webgpu/webgpu-samples/tree/main/${filename}`;
}

// hide intro and show sample
introElem.style.display = 'none';
sampleElem.style.display = '';
Expand Down

0 comments on commit 00a6c8b

Please sign in to comment.