<commit_before>import {h, Component} from 'preact';
import {Link} from 'preact-router';
import objstr from 'obj-str';

import Logo from '../icons/logo.js';

import styles from './header.css';

const Item = ({href, text}, {url}) => {
  const hrefRegex = href === '/' ? /(\/$|\/top)/ : new RegExp(href);

  return (
    <li class={styles.item}>
      <Link href={href} class={objstr({
        [styles.link]: true,
        [styles.active]: hrefRegex.test(url)
      })}>{text}</Link>
    </li>
  );
};

export default class extends Component {
  render(props, state) {
    return (
      <nav class={styles.header}>
        <ol class={styles.links}>
          <li class={styles.logo}>
            <Link href='/'>
              <Logo />
            </Link>
          </li>
          <Item href='/' text='top'/>
          <Item href='/new' text='new'/>
          <Item href='/show' text='show'/>
          <Item href='/ask' text='ask'/>
          <Item href='/jobs' text='jobs'/>
          <Item href='/about' text='about'/>
        </ol>
      </nav>
    );
  }
}<commit_msg>Add aria-label to header link to homepage.<commit_after>import {h, Component} from 'preact';
import {Link} from 'preact-router';
import objstr from 'obj-str';

import Logo from '../icons/logo.js';

import styles from './header.css';

const Item = ({href, text}, {url}) => {
  const hrefRegex = href === '/' ? /(\/$|\/top)/ : new RegExp(href);

  return (
    <li class={styles.item}>
      <Link href={href} class={objstr({
        [styles.link]: true,
        [styles.active]: hrefRegex.test(url)
      })}>{text}</Link>
    </li>
  );
};

export default class extends Component {
  render(props, state) {
    return (
      <nav class={styles.header}>
        <ol class={styles.links}>
          <li class={styles.logo}>
            <Link href='/' aria-label="Home">
              <Logo />
            </Link>
          </li>
          <Item href='/' text='top'/>
          <Item href='/new' text='new'/>
          <Item href='/show' text='show'/>
          <Item href='/ask' text='ask'/>
          <Item href='/jobs' text='jobs'/>
          <Item href='/about' text='about'/>
        </ol>
      </nav>
    );
  }
}
{'fraction_non_alphanumeric': 0.20283234353586113, 'fraction_numerical': 0.0, 'mean_word_length': 2.0888575458392102, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 43, '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': '4970840', 'n_tokens_mistral': 717, 'n_tokens_neox': 708, 'n_words': 173}