Skip to content

Commit

Permalink
Add dark mode image for Liberty
Browse files Browse the repository at this point in the history
  • Loading branch information
tjwds committed Jun 12, 2024
1 parent aba2899 commit 90e87e2
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 25 deletions.
59 changes: 36 additions & 23 deletions app/components/Icons.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Arrow } from "~/components/Arrow";

interface IconProp {
darkModeImageHref?: string;
description?: string;
href: string;
imageHref: string;
Expand All @@ -15,30 +16,42 @@ interface IconsProps {
export function Icons({ icons, imageClassName }: IconsProps) {
return (
<ol className="icons">
{icons.map(({ description, href, imageHref, name }) => (
<li className="icon-list" key={name}>
<div className="icon">
<img
alt={`${name} logo`}
className={imageClassName}
src={imageHref}
/>
<div className="icon-info">
<a href={href} rel="noreferrer" target="_blank">
<h3 className="larger">
{name}{" "}
<Arrow
className="arrow-out medium"
label="External link indication arrow"
rotate={-45}
/>
</h3>
</a>
{description && <p className="smaller">{description}</p>}
{icons.map(
({ darkModeImageHref, description, href, imageHref, name }) => (
<li className="icon-list" key={name}>
<div className="icon">
<img
alt={`${name} logo`}
className={
(imageClassName ?? "") +
(darkModeImageHref ? " only-light" : "")
}
src={imageHref}
/>
{darkModeImageHref && (
<img
alt={`${name} logo`}
className={(imageClassName ?? "") + " only-dark"}
src={darkModeImageHref}
/>
)}
<div className="icon-info">
<a href={href} rel="noreferrer" target="_blank">
<h3 className="larger">
{name}{" "}
<Arrow
className="arrow-out medium"
label="External link indication arrow"
rotate={-45}
/>
</h3>
</a>
{description && <p className="smaller">{description}</p>}
</div>
</div>
</div>
</li>
))}
</li>
)
)}
</ol>
);
}
3 changes: 2 additions & 1 deletion app/data/sponsors.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
"name": "Indy Hall"
},
{
"darkModeImageHref": "/assets/logos/liberty.png",
"description": "The essential destination site for technical job seekers.",
"href": "https://libertyjobs.com",
"imageHref": "/assets/logos/liberty.png",
"imageHref": "/assets/logos/liberty-regular.png",
"name": "Liberty Jobs"
}
]
Expand Down
12 changes: 12 additions & 0 deletions app/root.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,21 @@ p {
color: var(--color-background);
}

.only-dark {
display: none;
}

@media (prefers-color-scheme: dark) {
:root {
--color-background: #323330;
--color-foreground: #efdb4f;
}

.only-dark {
display: block;
}

.only-light {
display: none;
}
}
2 changes: 1 addition & 1 deletion app/routes/sponsors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { constructSiteTitle } from "~/utils/common";

interface LoaderData {
currentSponsors: Record<
"description" | "href" | "imageHref" | "name",
"darkModeImageHref" | "description" | "href" | "imageHref" | "name",
string
>[];
}
Expand Down
Binary file added public/assets/logos/liberty-regular.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 90e87e2

Please sign in to comment.