Skip to content

Commit

Permalink
fix(about): move avatar team members to bottom, improve page header i…
Browse files Browse the repository at this point in the history
…mage responsiveness

fix(about): move avatar team members to bottom, improve page header image responsiveness
  • Loading branch information
danji90 authored Oct 17, 2024
2 parents 8118512 + d8c76e3 commit d3eef40
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/de/solution/[slug]/page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import getContentList from "../../../../lib/getContentList.js";
import { getSolutionSlugProps } from "../../../../lib/getProps.js";
import { generateSolutionSlugMetadata } from "../../../../lib/getMetadata.js";
import Slug from "../../../../components/SolutionArtcile.js";
import Slug from "../../../../components/SolutionArticle.js";

export async function generateMetadata({ params: { slug } }) {
const md = await generateSolutionSlugMetadata("de", slug);
Expand Down
2 changes: 1 addition & 1 deletion app/en/solution/[slug]/page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import getContentList from "../../../../lib/getContentList.js";
import { getSolutionSlugProps } from "../../../../lib/getProps.js";
import { generateSolutionSlugMetadata } from "../../../../lib/getMetadata.js";
import Slug from "../../../../components/SolutionArtcile.js";
import Slug from "../../../../components/SolutionArticle.js";

export async function generateMetadata({ params: { slug } }) {
const md = await generateSolutionSlugMetadata("en", slug);
Expand Down
File renamed without changes.
17 changes: 11 additions & 6 deletions lib/getContentList.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,20 @@ export default function getContentList(language, options) {
if (order) {
const orderConditions = order.map((condition) => {
const [[field, direction]] = Object.entries(condition);
return { field, direction };
return { field, direction, compareFunction: condition.compareFunction };
});

return list.sort((a, b) =>
orderConditions.reduce((prev, { field, direction }) => {
orderConditions.reduce((prev, { field, direction, compareFunction }) => {
let result = 0;
if (a[field] < b[field]) {
result = -1;
} else if (a[field] > b[field]) {
result = 1;
if (compareFunction && typeof compareFunction === "function") {
result = compareFunction(a, b);
} else {
if (a[field] < b[field]) {
result = -1;
} else if (a[field] > b[field]) {
result = 1;
}
}

if (prev === 1) {
Expand Down
16 changes: 16 additions & 0 deletions lib/getProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,22 @@ export async function getAboutProps(language) {
const team = getContentList(language, {
collections: ["person"],
fields: ["name", "photo", "position", "email", "telephone", "github"],
order: [
{
photo: "asc",
compareFunction: (a, b) => {
const aIsAvatar = a["photo"].includes("avatar");
const bIsAvatar = b["photo"].includes("avatar");
if (aIsAvatar && !bIsAvatar) {
return 1;
}
if (!aIsAvatar && bIsAvatar) {
return -1;
}
return 0;
},
},
],
});
const content = getContentItem(language, "page", "about.json");

Expand Down

0 comments on commit d3eef40

Please # to comment.