Merged in feature/refactor-lang (pull request #387)
feat: SW-238 Avoid prop drilling of lang Approved-by: Michael Zetterberg
This commit is contained in:
@@ -14,12 +14,10 @@ import Contact from "./Contact"
|
||||
import styles from "./joinLoyalty.module.css"
|
||||
|
||||
import type { JoinLoyaltyContactProps } from "@/types/components/loyalty/sidebar"
|
||||
import { LangParams } from "@/types/params"
|
||||
|
||||
export default async function JoinLoyaltyContact({
|
||||
block,
|
||||
lang,
|
||||
}: JoinLoyaltyContactProps & LangParams) {
|
||||
}: JoinLoyaltyContactProps) {
|
||||
const { formatMessage } = await getIntl()
|
||||
const user = await serverClient().user.name()
|
||||
|
||||
@@ -55,7 +53,6 @@ export default async function JoinLoyaltyContact({
|
||||
<Body>{formatMessage({ id: "Already a friend?" })}</Body>
|
||||
<LoginButton
|
||||
className={styles.link}
|
||||
lang={lang}
|
||||
trackingId="loginJoinLoyalty"
|
||||
position="join scandic friends sidebar"
|
||||
color="burgundy"
|
||||
|
||||
@@ -10,12 +10,8 @@ import {
|
||||
SidebarTypenameEnum,
|
||||
} from "@/types/components/loyalty/enums"
|
||||
import { SidebarProps } from "@/types/components/loyalty/sidebar"
|
||||
import { LangParams } from "@/types/params"
|
||||
|
||||
export default function SidebarLoyalty({
|
||||
blocks,
|
||||
lang,
|
||||
}: SidebarProps & LangParams) {
|
||||
export default function SidebarLoyalty({ blocks }: SidebarProps) {
|
||||
return (
|
||||
<aside className={styles.aside}>
|
||||
{blocks.map((block, idx) => {
|
||||
@@ -37,18 +33,12 @@ export default function SidebarLoyalty({
|
||||
<JoinLoyaltyContact
|
||||
block={block.join_loyalty_contact}
|
||||
key={`${block.__typename}-${idx}`}
|
||||
lang={lang}
|
||||
/>
|
||||
)
|
||||
case SidebarTypenameEnum.LoyaltyPageSidebarDynamicContent:
|
||||
switch (block.dynamic_content.component) {
|
||||
case LoyaltySidebarDynamicComponentEnum.my_pages_navigation:
|
||||
return (
|
||||
<SidebarMyPages
|
||||
key={`${block.__typename}-${idx}`}
|
||||
lang={lang}
|
||||
/>
|
||||
)
|
||||
return <SidebarMyPages key={`${block.__typename}-${idx}`} />
|
||||
default:
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user