Kaynağa Gözat

Feature: customLocalize prop added for SiteLogo component.

lfabl 1 ay önce
ebeveyn
işleme
f54c823aa8

+ 3 - 0
src/components/embeddedMenu/index.tsx

@@ -50,6 +50,7 @@ const Menu: RefForwardingComponent<IEmbeddedMenuRef, IEmbeddedMenuProps> = ({
     renderFooter: RenderFooter,
     isShowSiteLogo = true,
     close: closeAction,
+    customLocalize,
     maxWidth = 300,
     minWidth = 75,
     siteLogoProps,
@@ -323,6 +324,8 @@ const Menu: RefForwardingComponent<IEmbeddedMenuRef, IEmbeddedMenuProps> = ({
                 ]}
             >
                 {isShowSiteLogo ? <SiteLogo
+                    customLocalize={customLocalize}
+                    customTheme={customTheme}
                     {...siteLogoProps}
                     title={isActive ? siteLogoProps?.title : undefined}
                     size={isActive ? siteLogoProps?.size : "small"}

+ 3 - 0
src/components/embeddedMenu/type.ts

@@ -51,6 +51,9 @@ interface IEmbeddedMenuProps {
         paletteKey?: keyof NCoreUIKit.PaletteKey;
         themeKey?: keyof NCoreUIKit.ThemeKey;
     };
+    customLocalize?: {
+        activeLocale?: keyof NCoreUIKit.LocaleKey;
+    };
     buttons: Array<EmbeddedMenuButton>;
     navigation: NCoreUIKit.Navigation;
     isWorkWithSafeAreaView?: boolean;

+ 5 - 1
src/components/mainHeader/index.tsx

@@ -33,7 +33,9 @@ const MainHeader = ({
     renderLeft: RenderLeft,
     customBackgroundColor,
     onContentHeight,
+    customLocalize,
     siteLogoProps,
+    customTheme,
     glassEffect,
     children,
     style,
@@ -83,8 +85,10 @@ const MainHeader = ({
         }
 
         return <SiteLogo
-            size="medium"
             isWorkWithFlex1={false}
+            customLocalize={customLocalize}
+            customTheme={customTheme}
+            size="medium"
             {...siteLogoProps}
         />;
     };

+ 9 - 0
src/components/mainHeader/type.ts

@@ -22,6 +22,15 @@ interface IMainHeader extends ViewProps {
     customBackgroundColor?: keyof NCoreUIKit.ProjectColorPalette;
     backgroundColor?: keyof NCoreUIKit.ContainerContentColors;
     onContentHeight?: (contentHeight: number | null) => void;
+    customTheme?: {
+        gapPropagation?: keyof NCoreUIKit.GapPropagationKey;
+        sharpness?: keyof NCoreUIKit.SharpnessKey;
+        paletteKey?: keyof NCoreUIKit.PaletteKey;
+        themeKey?: keyof NCoreUIKit.ThemeKey;
+    };
+    customLocalize?: {
+        activeLocale?: keyof NCoreUIKit.LocaleKey;
+    };
     isWorkWithSafeAreaView?: boolean;
     isWorkWithStickySpace?: boolean;
     isSetAutoHeaderSpace?: boolean;

+ 3 - 0
src/components/menu/index.tsx

@@ -52,6 +52,7 @@ const Menu: RefForwardingComponent<IMenuRef, IMenuProps> = ({
     customBackgroundColor,
     close: closeAction,
     glassEffect = 0,
+    customLocalize,
     seperatorProps,
     siteLogoProps,
     customTheme,
@@ -281,6 +282,8 @@ const Menu: RefForwardingComponent<IMenuRef, IMenuProps> = ({
             ]}
         >
             <SiteLogo
+                customLocalize={customLocalize}
+                customTheme={customTheme}
                 {...siteLogoProps}
             />
             <Seperator

+ 3 - 0
src/components/menu/type.ts

@@ -54,6 +54,9 @@ interface IMenuProps {
         paletteKey?: keyof NCoreUIKit.PaletteKey;
         themeKey?: keyof NCoreUIKit.ThemeKey;
     };
+    customLocalize?: {
+        activeLocale?: keyof NCoreUIKit.LocaleKey;
+    };
     navigation: NCoreUIKit.Navigation;
     isWorkWithSafeAreaView?: boolean;
     seperatorProps?: ISeperatorProps;

+ 8 - 1
src/components/siteLogo/index.tsx

@@ -12,6 +12,7 @@ import stylesheet, {
     useStyles
 } from "./stylesheet";
 import {
+    NCoreUIKitLocalize,
     NCoreUIKitTheme
 } from "../../core/hooks";
 import {
@@ -32,6 +33,7 @@ const SiteLogo = ({
     image: ImageProp,
     backgroundColor,
     subTitleVariant,
+    customLocalize,
     icon: IconProp,
     size = "large",
     subTitleStyle,
@@ -47,6 +49,7 @@ const SiteLogo = ({
     imageProps,
     isLoading,
     iconColor,
+    titleKey,
     imageUrl,
     subTitle,
     onPress,
@@ -59,6 +62,10 @@ const SiteLogo = ({
         spaces
     } = NCoreUIKitTheme.useContext(customTheme);
 
+    const {
+        localize
+    } = NCoreUIKitLocalize.useContext(customLocalize);
+
     const currentSize = getSiteLogoSize({
         spaces,
         size
@@ -202,7 +209,7 @@ const SiteLogo = ({
                     ...titleStyle
                 }}
             >
-                {title}
+                {titleKey ? localize(titleKey) : title}
             </Text>
             {
                 subTitle ?

+ 4 - 0
src/components/siteLogo/type.ts

@@ -69,7 +69,11 @@ interface ISiteLogoProps {
     iconColor?: keyof NCoreUIKit.ProjectColorPalette;
     titleColor?: keyof NCoreUIKit.TextContentColors;
     subTitleVariant?: keyof NCoreUIKit.Typography;
+    customLocalize?: {
+        activeLocale?: keyof NCoreUIKit.LocaleKey;
+    };
     titleVariant?: keyof NCoreUIKit.Typography;
+    titleKey?: keyof NCoreUIKit.Translation;
     image?: ComponentType<ImageProps>;
     imageSource?: ImageURISource;
     isCustomImageSize?: boolean;