Skip to content

Commit f58faed

Browse files
committed
fix(ui): improve text wrapping and image responsiveness
add word break and overflow wrap styles to prevent text overflow adjust partner logos grid spacing and image sizing for better responsiveness include locale handling in KeyPromises component for tenant-specific content
1 parent c491b18 commit f58faed

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

src/app/(frontend)/[entitySlug]/promises/[promiseId]/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,8 @@ export default async function PromiseDetailPage({
390390
typography: { xs: "h3", lg: "h1" },
391391
fontWeight: 600,
392392
lineHeight: 1.1,
393+
wordBreak: "break-word",
394+
overflowWrap: "anywhere",
393395
}}
394396
>
395397
{titleText}

src/components/EntityHero/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ export const EntityHero = async ({ title, description }: EntityHeroBlock) => {
6161
sx={{
6262
fontWeight: 700,
6363
mb: 2,
64+
wordBreak: "break-word",
65+
overflowWrap: "anywhere",
6466
}}
6567
>
6668
{title}

src/components/KeyPromises/index.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1+
import { resolveBrowserLocale } from "@/app/(frontend)/layout";
12
import { resolveMedia } from "@/lib/data/media";
3+
import { getPromiseUpdateEmbed } from "@/lib/data/promiseUpdates";
4+
import { getTenantBySubDomain } from "@/lib/data/tenants";
5+
import { getDomain } from "@/lib/domain";
26
import { getGlobalPayload } from "@/lib/payload";
37
import type {
48
KeyPromisesBlock,
59
PoliticalEntity,
610
Promise as PromiseDocument,
711
PromiseStatus,
812
} from "@/payload-types";
13+
import { resolveTenantLocale } from "@/utils/locales";
914
import { KeyPromisesClient, type KeyPromiseItem } from "./KeyPromises.Client";
10-
import { getPromiseUpdateEmbed } from "@/lib/data/promiseUpdates";
1115

1216
const DEFAULT_ITEMS = 5;
1317

@@ -49,6 +53,11 @@ export const KeyPromises = async ({
4953
}
5054

5155
const payload = await getGlobalPayload();
56+
const { subdomain } = await getDomain();
57+
const tenant = await getTenantBySubDomain(subdomain);
58+
const locale = tenant
59+
? resolveTenantLocale(tenant)
60+
: await resolveBrowserLocale();
5261

5362
const entityQuery = await payload.find({
5463
collection: "political-entities",
@@ -59,6 +68,7 @@ export const KeyPromises = async ({
5968
},
6069
limit: 1,
6170
depth: 0,
71+
locale,
6272
});
6373

6474
const entity = entityQuery.docs[0] as PoliticalEntity | undefined;
@@ -71,6 +81,7 @@ export const KeyPromises = async ({
7181
collection: "promise-status",
7282
limit: -1,
7383
depth: 0,
84+
locale,
7485
});
7586

7687
const statusById = new Map<string, PromiseStatus>(
@@ -98,10 +109,11 @@ export const KeyPromises = async ({
98109
limit: resolvedLimit,
99110
depth: 1,
100111
sort: "-updatedAt",
112+
locale,
101113
});
102114

103115
const promiseDocs = promisesQuery.docs as PromiseDocument[];
104-
const promiseUpdateSettings = await getPromiseUpdateEmbed();
116+
const promiseUpdateSettings = await getPromiseUpdateEmbed(locale);
105117
const fallbackImage = promiseUpdateSettings?.defaultImage
106118
? await resolveMedia(promiseUpdateSettings.defaultImage)
107119
: null;

src/components/Partners/Partners.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ const Partners = React.forwardRef<HTMLDivElement, Props>(function Partners(
4545
xs: "center",
4646
lg: "space-between",
4747
}}
48+
rowSpacing={{ xs: 4, md: 5 }}
49+
columnSpacing={{ lg: 4 }}
4850
>
4951
{partners.slice(0, 6).map((partner) => (
5052
<Grid
@@ -57,9 +59,11 @@ const Partners = React.forwardRef<HTMLDivElement, Props>(function Partners(
5759
<CMSLink {...partner.url} label={""} entitySlug={entitySlug}>
5860
<Box
5961
sx={{
60-
height: { xs: 126.56, lg: 120 },
61-
width: { xs: 273.6, lg: 260 },
62+
width: "100%",
63+
maxWidth: { xs: 260, sm: 320, lg: 280 },
64+
aspectRatio: "3 / 2",
6265
position: "relative",
66+
mx: "auto",
6367
}}
6468
component={"figure"}
6569
>
@@ -68,6 +72,8 @@ const Partners = React.forwardRef<HTMLDivElement, Props>(function Partners(
6872
src={partner.image?.url}
6973
alt={partner.name}
7074
fill
75+
style={{ objectFit: "contain" }}
76+
sizes="(min-width: 1200px) 280px, (min-width: 900px) 320px, 260px"
7177
/>
7278
)}
7379
</Box>

0 commit comments

Comments
 (0)