Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3 customercase entry module #920

Merged
merged 28 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7932b4c
skeleton for customercase entry
anemne Nov 21, 2024
161e5cf
Merge branch 'v3' into v3-customercase-entry
anemne Nov 22, 2024
dc45ffa
added botton for customerCases we have
anemne Nov 22, 2024
158681a
Merge branch 'v3' into v3-customercase-entry
anemne Nov 26, 2024
acea2a0
temp
anemne Nov 26, 2024
946c170
Merge branch 'v3' into v3-customercase-entry
anemne Nov 27, 2024
065c35a
linting fixes
anemne Nov 27, 2024
048f580
imagerendering and datafetching
anemne Nov 28, 2024
0980702
media
anemne Nov 28, 2024
44c0865
Merge branch 'v3' into v3-customercase-entry
anemne Nov 28, 2024
b9c17c7
add tag component
anemne Nov 28, 2024
7c02656
Merge branch 'v3' into v3-customercase-entry
trulshj Nov 29, 2024
74f2a33
remove tag ad we're replacing it with other tag component
anemne Dec 5, 2024
798a285
Merge branch 'v3-customercase-entry' of github.com:varianter/variant.…
anemne Dec 5, 2024
4aa68a8
Merge branch 'v3' into v3-customercase-entry
anemne Dec 5, 2024
39e68b0
add link to customercase
anemne Dec 5, 2024
fef15a6
format deliverystrings
anemne Dec 5, 2024
e984248
image sizing
anemne Dec 6, 2024
817dc0d
Templatus gridificous!
jberglund Dec 6, 2024
f187e6e
tried fixing scaling on card
anemne Dec 8, 2024
e6d91f2
Merge branch 'v3' into v3-customercase-entry
anemne Dec 8, 2024
c463ea9
fix: responsiveness of costumer case (#957)
mikaelbr Dec 9, 2024
0ce9634
border on image
anemne Dec 9, 2024
892201f
focus and opacity on images
anemne Dec 9, 2024
0840fee
small changes in opacity
anemne Dec 9, 2024
a075d06
Merge branch 'v3' into v3-customercase-entry
anemne Dec 9, 2024
221af03
remove unused Text component in header to fix lint check
anemne Dec 9, 2024
cad2efe
swedish translation
anemne Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"i18n-ally.localesPaths": ["i18n", "messages", "src/i18n"]
"i18n-ally.localesPaths": ["i18n", "messages", "src/i18n"],
"i18n-ally.keystyle": "nested"
}
16 changes: 12 additions & 4 deletions messages/en.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"linking_words": {
"for": "for"
},
"navigation": {
"home": "Home"
},
Expand All @@ -14,7 +17,12 @@
"development": "Development",
"project_management": "Project management",
"url": "Url",
"collaborators": "Collaborators"
"collaborators": "Collaborators",
"customer_case_entry": {
"image": "image",
"case": "Case",
"field": "Field"
}
},
"contact_information": {
"help": "Curious about Variant and want to explore what we offer?",
Expand Down Expand Up @@ -46,9 +54,9 @@
"location": "Location",
"all": "All",
"Project Management": "Project Management",
"Design": "Design",
"Utvikling": "Development",
"Administasjon": "Administration",
"design": "Design",
"development": "Development",
"administration": "Administration",
"field": "Field",
"showMore": "Show all"
},
Expand Down
16 changes: 12 additions & 4 deletions messages/no.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"linking_words": {
"for": "for"
},
"navigation": {
"home": "Hjem"
},
Expand All @@ -14,7 +17,12 @@
"development": "Utvikling",
"project_management": "Prosjektledelse",
"url": "Link",
"collaborators": "Samarbeidspartnere"
"collaborators": "Samarbeidspartnere",
"customer_case_entry": {
"image": "bilde",
"case": "Case",
"field": "Fag"
}
},
"contact_information": {
"help": "Trenger du hjelp med lignende eller noe helt annet?",
Expand Down Expand Up @@ -45,9 +53,9 @@
"location": "Lokasjon",
"all": "Alle",
"Project Management": "Prosjektledelse",
"Design": "Design",
"Utvikling": "Utvikling",
"Administasjon": "Administrasjon",
"design": "Design",
"development": "Utvikling",
"administration": "Administrasjon",
"field": "Fag",
"showMore": "Vis alle"
},
Expand Down
16 changes: 12 additions & 4 deletions messages/se.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"linking_words": {
"for": "för"
},
"navigation": {
"home": "Hem"
},
Expand All @@ -14,7 +17,12 @@
"development": "Utveckling",
"project_management": "Projektledning",
"url": "Link",
"collaborators": "Samarbeidspartnere"
"collaborators": "Samarbeidspartnere",
"customer_case_entry": {
"image": "bild",
"case": "Case",
"field": "Fält"
}
},
"contact_information": {
"help": "Nyfiken på Variant och vill utforska vad vi erbjuder?",
Expand Down Expand Up @@ -45,9 +53,9 @@
"location": "Kontor",
"all": "Alla",
"Project Management": "Projektledning",
"Design": "Design",
"Utvikling": "Utveckling",
"Administasjon": "Administration",
"design": "Design",
"development": "Utveckling",
"administration": "Administration",
"field": "Fält",
"showMore": "Vis alla"
},
Expand Down
2 changes: 2 additions & 0 deletions src/components/customerCases/customerCases.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
.caseImageWrapper {
min-width: 20rem;
max-width: 20rem;
width: 20rem;
height: 14rem;
}

