<commit_before>import { css, cx } from "emotion";
import { withTheme } from "emotion-theming";
import idx from "idx";
import * as React from "react";

import { ResultClickedFn } from "../context/pipeline/context";
import { Theme } from "../styles";
import { Image } from "./Image";
import { TokenLink } from "./TokenLink";

export interface ResultProps {
  token: string;
  values: { [k: string]: string | string[] };
  resultClicked: ResultClickedFn;
  score?: number;
  indexScore?: number;
  showImage?: boolean;

  theme?: Theme;
  styles?: ResultStyles | null;
  className?: string;
}

export interface ResultStyles {
  container?: React.CSSProperties;
  title?: React.CSSProperties;
  description?: React.CSSProperties;
  url?: React.CSSProperties;
}

export class Result extends React.Component<ResultProps> {
  public render() {
    const {
      token,
      values,
      resultClicked,
      showImage = false,
      theme
    } = this.props;
    let styles = this.props.styles;
    if (styles === null || styles === undefined) {
      styles = {};
    }

    const title = values.title;
    const description = values.description;
    const url = values.url;
    const img = values.image;

    const classNames = {
      container: cx(
        "sj-results__result",
        this.props.className,
        css(resultStyles.container),
        showImage && css({ flexDirection: "row" }),
        styles && styles.container && css(styles.container as any)
      ),
      img: css({ display: "inline-block" }),
      textContainer: cx("sj-result__text", css({ minWidth: 0 })),
      title: cx(
        "sj-results__result__title",
        css(resultStyles.title),
        styles && styles.title && css(styles.title as any),
        themeColor(theme),
        css({ "&:hover": themeColor(theme) })
      ),
      description: cx(
        "sj-results__result__description",
        css(resultStyles.description),
        styles && styles.description && css(styles.description as any)
      ),
      url: cx(
        "sj-result__result__link",
        css(resultStyles.link),
        styles && styles.url && css(styles.url as any),
        css({ "&:hover": themeColor(theme) })
      )
    };

    return (
      <div className={classNames.container}>
        {showImage && (
          <Image className={classNames.img} src={img as string} alt={""} />
        )}
        <div className={classNames.textContainer}>
          <TokenLink
            url={url as string}
            token={token}
            resultClicked={resultClicked}
            className={classNames.title}
          >
            <h3>{title}</h3>
          </TokenLink>
          <p className={classNames.description}>{description}</p>
          <TokenLink
            url={url as string}
            token={token}
            resultClicked={resultClicked}
            className={classNames.url}
          >
            {url}
          </TokenLink>
        </div><commit_msg>components/Result: update link class to be consistent with the others<commit_after>import { css, cx } from "emotion";
import { withTheme } from "emotion-theming";
import idx from "idx";
import * as React from "react";

import { ResultClickedFn } from "../context/pipeline/context";
import { Theme } from "../styles";
import { Image } from "./Image";
import { TokenLink } from "./TokenLink";

export interface ResultProps {
  token: string;
  values: { [k: string]: string | string[] };
  resultClicked: ResultClickedFn;
  score?: number;
  indexScore?: number;
  showImage?: boolean;

  theme?: Theme;
  styles?: ResultStyles | null;
  className?: string;
}

export interface ResultStyles {
  container?: React.CSSProperties;
  title?: React.CSSProperties;
  description?: React.CSSProperties;
  url?: React.CSSProperties;
}

export class Result extends React.Component<ResultProps> {
  public render() {
    const {
      token,
      values,
      resultClicked,
      showImage = false,
      theme
    } = this.props;
    let styles = this.props.styles;
    if (styles === null || styles === undefined) {
      styles = {};
    }

    const title = values.title;
    const description = values.description;
    const url = values.url;
    const img = values.image;

    const classNames = {
      container: cx(
        "sj-results__result",
        this.props.className,
        css(resultStyles.container),
        showImage && css({ flexDirection: "row" }),
        styles && styles.container && css(styles.container as any)
      ),
      img: css({ display: "inline-block" }),
      textContainer: cx("sj-result__text", css({ minWidth: 0 })),
      title: cx(
        "sj-results__result__title",
        css(resultStyles.title),
        styles && styles.title && css(styles.title as any),
        themeColor(theme),
        css({ "&:hover": themeColor(theme) })
      ),
      description: cx(
        "sj-results__result__description",
        css(resultStyles.description),
        styles && styles.description && css(styles.description as any)
      ),
      url: cx(
        "sj-results__result__link",
        css(resultStyles.link),
        styles && styles.url && css(styles.url as any),
        css({ "&:hover": themeColor(theme) })
      )
    };

    return (
      <div className={classNames.container}>
        {showImage && (
          <Image className={classNames.img} src={img as string} alt={""} />
        )}
        <div className={classNames.textContainer}>
          <TokenLink
            url={url as string}
            token={token}
            resultClicked={resultClicked}
            className={classNames.title}
          >
            <h3>{title}</h3>
          </TokenLink>
          <p className={classNames.description}>{description}</p>
          <TokenLink
            url={url as string}
            token={token}
            resultClicked={resultClicked}
            className={classNames.url}
          >
            {url}
          </TokenLink>
        </div>
{'fraction_non_alphanumeric': 0.13333333333333333, 'fraction_numerical': 0.0010075566750629723, 'mean_word_length': 2.382169222032936, 'pattern_counts': {'":': 4, '<': 29, '<?xml version=': 0, '>': 29, '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': '6416888', 'n_tokens_mistral': 1670, 'n_tokens_neox': 1675, 'n_words': 404}