Bladeren bron

Bugfix: SiteLogo titleKey prop problems fixed.

lfabl 1 maand geleden
bovenliggende
commit
d6488c66b1
2 gewijzigde bestanden met toevoegingen van 6 en 4 verwijderingen
  1. 5 4
      src/components/siteLogo/index.tsx
  2. 1 0
      src/components/siteLogo/type.ts

+ 5 - 4
src/components/siteLogo/index.tsx

@@ -42,6 +42,7 @@ const SiteLogo = ({
     imageSource,
     customTheme,
     borderColor,
+    subTitleKey,
     titleStyle,
     imageSpace,
     isDisabled,
@@ -124,7 +125,7 @@ const SiteLogo = ({
     const renderLoading = () => {
         let loadingColor: keyof NCoreUIKit.IconContentColors = "default";
 
-        if(title) {
+        if(title || titleKey) {
             loadingColor = "onPrimary";
         } else if(imageUrl || ImageProp) {
             loadingColor = "mid";
@@ -188,7 +189,7 @@ const SiteLogo = ({
     };
 
     const renderTitles = () => {
-        if(!title) {
+        if(!title && !titleKey) {
             return null;
         }
 
@@ -212,7 +213,7 @@ const SiteLogo = ({
                 {titleKey ? localize(titleKey) : title}
             </Text>
             {
-                subTitle ?
+                subTitle || subTitleKey ?
                     <Text
                         customColor={subTitleCustomColor ? colors.project[subTitleCustomColor] : undefined}
                         variant={subTitleVariant ? subTitleVariant : currentSize.subTitleSize}
@@ -224,7 +225,7 @@ const SiteLogo = ({
                             ...subTitleStyle
                         }}
                     >
-                        {subTitle}
+                        {subTitleKey ? subTitleKey : subTitle}
                     </Text>
                     :
                     null

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

@@ -73,6 +73,7 @@ interface ISiteLogoProps {
         activeLocale?: keyof NCoreUIKit.LocaleKey;
     };
     titleVariant?: keyof NCoreUIKit.Typography;
+    subTitleKey?: keyof NCoreUIKit.Translation;
     titleKey?: keyof NCoreUIKit.Translation;
     image?: ComponentType<ImageProps>;
     imageSource?: ImageURISource;