Skip to content

Commit

Permalink
V3 add competence to employee (#876)
Browse files Browse the repository at this point in the history
* Add competences to chewbaccaEmployee

* Add competence/role to employees page

* Add competence/role to consultants on customer case page, and employeepage

* Fix bug

* Fix failed prettier check

* Fix: do not use index as key in map
  • Loading branch information
idamand authored Nov 13, 2024
1 parent e44e3cb commit 8cf7315
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/components/consultantCard/ConsultantCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Link from "next/link";
import { useTranslations } from "next-intl";

import CustomLink from "src/components/link/CustomLink";
import Text from "src/components/text/Text";
import formatPhoneNumber from "src/components/utils/formatPhoneNumber";
import { ChewbaccaEmployee } from "src/types/employees";
import { aliasFromEmail } from "src/utils/employees";
Expand Down Expand Up @@ -47,6 +48,11 @@ export default function ConsultantCard({
) : (
title
)}
{consultant.competences.map((competence) => (
<Text type="labelRegular" key={competence}>
{competence}
</Text>
))}
{consultant.officeName && (
<p className={styles.consultantRole}>{consultant.officeName}</p>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function SplitSection({ section }: SplitSectionProps) {
return (
<div className={styles.wrapper}>
<div className={styles.content}>
{section.sections.map((section) => (
{section.sections?.map((section) => (
<SplitSectionSection key={section._key} section={section} />
))}
</div>
Expand Down
5 changes: 5 additions & 0 deletions src/components/employeePage/EmployeePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ export default function EmployeePage({ employee }: EmployeePageProps) {
{employee.officeName}
</Text>
)}
{employee.competences.map((competence) => (
<Text type="bodyNormal" key={competence}>
{competence}
</Text>
))}
</div>
</div>
</div>
Expand Down
13 changes: 10 additions & 3 deletions src/components/sections/employees/Employees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { headers } from "next/headers";
import Image from "next/image";
import Link from "next/link";

import Text from "src/components/text/Text";
import formatPhoneNumber from "src/components/utils/formatPhoneNumber";
import {
aliasFromEmail,
Expand Down Expand Up @@ -74,9 +75,15 @@ export default async function Employees({ language, section }: EmployeesProps) {
</Link>
<div className={styles.employeeInfo}>
<p className={styles.employeeName}>{employee.name}</p>
{employee.officeName && (
<p className={styles.employeeRole}>{employee.officeName}</p>
)}
{employee.competences.map((competence) => (
<Text
type="labelRegular"
key={competence}
className={styles.employeeRole}
>
{competence}
</Text>
))}
{employee.email && (
<p className={styles.employeeEmail}>{employee.email}</p>
)}
Expand Down
4 changes: 1 addition & 3 deletions src/components/sections/employees/employees.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@
}

.employeeRole {
color: var(--primary-black);
font-size: 16px;
font-weight: 300;
color: var(--primary-grey);
}

.employeeEmail,
Expand Down
1 change: 1 addition & 0 deletions src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ html {
--primary-white: #faf8f5;
--primary-black: #2d2d2d;
--primary-black-darker: #000000;
--primary-grey: #5e5e5e;

--secondary-off-white1: #f4efe8;
--secondary-off-white2: #ece1d3;
Expand Down
6 changes: 5 additions & 1 deletion src/types/employees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface ChewbaccaEmployee {
imageThumbUrl?: string | null;
officeName?: string | null;
startDate?: string | null;
competences: string[];
}

export function isChewbaccaEmployee(
Expand Down Expand Up @@ -52,6 +53,9 @@ export function isChewbaccaEmployee(
value.officeName === null) &&
(!("startDate" in value) ||
typeof value.startDate === "string" ||
value.startDate === null)
value.startDate === null) &&
(!("competences" in value) ||
typeof value.competences === "object" ||
value.competences === null)
);
}

0 comments on commit 8cf7315

Please sign in to comment.