Skip to content

Commit f3b24be

Browse files
committed
fix(frontend): add more feedback
1 parent af89a8d commit f3b24be

File tree

7 files changed

+114
-51
lines changed

7 files changed

+114
-51
lines changed

frontend/src/app/enterprise/components/KlerosEnterpriseSection/HighlightedText.tsx

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,14 @@
1-
import clsx from "clsx";
1+
import _HighlightedText from "@/components/HighlightedText";
22

33
import { HighlightedText as IHighlightedText } from "../../queries/kleros-enterprise-section";
44

55
const HighlightedText: React.FC<
66
IHighlightedText & { fullTextStyle?: string; highlightedTextStyle?: string }
77
> = ({ fullText, highlightedText, fullTextStyle, highlightedTextStyle }) => {
8-
const FullText = (
9-
<span
10-
className={clsx(
11-
"text-base font-normal text-secondary-text lg:text-lg lg:font-medium",
12-
fullTextStyle,
13-
)}
14-
>
15-
{fullText}
16-
</span>
17-
);
18-
if (!highlightedText) return FullText;
19-
20-
const index = fullText.indexOf(highlightedText);
21-
22-
if (index === -1) return FullText;
23-
24-
const beforeMatch = fullText.slice(0, index);
25-
const match = fullText.slice(index, index + highlightedText.length);
26-
const afterMatch = fullText.slice(index + highlightedText.length);
27-
288
return (
29-
<span
30-
className={clsx(
31-
"text-base font-normal text-secondary-text lg:text-lg lg:font-medium",
32-
fullTextStyle,
33-
)}
34-
>
35-
{beforeMatch}
36-
<span
37-
className={clsx(
38-
"text-base font-normal text-primary-purple lg:text-lg lg:font-medium",
39-
highlightedTextStyle,
40-
)}
41-
>
42-
{match}
43-
</span>
44-
{afterMatch}
45-
</span>
9+
<_HighlightedText
10+
{...{ fullText, highlightedText, fullTextStyle, highlightedTextStyle }}
11+
/>
4612
);
4713
};
4814

frontend/src/app/enterprise/components/KlerosForGovernments/index.tsx

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import clsx from "clsx";
2+
13
import Card from "@/components/CtaCard";
4+
import HighlightedText from "@/components/HighlightedText";
25
import Quote from "@/components/Quote";
36
import { request } from "@/utils/graphQLClient";
47

@@ -10,32 +13,39 @@ import {
1013
ICCCardsSection,
1114
ICCLongText,
1215
ICCQuote,
16+
ICCHightlightText,
1317
} from "./queries";
1418

