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

SUL23-438: Added location link to list of branches on the homepage #150

Merged
merged 5 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
19 changes: 10 additions & 9 deletions src/components/node/stanford-page/home-page/home-page-banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ const HomePageBanner = async () => {

// Trim all the fat.
const trimmedLibraries: TrimmedLibrary[] = libraries.map(library => (
{
id: library.id,
title: library.title,
suLibraryHours: library.suLibraryHours,
suLibraryContactImg: library.suLibraryContactImg as MediaImage,
suLibraryBanner: library.suLibraryBanner as MediaImage
}
))
{
id: library.id,
title: library.title,
suLibraryHours: library.suLibraryHours,
suLibraryContactImg: library.suLibraryContactImg as MediaImage,
suLibraryBanner: library.suLibraryBanner as MediaImage,
map: library.suLibraryMapLink?.url
}
))

return (
<header className="bg-black-true mb-50 relative">
Expand Down Expand Up @@ -56,4 +57,4 @@ const HomePageBanner = async () => {
)
}

export default HomePageBanner;
export default HomePageBanner;
11 changes: 9 additions & 2 deletions src/components/node/stanford-page/home-page/today-hours.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@

import Card from "@/components/patterns/card";
import {ClockIcon} from "@heroicons/react/24/outline";
import { MapPinIcon } from "@heroicons/react/24/solid";
import Image from "next/image";
import {HTMLAttributes, useId, useState} from "react";
import {ErrorBoundary} from "react-error-boundary";
import CachedClientFetch from "@/components/utils/cached-client-fetch";
import useTodayLibraryHours from "@/lib/hooks/useTodayLibraryHours";
import SelectList from "@/components/patterns/elements/select-list";
import {buildUrl} from "@/lib/drupal/utils";
import {NodeSulLibrary} from "@/lib/gql/__generated__/drupal.d";
import {NodeSulLibrary, Maybe} from "@/lib/gql/__generated__/drupal.d";
import Link from "next/link";


export type TrimmedLibrary = {
id: string
title: string
suLibraryHours?: NodeSulLibrary["suLibraryHours"]
suLibraryContactImg?: NodeSulLibrary["suLibraryContactImg"]
suLibraryBanner: NodeSulLibrary["suLibraryBanner"]
map?: Maybe<string>
}

type HoursProps = HTMLAttributes<HTMLDivElement> & {
Expand Down Expand Up @@ -80,6 +84,9 @@ const LibrariesTodayHours = ({libraries, ...props}: { libraries: HoursProps["lib
{library?.suLibraryHours &&
<TodayLibraryHours branchId={library.suLibraryHours}/>
}
{library?.map &&
<span className="float-right w-auto inline"><span className="sr-only">{library.title} Location</span><Link href={library?.map} aria-label="Link to map"><MapPinIcon title="Map" width={25} className="mr-5 inline"/>Location</Link></span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the sr-only needs to be within the <Link> also you can remove the aria-label property.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this is fixed.

}
</div>
</div>
}
Expand Down Expand Up @@ -117,4 +124,4 @@ const TodayLibraryHours = ({branchId}: { branchId?: string }) => {
)
}

export default TodayHours
export default TodayHours
Loading