<commit_before>/* eslint-disable react/prop-types, no-sequences, no-unused-expressions */
import React from "react";
import { TextLink } from "@times-components/link";
import { checkStylesForUnits } from "@times-components/utils";
import renderByline from "./render-byline";
import { propTypes, defaultProps } from "./article-byline-prop-types";
import styles from "./styles";
import withTrackEvents from "../tracking/with-track-events";

const AuthorComponent = ({ slug, className, onAuthorPress, children }) => {
  const url = `/profile/${slug}`;
  const name = children[0];

  return (
    <TextLink
      className={className}
      onClick={e => {
        onAuthorPress(e, { name, slug });
      }}
      style={checkStylesForUnits(styles.link)}
      url={url}
    >
      {children}
    </TextLink>
  );
};

const ArticleBylineWithLinks = ({ ast, centered, ...props }) =>
  renderByline(
    withTrackEvents(AuthorComponent),
    ast,
    centered ? [styles.text, styles.centered] : styles.text,
    props
  );

ArticleBylineWithLinks.displayName = "ArticleBylineWithLinks";<commit_msg>fix(TDP-2097): change onClick to onPress in article-byline-with-links (#3163)<commit_after>/* eslint-disable react/prop-types, no-sequences, no-unused-expressions */
import React from "react";
import { TextLink } from "@times-components/link";
import { checkStylesForUnits } from "@times-components/utils";
import renderByline from "./render-byline";
import { propTypes, defaultProps } from "./article-byline-prop-types";
import styles from "./styles";
import withTrackEvents from "../tracking/with-track-events";

const AuthorComponent = ({ slug, className, onAuthorPress, children }) => {
  const url = `/profile/${slug}`;
  const name = children[0];

  return (
    <TextLink
      className={className}
      onPress={e => {
        onAuthorPress(e, { name, slug });
      }}
      style={checkStylesForUnits(styles.link)}
      url={url}
    >
      {children}
    </TextLink>
  );
};

const ArticleBylineWithLinks = ({ ast, centered, ...props }) =>
  renderByline(
    withTrackEvents(AuthorComponent),
    ast,
    centered ? [styles.text, styles.centered] : styles.text,
    props
  );

ArticleBylineWithLinks.displayName = "ArticleBylineWithLinks";
{'fraction_non_alphanumeric': 0.14666666666666667, 'fraction_numerical': 0.0044444444444444444, 'mean_word_length': 3.7893617021276595, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '824312', 'n_tokens_mistral': 680, 'n_tokens_neox': 674, 'n_words': 150}