Skip to content

Commit

Permalink
Merge pull request #100 from Blazity/footer-tweak
Browse files Browse the repository at this point in the history
Footer tweak
  • Loading branch information
Pierniki committed Nov 14, 2023
2 parents 453faf4 + edbb340 commit 6586710
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 13 deletions.
9 changes: 9 additions & 0 deletions src/app/[lang]/category/[slug]/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Skeleton } from "@/components/ui/Skeleton/Skeleton"

export default function Loading() {
return (
<div className="w-full">
<Skeleton className="min-h-[150px] w-full" />
</div>
)
}
8 changes: 4 additions & 4 deletions src/app/[lang]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { notFound } from "next/navigation"
import { unstable_setRequestLocale } from "next-intl/server"
import { Footer } from "@/components/Footer/Footer"
import { Navigation } from "@/components/Navigation/Navigation"
import { env } from "@/env.mjs"
import { i18n, type Locale } from "@/i18n/i18n"
import { setTranslations } from "@/i18n/setTranslations"
import { getNavigation } from "@/lib/client"
import "@/styles/tailwind.css"
import { unstable_setRequestLocale } from "next-intl/server"
import { notFound } from "next/navigation"
import { GoogleAnalytics } from "../GoogleAnalytics"
import Providers from "../Providers"

Expand Down Expand Up @@ -41,7 +41,7 @@ export default async function Layout({ children, params }: { children: React.Rea
if (!isValidLocale) notFound()
unstable_setRequestLocale(locale)
const translations = await setTranslations(locale)
const { navigation, footer, logo } = await getNavigation(locale)
const { navigation, footer } = await getNavigation(locale)

return (
<html lang={locale}>
Expand All @@ -55,7 +55,7 @@ export default async function Layout({ children, params }: { children: React.Rea
</div>

<main className="mx-auto flex w-full max-w-[1200px] flex-1 flex-col px-4 pb-16">{children}</main>
<Footer logoUrl={logo?.url} footer={footer} />
<Footer footer={footer} />
</body>
</Providers>
</html>
Expand Down
14 changes: 10 additions & 4 deletions src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import { GetNavigationReturn } from "../Navigation/Navigation"

type FooterProps = {
footer: Pick<GetNavigationReturn, "footer">["footer"]
logoUrl: string | undefined
}

export async function Footer({ footer, logoUrl }: FooterProps) {
export async function Footer({ footer }: FooterProps) {
const locale = useLocale()

if (!footer?.contactSection) return null
Expand Down Expand Up @@ -68,14 +67,21 @@ export async function Footer({ footer, logoUrl }: FooterProps) {
<div className="w-fit lg:w-auto">
<DynamicLangSelect />
</div>
{logoUrl && (
{footer?.additionalLogo && (
<Link
hrefLang={locale}
target="_blank"
href={"https://blazity.com/"}
className="flex max-h-[100px] w-[100px] lg:justify-end"
>
<Image src={logoUrl} width={300} height={300} alt="Blazity logo" className="w-full" quality={100} />
<Image
src={footer?.additionalLogo.url}
width={300}
height={300}
alt="Blazity logo"
className="w-full"
quality={100}
/>
</Link>
)}
<p className="text-sm">
Expand Down
4 changes: 2 additions & 2 deletions src/lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ export async function getHomepageMetadata(locale: Locale) {
}

export async function getNavigation(locale: Locale) {
const { navigations, footers, asset } = await graphqlFetch({
const { navigations, footers } = await graphqlFetch({
cache: "force-cache",
document: getNavigationQuery,
tags: ["NAVIGATION", "PAGE", "CATEGORY"],
variables: { locale },
})

return { navigation: navigations[0] ?? null, footer: footers[0] ?? null, logo: asset ?? null }
return { navigation: navigations[0] ?? null, footer: footers[0] ?? null }
}

export async function getArticlesQuantity(locale: Locale) {
Expand Down
6 changes: 3 additions & 3 deletions src/lib/queries/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ export const getNavigationQuery = graphql(`
url
}
}
asset(where: { id: "clo74v3lz1yqp0bw1w7jsrrin" }) {
url
}
footers(locales: $locales, first: 1) {
logo {
url
}
additionalLogo {
url
}
ownershipAndCredits
companyName
youtubeLink
Expand Down

0 comments on commit 6586710

Please sign in to comment.