<commit_before>import Cookies from 'js-cookie';
import PropTypes from 'prop-types';
import React from 'react';
import { ThemeProvider } from 'styled-components';
import ContentWrapper from './ContentWrapper';
import ThemeToggle from './ThemeToggle';
import themes from '../utilities/themes';

export default class Layout extends React.PureComponent {
  static propTypes = {
    children: PropTypes.node.isRequired,
  };

  static themeKeys = {
    dark: 'dark',
    light: 'light',
  };

  state = {
    themeKey: Layout.themeKeys.dark,
  };

  componentDidMount() {
    const themeKey = Cookies.get('theme');
    if (themeKey) this.setState({ themeKey });
  }

  getNextThemeKey() {
    const { themeKey } = this.state;

    return themeKey === Layout.themeKeys.dark
      ? Layout.themeKeys.light
      : Layout.themeKeys.dark;
  }

  toggleTheme = () => {
    const themeKey = this.getNextThemeKey();
    Cookies.set('theme', themeKey);
    this.setState({ themeKey });
  };

  render() {
    const { children } = this.props;
    const { themeKey } = this.state;

    return (
      <ThemeProvider theme={themes[themeKey]}>
        <ContentWrapper>
          <ThemeToggle onClick={this.toggleTheme}>
            switch to {this.getNextThemeKey()} theme
          </ThemeToggle>
          {children}
        </ContentWrapper>
      </ThemeProvider>
    );
  }
}
<commit_msg>back to default light<commit_after>import Cookies from 'js-cookie';
import PropTypes from 'prop-types';
import React from 'react';
import { ThemeProvider } from 'styled-components';
import ContentWrapper from './ContentWrapper';
import ThemeToggle from './ThemeToggle';
import themes from '../utilities/themes';

export default class Layout extends React.PureComponent {
  static propTypes = {
    children: PropTypes.node.isRequired,
  };

  static themeKeys = {
    dark: 'dark',
    light: 'light',
  };

  state = {
    themeKey: Layout.themeKeys.light,
  };

  componentDidMount() {
    const themeKey = Cookies.get('theme');
    if (themeKey) this.setState({ themeKey });
  }

  getNextThemeKey() {
    const { themeKey } = this.state;

    return themeKey === Layout.themeKeys.dark
      ? Layout.themeKeys.light
      : Layout.themeKeys.dark;
  }

  toggleTheme = () => {
    const themeKey = this.getNextThemeKey();
    Cookies.set('theme', themeKey);
    this.setState({ themeKey });
  };

  render() {
    const { children } = this.props;
    const { themeKey } = this.state;

    return (
      <ThemeProvider theme={themes[themeKey]}>
        <ContentWrapper>
          <ThemeToggle onClick={this.toggleTheme}>
            switch to {this.getNextThemeKey()} theme
          </ThemeToggle>
          {children}
        </ContentWrapper>
      </ThemeProvider>
    );
  }
}

{'fraction_non_alphanumeric': 0.131836291198841, 'fraction_numerical': 0.0, 'mean_word_length': 2.9344729344729346, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, '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': '1427601', 'n_tokens_mistral': 816, 'n_tokens_neox': 801, 'n_words': 189}