-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix(CustomerCase): overflowing content width * feat(CustomerCase): project consultants section * feat(CustomerCase): add usage note to consultants field in project info * feat(CustomerCase): fetch employees by email instead of alias since we don't know if aliases are unique across countries * feat(CustomerCase): use email type for project consultant identifiers * refactor(CustomerCase): extract consultants section to own component * feat(CustomerCaseConsultants): add employee link to customer case consultant card * feat(CustomerCase): remove nowrap for project info
- Loading branch information
Showing
9 changed files
with
226 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
...s/customerCases/customerCase/sections/customerCaseConsultants/CustomerCaseConsultants.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import Image from "next/image"; | ||
import Link from "next/link"; | ||
|
||
import CustomLink from "src/components/link/CustomLink"; | ||
import Text from "src/components/text/Text"; | ||
import { ChewbaccaEmployee } from "src/types/employees"; | ||
import { aliasFromEmail } from "src/utils/employees"; | ||
import { LinkType } from "studio/lib/interfaces/navigation"; | ||
import { EMPLOYEE_PAGE_SLUG_QUERY } from "studio/lib/queries/siteSettings"; | ||
import { loadStudioQuery } from "studio/lib/store"; | ||
|
||
import styles from "./customerCaseConsulants.module.css"; | ||
|
||
export interface CustomerCaseConsultantsProps { | ||
language: string; | ||
consultants: ChewbaccaEmployee[]; | ||
} | ||
|
||
export default async function CustomerCaseConsultants({ | ||
language, | ||
consultants, | ||
}: CustomerCaseConsultantsProps) { | ||
const employeePageSlugRes = await loadStudioQuery<{ slug: string } | null>( | ||
EMPLOYEE_PAGE_SLUG_QUERY, | ||
{ | ||
language, | ||
}, | ||
); | ||
const employeePageSlug = employeePageSlugRes.data?.slug; | ||
|
||
return ( | ||
<div className={styles.wrapper}> | ||
<Text type={"h3"}>Varianter på prosjektet</Text> | ||
<div className={styles.content}> | ||
{consultants.map((consultant) => { | ||
const title = ( | ||
<p className={styles.consultantName}>{consultant.name}</p> | ||
); | ||
return ( | ||
consultant.imageThumbUrl && | ||
consultant.name && | ||
consultant.email && ( | ||
<div key={consultant.email} className={styles.consultant}> | ||
<div className={styles.consultantImage}> | ||
<Image | ||
src={consultant.imageUrl ?? consultant.imageThumbUrl} | ||
alt={consultant.name} | ||
objectFit="cover" | ||
fill={true} | ||
/> | ||
</div> | ||
<div className={styles.consultantInfo}> | ||
{employeePageSlug !== undefined ? ( | ||
<Link | ||
href={`/${language}/${employeePageSlug}/${aliasFromEmail(consultant.email)}`} | ||
> | ||
{title} | ||
</Link> | ||
) : ( | ||
title | ||
)} | ||
{consultant.officeName && ( | ||
<p className={styles.consultantRole}> | ||
{consultant.officeName} | ||
</p> | ||
)} | ||
{consultant.email && ( | ||
<p className={styles.consultantEmail}>{consultant.email}</p> | ||
)} | ||
{consultant.telephone && ( | ||
<p className={styles.consultantTelephone}> | ||
{consultant.telephone} | ||
</p> | ||
)} | ||
<CustomLink | ||
size={"small"} | ||
link={{ | ||
_key: "go-to-mini-cv", | ||
_type: "link", | ||
linkType: LinkType.Internal, | ||
linkTitle: "Gå til Mini-CV", | ||
internalLink: { | ||
_ref: `${language}/${employeePageSlug}/${aliasFromEmail(consultant.email)}`, | ||
}, | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
); | ||
})} | ||
</div> | ||
</div> | ||
); | ||
} |
60 changes: 60 additions & 0 deletions
60
...omerCases/customerCase/sections/customerCaseConsultants/customerCaseConsulants.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
.wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 2rem; | ||
margin: 4rem 0; | ||
} | ||
|
||
.content { | ||
width: 100%; | ||
text-wrap: wrap; | ||
column-gap: 12px; | ||
row-gap: 52px; | ||
display: grid; | ||
grid-template-columns: repeat(auto-fit, 350px); | ||
justify-content: space-between; | ||
} | ||
|
||
.consultant { | ||
display: flex; | ||
width: 100%; | ||
gap: 1rem; | ||
} | ||
|
||
.consultantImage { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
background-color: var(--primary-black); | ||
border-radius: 12px; | ||
height: 125px; | ||
width: 50%; | ||
padding: 1rem; | ||
position: relative; | ||
} | ||
|
||
.consultantInfo { | ||
display: flex; | ||
flex-direction: column; | ||
width: 50%; | ||
gap: 0.5rem; | ||
} | ||
|
||
.consultantName { | ||
color: var(--primary-black); | ||
font-size: 16px; | ||
font-weight: 600; | ||
} | ||
|
||
.consultantRole { | ||
color: var(--primary-black); | ||
font-size: 16px; | ||
font-weight: 300; | ||
} | ||
|
||
.consultantEmail, | ||
.consultantTelephone { | ||
color: var(--primary-black); | ||
font-size: 14px; | ||
font-weight: 300; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,9 +68,10 @@ export const customerCaseProjectInfo = defineField({ | |
defineField({ | ||
// TODO: We should be able to select the consultants from a list | ||
name: "consultants", | ||
description: "The consultants for the project", | ||
description: | ||
"The consultants for the project. Use employee emails (e.g. '[email protected]').", | ||
type: "array", | ||
of: [{ type: "string" }], | ||
of: [{ type: "email" }], | ||
}), | ||
], | ||
}); |