Skip to content

Commit 0f1d1a4

Browse files
committedMar 16, 2024·
feat: move footer to everywhere in the app
1 parent 724ebde commit 0f1d1a4

8 files changed

+18
-26
lines changed
 

‎app/src/components/Footer.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import styles from "@/styles/Footer.module.scss";
33
import { Association } from "@/types/aliases";
44

55
export default function Footer({ association }: { association: Association }) {
6+
if (association == null) {
7+
return;
8+
}
9+
610
return (
711
<div className={styles.footer}>
812
<div className={styles.bgAnimated}>

‎app/src/directus.ts

+9-17
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,15 @@ export function populateLayoutProps<T>(
3232
f?: GetServerSideProps<T>
3333
): GetServerSideProps<T & { layoutProps: SocialLink[] }> {
3434
return async (context: GetServerSidePropsContext) => {
35-
let association = await directus().request(
36-
readSingleton("association", {
37-
fields: ["*", { social_links: ["*"] }],
38-
})
39-
);
35+
let association = await directus().request(readSingleton("association"));
4036

41-
let socialLinks = await directus().request(
42-
readItems("social_links", {
43-
fields: ["*"],
44-
filter: {
45-
id: {
46-
_in: (
47-
association.social_links as { social_links_id: number }[]
48-
).map((s) => s.social_links_id),
49-
},
50-
},
51-
})
52-
);
37+
let socialLinks = await directus()
38+
.request(
39+
readItems("association_social_links", {
40+
fields: [{ social_links_id: ["*"] }],
41+
})
42+
)
43+
.then((result) => result.map((s) => s.social_links_id));
5344

5445
let langs = await directus().request(readItems("languages"));
5546

@@ -59,6 +50,7 @@ export function populateLayoutProps<T>(
5950

6051
let layoutProps = {
6152
layoutProps: {
53+
association: association,
6254
socialLinks: socialLinks,
6355
commissions: commissions,
6456
langs: langs,

‎app/src/pages/_app.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// This is required to get a url for the `background-image` css property.
33
// @ts-ignore
44
import Background from "../../public/background.svg?url";
5+
import Footer from "@/components/Footer";
56
import NavigationBar from "@/components/NavigationBar";
67
import "@/styles/fonts.scss";
78
import "@/styles/globals.scss";
@@ -20,6 +21,7 @@ export default function App({ Component, pageProps }: AppProps) {
2021
>
2122
<Component {...pageProps} />
2223
</div>
24+
<Footer association={pageProps.association} />
2325
</>
2426
);
2527
}

‎app/src/pages/association.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function AssociationPage(
1212
<AssociationDescription
1313
association={props.association}
1414
social_links={props.social_links}
15-
></AssociationDescription>
15+
/>
1616
);
1717
}
1818

‎app/src/pages/index.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import PreviewImage from "@/assets/galleryPreview.png";
22
import AssociationDescription from "@/components/AssociationDescription";
33
import Card from "@/components/Card";
44
import DirectusImage from "@/components/DirectusImage";
5-
import Footer from "@/components/Footer";
65
import NewsCard from "@/components/NewsCard";
76
import PartnersList from "@/components/PartnersList";
87
import { directus, populateLayoutProps } from "@/directus";
@@ -68,8 +67,6 @@ export default function Home(
6867
))}
6968
</div>
7069
</div>
71-
72-
<Footer association={props.association} />
7370
</>
7471
);
7572
}

‎app/src/styles/AssociationDescription.module.scss

-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
@import "glass";
2-
31
.description {
4-
@extend .glass;
5-
62
background-color: var(--background-color);
73

84
width: 100%;

‎app/src/styles/Footer.module.scss

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.footer {
22
color: #fff;
33
text-align: center;
4-
padding: 5px;
54
position: relative;
65
width: 100%;
76

‎app/src/styles/globals.scss

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ a {
3030

3131
gap: 4rem;
3232

33+
padding-top: 3rem;
34+
padding-bottom: 6rem;
3335
min-height: 100vh;
3436

3537
background-position: left top;

0 commit comments

Comments
 (0)
Please sign in to comment.