1519
const ForGovernments: React.FC = async () => {
1620
const sections = (await request<IForGovernmentsQuery>(forGovernmentsQuery))
1721
.enterprise.GovernmentSection;
18-
const { text } = getBlock<ICCText>(sections, "ComponentContentText");
19-
const { longtext } = getBlock<ICCLongText>(
22+
const [{ fullText, highlightedText }] = getBlock<ICCHightlightText>(
2023
sections,
21-
"ComponentContentLongText",
24+
"ComponentContentHighlightText",
2225
);
23-
const { cards } = getBlock<ICCCardsSection>(
26+
const [{ longtext }] = getBlock<ICCLongText>(
2427
sections,
25-
"ComponentContentCardsSection",
28+
"ComponentContentLongText",
2629
);
27-
const quote = getBlock<ICCQuote>(sections, "ComponentContentQuote");
30+
const [{ text }] = getBlock<ICCText>(sections, "ComponentContentText");
31+
const [{ cards: objectivesCards }, { cards: disputeTypesCards }] =
32+
getBlock<ICCCardsSection>(sections, "ComponentContentCardsSection");
33+
const [quote] = getBlock<ICCQuote>(sections, "ComponentContentQuote");
2834

2935
return (
3036
<div
3137
className={"flex flex-col gap-20 px-6 py-12 lg:gap-28 lg:px-32 lg:py-24"}
3238
>
3339
<div className="space-y-6">
34-
<span className="text-xl font-medium lg:text-2xl">{text}</span>
40+
<HighlightedText
41+
{...{ fullText, highlightedText }}
42+
fullTextStyle="!text-primary-text !text-xl !font-medium lg:!text-2xl"
43+
highlightedTextStyle="!text-xl !font-medium lg:!text-2xl"
44+
/>
3545
<p className="lg:text-lg">{longtext}</p>
3646
</div>
3747
<div className="grid grid-cols-1 gap-6 lg:grid-cols-3">
38-
{cards.map((card) => (
48+
{objectivesCards.map((card) => (
3949
<Card
4050
key={card.title}
4151
title={card.title}
@@ -45,6 +55,24 @@ const ForGovernments: React.FC = async () => {
4555
))}
4656
</div>
4757
<Quote {...quote} />
58+
<div>
59+
<h3 className="mb-12 text-lg font-medium text-primary-text lg:text-xl">
60+
{text}
61+
</h3>
62+
<div className="flex flex-wrap gap-4">
63+
{disputeTypesCards.map((card) => (
64+
<div
65+
key={card.title}
66+
className={clsx(
67+
"text-md rounded-2xl border border-stroke bg-background-2 p-6",
68+
"lg:text-lg",
69+
)}
70+
>
71+
{card.title}
72+
</div>
73+
))}
74+
</div>
75+
</div>
4876
</div>
4977
);
5078
};

frontend/src/app/enterprise/components/KlerosForGovernments/queries.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ export const forGovernmentsQuery = gql`
55
enterprise {
66
GovernmentSection {
77
__typename
8+
... on ComponentContentHighlightText {
9+
fullText
10+
highlightedText
11+
}
812
... on ComponentContentText {
913
text
1014
}
@@ -40,6 +44,12 @@ export const forGovernmentsQuery = gql`
4044
}
4145
`;
4246

47+
export type ICCHightlightText = {
48+
__typename: "ComponentContentHighlightText";
49+
fullText: string;
50+
highlightedText: string;
51+
};
52+
4353
export type ICCText = {
4454
__typename: "ComponentContentText";
4555
text: string;
@@ -79,6 +89,7 @@ export type ICCQuote = {
7989
};
8090

8191
type GovernmentSectionBlock =
92+
| ICCHightlightText
8293
| ICCText
8394
| ICCLongText
8495
| ICCCardsSection
@@ -93,6 +104,6 @@ export type IForGovernmentsQuery = {
93104
export function getBlock<T extends GovernmentSectionBlock>(
94105
blocks: GovernmentSectionBlock[],
95106
typename: T["__typename"],
96-
): T {
97-
return blocks.find((block) => block.__typename === typename) as T;
107+
): T[] {
108+
return blocks.filter((block) => block.__typename === typename) as T[];
98109
}

frontend/src/app/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default async function RootLayout({
4242
<body className="min-w-80 bg-background-1 antialiased">
4343
<main className={clsx(urbanist.className)}>
4444
<Navbar {...{ navbarData }} />
45-
<div className="mx-auto max-w-screen-2xl"> {children} </div>
45+
<div className="mx-auto max-w-[1800px]"> {children} </div>
4646
<Footer />
4747
</main>
4848
</body>

frontend/src/components/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const Footer: React.FC = async () => {
2020
cta: result.footerSubscribeCta,
2121
}));
2222
return (
23-
<div className="mx-auto max-w-screen-2xl">
23+
<div className="mx-auto max-w-[1800px]">
2424
<div className={"bg-background-dark py-16 md:px-16 xl:px-32"}>
2525
<div
2626
className={clsx(
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import clsx from "clsx";
2+
import { ClassValue } from "clsx";
3+
4+
interface IHighlightedText {
5+
fullText: string;
6+
highlightedText: string;
7+
fullTextStyle: ClassValue;
8+
highlightedTextStyle: ClassValue;
9+
}
10+
11+
const HighlightedText: React.FC<IHighlightedText> = ({
12+
fullText,
13+
highlightedText,
14+
fullTextStyle,
15+
highlightedTextStyle,
16+
}) => {
17+
const FullText = (
18+
<span
19+
className={clsx(
20+
"text-base font-normal text-secondary-text lg:text-lg lg:font-medium",
21+
fullTextStyle,
22+
)}
23+
>
24+
{fullText}
25+
</span>
26+
);
27+
if (!highlightedText) return FullText;
28+
29+
const index = fullText.indexOf(highlightedText);
30+
31+
if (index === -1) return FullText;
32+
33+
const beforeMatch = fullText.slice(0, index);
34+
const match = fullText.slice(index, index + highlightedText.length);
35+
const afterMatch = fullText.slice(index + highlightedText.length);
36+
37+
return (
38+
<span
39+
className={clsx(
40+
"text-base font-normal text-secondary-text lg:text-lg lg:font-medium",
41+
fullTextStyle,
42+
)}
43+
>
44+
{beforeMatch}
45+
<span
46+
className={clsx(
47+
"text-base font-normal text-primary-purple lg:text-lg lg:font-medium",
48+
highlightedTextStyle,
49+
)}
50+
>
51+
{match}
52+
</span>
53+
{afterMatch}
54+
</span>
55+
);
56+
};
57+
58+
export default HighlightedText;

frontend/src/components/Navbar/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const Navbar: React.FC<INavbar> = ({ navbarData }) => {
3636
"backdrop-blur-md",
3737
)}
3838
>
39-
<div className="mx-auto h-full max-w-screen-2xl px-2 md:px-16 xl:px-32">
39+
<div className="mx-auto h-full max-w-[1800px] px-2 md:px-16 xl:px-32">
4040
<div
4141
className={clsx(
4242
"flex h-full items-center justify-between",

0 commit comments

Comments
 (0)