Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add asset prefix #1

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @next/next/no-img-element */
import { GetStaticProps } from "next";
import { Submission } from "../../types";
import submissions from "../../public/submissions.json";
Expand All @@ -15,11 +16,15 @@ export const getStaticProps: GetStaticProps = async () => {
};

const Home: React.FC<Props> = ({ submissions }) => {
const assetPrefix = "/hackathon-tpac-2024"; // redundant path is workaround for gh pages to display images and submission routes correctly
return (
<div className="windows95-container">
{/* Hero Section */}
<section className="hero">
<img src="/icons/my-computer.png" alt="Hackathon icon" />
<img
src={`${assetPrefix}/icons/my-computer.png`}
alt="Hackathon icon"
/>
<h1>TPAC Hackathon 2024</h1>
<p>
Join fellow W3C attendees for a fun and fast-paced HTML/CSS challenge!
Expand Down Expand Up @@ -63,17 +68,17 @@ const Home: React.FC<Props> = ({ submissions }) => {
{submissions.map(submission => (
<div className="card" key={submission.slug}>
<img
src={submission.screenshot}
src={`${assetPrefix}/submissions/${submission.slug}.png`}
alt={`${submission.title} screenshot`}
/>
<h2>{submission.title}</h2>
<p>by {submission.author}</p>
<a
href={`/submissions/${submission.slug}.html`}
href={`${assetPrefix}/submissions/${submission.slug}.html`}
className="button"
>
<img
src="/icons/folder-open.png"
src={`${assetPrefix}/icons/folder-open.png`}
alt="View icon"
className="icon"
/>
Expand Down Expand Up @@ -166,11 +171,11 @@ const Home: React.FC<Props> = ({ submissions }) => {
providing snacks, drinks, and prizes!
</p>
<div className="sponsor-logos">
<img src="/logos/adobe.png" alt="Adobe" />
<img src="/logos/google.png" alt="Google" />
<img src="/logos/holopin.png" alt="Holopin" />
<img src="/logos/mozilla.png" alt="Mozilla" />
<img src="/logos/w3c.png" alt="W3C" />
<img src={`${assetPrefix}/logos/adobe.png`} alt="Adobe" />
<img src={`${assetPrefix}/logos/google.png`} alt="Google" />
<img src={`${assetPrefix}/logos/holopin.png`} alt="Holopin" />
<img src={`${assetPrefix}/logos/mozilla.png`} alt="Mozilla" />
<img src={`${assetPrefix}/logos/w3c.png`} alt="W3C" />
</div>
</section>

Expand Down
Loading