<commit_before>import React from 'react';
import classNames from 'classnames';
import random from 'random-js';
import {classList, prefix} from './../../libs';

class NavLink extends React.Component {
  renderSubMenu(links, classes) {
    return links ? links.map((link, key) => {
      const {url, name, actionHandler} = link;
      const className = classNames(
        'mdl-menu__item',
        `${prefix}-nav-sub-link-item`,
        classes
      );
      return (
        <li className= {className}>
          {this.renderLink(url, name, actionHandler, classes, true)}
        </li>
      );
    }) : null;
  }
  renderLink(url, name, actionHandler, classes, isSubMenu) {
    const {navpos} = this.props;
    const className = classNames(
      {
        'mdl-navigation__link': !isSubMenu
      },
      classes,
      isSubMenu ? `${prefix}-nav-sub-link` : null,
      navpos === 'header' && isSubMenu ? `${prefix}-nav-sub-link-header` : null
    );
    return (
      <a
        href = {
          actionHandler &&
          typeof actionHandler === 'function' &&
          url &&
          typeof url === 'string' ? '#' : url
        }
        className = {className}
        onClick = {actionHandler && typeof actionHandler === 'function' ? actionHandler : () => {} }
      >
        {name && typeof name === 'string' ? name : 'Link'}
      </a>
    );
  }
  render() {
    const {
      navpos,<commit_msg>Fixed a bug in nav-link<commit_after>import React from 'react';
import classNames from 'classnames';
import random from 'random-js';
import {classList, prefix} from './../../libs';

class NavLink extends React.Component {
  renderSubMenu(links, classes) {
    return links ? links.map((link, key) => {
      const {url, name, actionHandler} = link;
      const className = classNames(
        'mdl-menu__item',
        `${prefix}-nav-sub-link-item`,
        classes
      );
      return (
        <li className= {className}>
          {this.renderLink(url, name, actionHandler, classes, true)}
        </li>
      );
    }) : null;
  }
  renderLink(url, name, actionHandler, classes, isSubMenu) {
    const {navpos} = this.props;
    const className = classNames(
      {
        'mdl-navigation__link': !isSubMenu
      },
      classes,
      isSubMenu ? `${prefix}-nav-sub-link` : null,
      navpos === 'header' && isSubMenu ? `${prefix}-nav-sub-link-header` : null
    );
    return (
      <a
        href = {
          actionHandler &&
          typeof actionHandler === 'function' &&
          !(url &&
          typeof url === 'string') ? '#' : url
        }
        className = {className}
        onClick = {actionHandler && typeof actionHandler === 'function' ? actionHandler : () => {} }
      >
        {name && typeof name === 'string' ? name : 'Link'}
      </a>
    );
  }
  render() {
    const {
      navpos,
{'fraction_non_alphanumeric': 0.1539543057996485, 'fraction_numerical': 0.0, 'mean_word_length': 2.148230088495575, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '4438198', 'n_tokens_mistral': 836, 'n_tokens_neox': 839, 'n_words': 205}