.caseImageWrapper img {
Expand Down
3 changes: 0 additions & 3 deletions src/components/employeeCard/employeeCard.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@
color: currentColor;
}

.employeeRole {
}

.employeeRoleDot::after {
content: "·";
margin: 0 0.25rem;
Expand Down
2 changes: 0 additions & 2 deletions src/components/image/SanityImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ const SanityAssetImage = ({
objectPosition,
maxWidth: "100%",
maxHeight: "100%",
height: "auto",
width: "auto",
}}
/>
);
Expand Down
1 change: 0 additions & 1 deletion src/components/navigation/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { defaultLanguage } from "i18n/supportedLanguages";
import LanguageSwitcher from "src/components/languageSwitcher/LanguageSwitcher";
import CustomLink from "src/components/link/CustomLink";
import LinkButton from "src/components/linkButton/LinkButton";
import Text from "src/components/text/Text";
import useScrollDirection from "src/utils/hooks/useScrollDirection";
import { getHref } from "src/utils/link";
import { Announcement } from "studio/lib/interfaces/announcement";
Expand Down
55 changes: 55 additions & 0 deletions src/components/sections/customerCasesEntry/CustomerCasesEntry.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { headers } from "next/headers";

import { Locale } from "src/i18n/routing";
import { getDraftModeInfo } from "src/utils/draftmode";
import { domainFromHostname } from "src/utils/url";
import { CUSTOMER_CASES_PAGE_SITEMAP_QUERY } from "studio/lib/queries/specialPages";
import { loadStudioQuery } from "studio/lib/store";
import { CustomerCaseEntry } from "studioShared/lib/interfaces/customerCases";
import { CUSTOMER_CASE_ENTRY_QUERY } from "studioShared/lib/queries/customerCases";
import { loadSharedQuery } from "studioShared/lib/store";

import CustomerCasesList from "./CustomerCasesList";

interface CustomerCasesProps {
language: Locale;
}

async function CustomerCasesEntry({ language }: CustomerCasesProps) {
const { perspective } = getDraftModeInfo();
const domain = domainFromHostname(headers().get("host"));

const customerCaseResult = await loadSharedQuery<CustomerCaseEntry[]>(
CUSTOMER_CASE_ENTRY_QUERY,
{
domain,
language,
},
{
perspective,
},
);

const customerCasePageSlug = (
await loadStudioQuery<{ slug: string } | null>(
CUSTOMER_CASES_PAGE_SITEMAP_QUERY,
{
language,
},
)
).data?.slug;

return (
customerCaseResult && (
<div>
<CustomerCasesList
customerCases={customerCaseResult.data}
language={language}
customerCasePageSlug={customerCasePageSlug}
/>
</div>
)
);
}

