<commit_before>import React from 'react';
import PropTypes from 'prop-types';

/**
 * A Wrapper function to inject the theme passed in by the context as a prop into the JSS HOC.
 *
 * @private
 * @param {Function} Component - The HOC from JSS.
 * @param {String} [componentName] - The name of the component so we only pass the theme
 * for the component. This makes it easier with jss.
 * @returns {Function} - Returns the new wrapper function which will render the HOC from JSS.
 */
export default function connectWithTheme(Component, componentName = null) {
  /**
   * The Wrapper component to pass the theme as a prop.
   *
   * @param {Object} props - Additional props for the element.
   * @param {Object} context - The context of the function.
   * @param {Object} context.theme - The theme provided by the context.
   * @returns {JSX} - Returns the HOC from JSS.
   */
  function Wrapper(props, { theme }) {
    return (
      <Component
        theme={componentName ? theme[componentName] : theme}
        {...props}
      />
    );<commit_msg>Added default values for the theme so we don't run into problems when we have a component which renders a component that is connected with the theme<commit_after>import React from 'react';
import PropTypes from 'prop-types';

/**
 * A Wrapper function to inject the theme passed in by the context as a prop into the JSS HOC.
 *
 * @private
 * @param {Function} Component - The HOC from JSS.
 * @param {String} [componentName] - The name of the component so we only pass the theme
 * for the component. This makes it easier with jss.
 * @returns {Function} - Returns the new wrapper function which will render the HOC from JSS.
 */
export default function connectWithTheme(Component, componentName = null) {
  /**
   * The Wrapper component to pass the theme as a prop.
   *
   * @param {Object} props - Additional props for the element.
   * @param {Object} context - The context of the function.
   * @param {Object} [context.theme] - The theme provided by the context.
   * @returns {JSX} - Returns the HOC from JSS.
   */
  function Wrapper(props, { theme = {} }) {
    return (
      <Component
        theme={componentName ? theme[componentName] || {} : theme}
        {...props}
      />
    );
{'fraction_non_alphanumeric': 0.09680284191829484, 'fraction_numerical': 0.0, 'mean_word_length': 3.1038251366120218, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5886658', 'n_tokens_mistral': 618, 'n_tokens_neox': 617, 'n_words': 284}