Skip to content

Commit

Permalink
update image path to account for non-root urls
Browse files Browse the repository at this point in the history
  • Loading branch information
ethangardner committed Dec 12, 2024
1 parent de164eb commit f8b7858
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion apps/spotlight/src/components/Footer.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
import { type GithubRepository, getBranchTreeUrl } from '../lib/github.js';
import { Image } from 'astro:assets';
import { getBaseUrl } from '../routes';
type Props = {
github: GithubRepository;
Expand All @@ -25,7 +26,7 @@ const { github } = Astro.props;
class="usa-identifier__logo GSAFooter__logo"
>
<Image
src="/images/gsa-logo.svg"
src=`${getBaseUrl()}images/gsa-logo.svg`
alt="GSA.gov home."
width="60"
height="60"
Expand Down
5 changes: 2 additions & 3 deletions apps/spotlight/src/components/Header.astro
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
import closeSvg from '@atj/design/static/uswds/img/usa-icons/close.svg';
import logoSvg from '../../public/images/10x-logo.svg';
import * as routes from '../routes';
import { Image } from 'astro:assets';
import { getBaseUrl } from '../routes';
const getNavLinkClasses = (url: string) => {
if (url === Astro.url.pathname) {
Expand Down Expand Up @@ -33,7 +32,7 @@ const showAboutContent = false;
<em class="usa-logo__text">
<a href={routes.getHomeUrl()} title="10x Forms Platform">
<Image
src="/images/10x-logo.svg"
src=`${getBaseUrl()}images/10x-logo.svg`
alt="10x Forms Platform home"
width="72"
height="34"
Expand Down
5 changes: 5 additions & 0 deletions apps/spotlight/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export const getStorybookUrl = () => {
return `${context.baseUrl}design/index.html`;
};

export const getBaseUrl = () => {
const context = getAppContext();
return context.baseUrl;
};

export const getAboutUrl = () => {
const context = getAppContext();
return `${context.baseUrl}about/index.html`;
Expand Down

0 comments on commit f8b7858

Please sign in to comment.