diff --git a/src/components/customerCases/customerCase/contactInformation/ContactInformation.tsx b/src/components/customerCases/customerCase/contactInformation/ContactInformation.tsx index 667643fb8..471a2828d 100644 --- a/src/components/customerCases/customerCase/contactInformation/ContactInformation.tsx +++ b/src/components/customerCases/customerCase/contactInformation/ContactInformation.tsx @@ -1,5 +1,7 @@ import { getTranslations } from "next-intl/server"; +import { Suspense } from "react"; +import { EmployeeCardSkeleton } from "src/components/employeeCard/EmployeeCard"; import Text from "src/components/text/Text"; import { fetchEmployeesByEmails } from "src/utils/employees"; import { CompanyLocation } from "studio/lib/interfaces/companyDetails"; @@ -8,9 +10,7 @@ import { EMPLOYEE_PAGE_SLUG_QUERY } from "studio/lib/queries/siteSettings"; import { loadStudioQuery } from "studio/lib/store"; import styles from "./contactInformation.module.css"; -import ContactSelector, { - ContactByLocationMap, -} from "./contactSelector/ContactSelector"; +import ContactSelector, { ContactByLocationMap } from "./ContactSelector"; interface ContactInformationProps { language: string; @@ -54,21 +54,30 @@ export default async function ContactInformation({ ); const t = await getTranslations("contact_information"); return ( -
-
-
- {t("help")} - {t("contact_sale")} + <> +
+
+
+ + {t("help")} + + {t("contact_sale")} +
+
+ }> + + +
-
- -
-
-
+ + ); } diff --git a/src/components/customerCases/customerCase/contactInformation/ContactSelector.tsx b/src/components/customerCases/customerCase/contactInformation/ContactSelector.tsx new file mode 100644 index 000000000..9ff75782a --- /dev/null +++ b/src/components/customerCases/customerCase/contactInformation/ContactSelector.tsx @@ -0,0 +1,75 @@ +"use client"; + +import { useState } from "react"; + +import EmployeeCard from "src/components/employeeCard/EmployeeCard"; +import { Tag } from "src/components/tag"; +import { ChewbaccaEmployee } from "src/types/employees"; +import { CompanyLocation } from "studio/lib/interfaces/companyDetails"; + +import styles from "./contactInformation.module.css"; + +export type ContactByLocationMap = { + [locationId: string]: ChewbaccaEmployee; +}; + +export interface ContactSelectorProps { + language: string; + locations: CompanyLocation[]; + contactByLocation: ContactByLocationMap; + employeePageSlug?: string; + background: "dark" | "light"; +} + +export default function ContactSelector({ + language, + locations, + contactByLocation, + employeePageSlug, + background = "light", +}: ContactSelectorProps) { + const locationIds = Object.keys(contactByLocation); + + const [selectedLocationId, setSelectedLocationId] = useState( + locationIds[0], + ); + + if (locationIds.length === 0) { + return; + } + + const selectedOrDefaultLocationId = selectedLocationId ?? locationIds[0]; + console.log(selectedLocationId); + + return ( + <> +
+
+ {locations.map((location) => ( + setSelectedLocationId(location._id)} + text={location.companyLocationName} + /> + ))} +
+
+
+ +
+
+
+ + ); +} diff --git a/src/components/customerCases/customerCase/contactInformation/contactInformation.module.css b/src/components/customerCases/customerCase/contactInformation/contactInformation.module.css index e86f6bf9c..c79175a9d 100644 --- a/src/components/customerCases/customerCase/contactInformation/contactInformation.module.css +++ b/src/components/customerCases/customerCase/contactInformation/contactInformation.module.css @@ -1,32 +1,74 @@ -.wrapper { - display: flex; +.contactBox { + max-width: var(--max-content-width-large); +} + +.contactBox__inner { + --_contactBox__background: var(--background-bg-dark); + --_contactBox__color: var(--text-primary-light); + + display: grid; + grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); + + padding: 1.5rem 3rem; flex-direction: column; - margin: 4rem 0; + justify-content: flex-end; + align-items: flex-start; + gap: var(--Padding-l, 48px); + align-self: stretch; - @media (min-width: 1024px) { - align-items: center; - } + border-radius: var(--radius-small); + background: var(--_contactBox__background); + color: var(--_contactBox__color); +} +.contactBox__inner--light { + --_contactBox__background: var(--background-bg-light-secondary); + --_contactBox__color: var(--text-primary); } -.content { +.textContent { + height: 100%; display: flex; - flex-direction: row; + flex-direction: column; gap: 1rem; - max-width: 960px; - @media (max-width: 1024px) { - flex-direction: column; - gap: 2rem; - } + justify-content: flex-end; } -.titleSection { +.contactSelectorWrapper { + container-type: inline-size; + container-name: contactSelectorWrapper; +} + +.contactSelector { + display: flex; + gap: 1rem; +} + +.tagList { display: flex; flex-direction: column; gap: 0.75rem; + + align-items: flex-start; + min-width: 120px; } -.contactSection { - display: flex; - gap: 1.5rem; +.employeeCard { + flex: 1; +} + +@media (max-width: 400px) { + .contactBox__inner { + padding: 1rem 1rem; + } +} + +@container contactSelectorWrapper (max-width: 350px) { + .contactSelector { + flex-direction: column; + } + + .tagList { + flex-direction: row; + } } diff --git a/src/components/customerCases/customerCase/contactInformation/contactSelector/ContactSelector.tsx b/src/components/customerCases/customerCase/contactInformation/contactSelector/ContactSelector.tsx deleted file mode 100644 index e086b10b2..000000000 --- a/src/components/customerCases/customerCase/contactInformation/contactSelector/ContactSelector.tsx +++ /dev/null @@ -1,72 +0,0 @@ -"use client"; - -import { useState } from "react"; - -import Button from "src/components/buttons/Button"; -import CustomerCaseEmployeeCard from "src/components/customerCaseEmployeeCard/CustomerCaseEmployeeCard"; -import { ChewbaccaEmployee } from "src/types/employees"; -import { CompanyLocation } from "studio/lib/interfaces/companyDetails"; - -import styles from "./contactSelector.module.css"; - -export type ContactByLocationMap = { - [locationId: string]: ChewbaccaEmployee; -}; - -export interface ContactSelectorProps { - language: string; - locations: CompanyLocation[]; - contactByLocation: ContactByLocationMap; - employeePageSlug?: string; -} - -export default function ContactSelector({ - language, - locations, - contactByLocation, - employeePageSlug, -}: ContactSelectorProps) { - const locationIds = Object.keys(contactByLocation); - - const [selectedLocationId, setSelectedLocationId] = useState( - locationIds.length === 0 ? locationIds[0] : null, - ); - - if (locationIds.length === 0) { - return; - } - - const selectedOrDefaultLocationId = selectedLocationId ?? locationIds[0]; - - return ( - <> -
- {locations.map((location) => ( - //Todo: replace this with tag component - - ))} -
-
- -
- - ); -} diff --git a/src/components/customerCases/customerCase/contactInformation/contactSelector/contactSelector.module.css b/src/components/customerCases/customerCase/contactInformation/contactSelector/contactSelector.module.css deleted file mode 100644 index e0f2ce2ef..000000000 --- a/src/components/customerCases/customerCase/contactInformation/contactSelector/contactSelector.module.css +++ /dev/null @@ -1,9 +0,0 @@ -.locationSection { - display: flex; - flex-direction: column; - gap: 0.75rem; -} - -.consultantSection { - min-width: 400px; -}