export default CustomerCasesEntry;
132 changes: 132 additions & 0 deletions src/components/sections/customerCasesEntry/CustomerCasesList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
"use client";

import Link from "next/link";
import { useTranslations } from "next-intl";
import { useState } from "react";

import { SanitySharedImage } from "src/components/image/SanityImage";
import { Tag } from "src/components/tag";
import Text from "src/components/text/Text";
import { capitalizeFirstLetter } from "src/components/utils/formatCapitalizedFirstLetter";
import { CustomerCaseEntry } from "studioShared/lib/interfaces/customerCases";

import styles from "./customerCasesEntry.module.css";

interface CustomerCasesProps {
customerCases: CustomerCaseEntry[];
language: string;
customerCasePageSlug?: string;
}

const CustomerCaseList = ({
customerCases,
language,
customerCasePageSlug,
}: CustomerCasesProps) => {
const [selectedCustomerCase, setSelectedCustomerCase] =
useState<CustomerCaseEntry>(customerCases[0] || null);

const deliveryNames = [
selectedCustomerCase.projectInfo.deliveries.projectManagement &&
"Project Management",
selectedCustomerCase.projectInfo.deliveries.design && "Design",
selectedCustomerCase.projectInfo.deliveries.development && "Development",
].filter(Boolean);

return (
<div className={styles.container}>
<div className={styles.wrapper}>
<div className={styles.info}>
<div className={styles.infoInnerMaxWidth}>
<TagRow
customerCases={customerCases}
selectedCustomerCase={selectedCustomerCase}
setSelectedCustomerCase={setSelectedCustomerCase}
/>
<Link
className={styles.link}
href={`/${language}/${customerCasePageSlug}/${selectedCustomerCase.slug}`}
>
<CardInfo
selectedCustomerCase={selectedCustomerCase}
deliveryNames={deliveryNames}
/>
</Link>
</div>
</div>
<Link
tabIndex={-1}
className={styles.imageWrapper}
href={`/${language}/${customerCasePageSlug}/${selectedCustomerCase.slug}`}
>
{selectedCustomerCase.image && (
<SanitySharedImage image={selectedCustomerCase.image} />
)}
</Link>
</div>
</div>
);
};
export default CustomerCaseList;

function CardInfo({
selectedCustomerCase,
deliveryNames,
}: {
selectedCustomerCase: CustomerCaseEntry;
deliveryNames: string[];
}) {
const t = useTranslations("customer_case");

return (
<div className={styles.cardInfo}>
<Text type="h2" className={styles.heading}>
{selectedCustomerCase.basicTitle}
</Text>
<div className={styles.deliveries}>
<Text type="labelRegular">{t("customer_case_entry.field")}</Text>
<div className={styles.deliveriesList}>
{deliveryNames.map((deliveryName, index) => (
<Text key={index} type="h5" className={styles.dotSeparator}>
{deliveryName}
</Text>
))}
</div>
</div>
</div>
);
}

function TagRow({
customerCases,
selectedCustomerCase,
setSelectedCustomerCase,
}: {
customerCases: CustomerCaseEntry[];
selectedCustomerCase: CustomerCaseEntry;
setSelectedCustomerCase: (customerCase: CustomerCaseEntry) => void;
}) {
const t = useTranslations("customer_case");

return (
<div className={styles.TagRow}>
<Text className={styles.font} type="labelRegular">
{t("customer_case_entry.case")}
</Text>
{customerCases.map(
(customerCase: CustomerCaseEntry) =>
customerCase && (
<div key={customerCase._id}>
<Tag
active={customerCase._id === selectedCustomerCase._id}
type="button"
background="dark"
onClick={() => setSelectedCustomerCase(customerCase)}
text={capitalizeFirstLetter(customerCase.projectInfo.customer)}
/>
</div>
),
)}
</div>
);
}
Loading
Loading