<commit_before>// @flow
import * as React from "react";

import { connect } from "react-redux";

import { Logo } from "./logos";

import * as selectors from "../../selectors";
import type { AppState } from "../../state";

type TitleBarProps = {
  title: string,
  theme: "light" | "dark",
  onTitleChange?: (title: string) => void,
  logoHref?: string
};

export const TitleBar = (props: TitleBarProps) => (
  <React.Fragment>
    <header>
      <a href={props.logoHref}>
        <Logo height={20} theme={props.theme} />
      </a>
      <p>{props.title}</p>
    </header>
    <style jsx>{`
      header {
        display: flex;
        justify-content: flex-start;
        background-color: var(--theme-title-bar-bg, rgb(250, 250, 250));
        padding: 10px 16px;
      }

      a {
        display: inline-block;
        margin: 0 30px;
      }

      p {
        display: inline-block;
        margin: 0 30px;
      }
    `}</style>
  </React.Fragment>
);

const mapStateToProps = (
  state: AppState,
  ownProps: { logoHref?: string }
): TitleBarProps => ({
  title: selectors
    .currentFilepath(state)
    .split("/")
    .pop()
    .split(".ipynb")
    .shift(),
  theme: selectors.currentTheme(state),
  logoHref: ownProps.logoHref
});

const mapDispatchToProps = dispatch => ({
  onTitleChange: (title: string) => {
    // TODO: Once the content refs PR is finished use the ref to change
    // the filename, noting that the URL path should also change
    console.error("not implemented yet");
  }<commit_msg>line up spacing for title and notebook creation<commit_after>// @flow
import * as React from "react";

import { connect } from "react-redux";

import { Logo } from "./logos";

import * as selectors from "../../selectors";
import type { AppState } from "../../state";

type TitleBarProps = {
  title: string,
  theme: "light" | "dark",
  onTitleChange?: (title: string) => void,
  logoHref?: string
};

export const TitleBar = (props: TitleBarProps) => (
  <React.Fragment>
    <header>
      <a href={props.logoHref}>
        <Logo height={20} theme={props.theme} />
      </a>
      <p>{props.title}</p>
    </header>
    <style jsx>{`
      header {
        display: flex;
        justify-content: flex-start;
        background-color: var(--theme-title-bar-bg, rgb(250, 250, 250));
        padding: var(--nt-spacing-m) var(--nt-spacing-xl);
      }

      a {
        display: inline-block;
        margin: 0px var(--nt-spacing-xl) 0px 0px;
      }

      p {
        display: inline-block;
        margin: 0px var(--nt-spacing-xl) 0px 0px;
      }
    `}</style>
  </React.Fragment>
);

const mapStateToProps = (
  state: AppState,
  ownProps: { logoHref?: string }
): TitleBarProps => ({
  title: selectors
    .currentFilepath(state)
    .split("/")
    .pop()
    .split(".ipynb")
    .shift(),
  theme: selectors.currentTheme(state),
  logoHref: ownProps.logoHref
});

const mapDispatchToProps = dispatch => ({
  onTitleChange: (title: string) => {
    // TODO: Once the content refs PR is finished use the ref to change
    // the filename, noting that the URL path should also change
    console.error("not implemented yet");
  }
{'fraction_non_alphanumeric': 0.15691236950332174, 'fraction_numerical': 0.012021512179689971, 'mean_word_length': 2.5369127516778525, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 35, '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': '5036784', 'n_tokens_mistral': 1068, 'n_tokens_neox': 1031, 'n_words': 277}