bbovenzi commented on code in PR #63467:
URL: https://github.com/apache/airflow/pull/63467#discussion_r3040210877


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/TaskLogContent.tsx:
##########
@@ -82,7 +85,39 @@ const ScrollToButton = ({
   );
 };
 
-export const TaskLogContent = ({ error, isLoading, logError, parsedLogs, wrap 
}: TaskLogContentProps) => {
+const HighlightedText = ({ children, query }: { readonly children: ReactNode; 
readonly query?: string }) => {

Review Comment:
   We can also use `PropsWithChildren` that already comes from react  instead 
of manually defining children.



##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/TaskLogContent.tsx:
##########
@@ -82,7 +85,39 @@ const ScrollToButton = ({
   );
 };
 
-export const TaskLogContent = ({ error, isLoading, logError, parsedLogs, wrap 
}: TaskLogContentProps) => {
+const HighlightedText = ({ children, query }: { readonly children: ReactNode; 
readonly query?: string }) => {
+  if (typeof query !== "string" || query.length === 0 || typeof children !== 
"string") {
+    return children;
+  }
+
+  const segments = splitBySearchQuery(children, query);
+
+  return (
+    <span>
+      {segments.map((segment, idx) =>
+        segment.highlight ? (
+          // eslint-disable-next-line react/no-array-index-key
+          <Mark bg="bg.subtle" key={idx}>
+            {segment.text}
+          </Mark>
+        ) : (
+          segment.text
+        ),
+      )}
+    </span>
+  );
+};

Review Comment:
   Let's make HighlightedText it's own file.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to