Forráskód Böngészése

componentize notificationDate

Shun Miyazawa 4 éve
szülő
commit
61508ba445

+ 12 - 6
packages/app/src/components/InAppNotification/InAppNotificationElm.tsx

@@ -56,6 +56,17 @@ const InAppNotificationElm = (props: Props): JSX.Element => {
     );
   };
 
+  const renderNotificationDate = (): JSX.Element => {
+    return (
+      <FormattedDistanceDate
+        id={notification._id}
+        date={notification.createdAt}
+        isShowTooltip={false}
+        differenceForAvoidingFormat={Number.POSITIVE_INFINITY}
+      />
+    );
+  };
+
   const actionUsers = getActionUsers();
 
   const actionType: string = notification.action;
@@ -119,12 +130,7 @@ const InAppNotificationElm = (props: Props): JSX.Element => {
             <b>{actionUsers}</b> {actionMsg} <PagePathLabel page={pagePath} />
           </div>
           <i className={`${actionIcon} mr-2`} />
-          <FormattedDistanceDate
-            id={notification._id}
-            date={notification.createdAt}
-            isShowTooltip={false}
-            differenceForAvoidingFormat={Number.POSITIVE_INFINITY}
-          />
+          {renderNotificationDate()}
         </div>
       </div>
     );