<commit_before>import * as React from 'react'
import PropTypes from 'prop-types'
import { cx } from 'emotion'

import IconSearch from 'react-feather/dist/icons/search'

export default class DocSearch extends React.Component {
  static propTypes = {
    isOpen: PropTypes.bool.isRequired
  }

  state = {
    enabled: true
  }

  componentDidMount() {
    // Initialize Algolia search.
    if (window.docsearch) {
      window.docsearch({
        apiKey: '<KEY>',
        indexName: 'spreecommerce',
        inputSelector: '#algolia-doc-search'
      })
    } else {
      console.warn('Search has failed to load and now is being disabled')
      this.setState({ enabled: false })
    }
  }

  render() {
    const { enabled } = this.state

    return enabled ? (
      <form
        css={{
          '& > .algolia-autocomplete': {
            position: 'static !important',
            width: '100%'
          }
        }}
        className={cx(
          { 'db absolute left-0': this.props.isOpen },
          { dn: !this.props.isOpen },
          `ml4-l pr0-l ph3 relative db-l w-100 w-auto-l`
        )}
      >
        <IconSearch className="absolute z-999 top-0 mt2 pt1 ml3 moon-gray" />
        <input
          className={cx(
            { 'w-100': this.props.isOpen },
            'pv3 pr3 w6 ba b--moon-gray'
          )}
          id="algolia-doc-search"
          type="search"<commit_msg>Fix DocSearch responsive styles<commit_after>import * as React from 'react'
import PropTypes from 'prop-types'
import { cx } from 'emotion'

import IconSearch from 'react-feather/dist/icons/search'

export default class DocSearch extends React.Component {
  static propTypes = {
    isOpen: PropTypes.bool.isRequired
  }

  state = {
    enabled: true
  }

  componentDidMount() {
    // Initialize Algolia search.
    if (window.docsearch) {
      window.docsearch({
        apiKey: '<KEY>',
        indexName: 'spreecommerce',
        inputSelector: '#algolia-doc-search'
      })
    } else {
      console.warn('Search has failed to load and now is being disabled')
      this.setState({ enabled: false })
    }
  }

  render() {
    const { enabled } = this.state

    return enabled ? (
      <form
        css={{
          '& > .algolia-autocomplete': {
            position: 'static !important',
            width: '100%'
          },
          '& .ds-dropdown-menu': {
            minWidth: '100% !important',

            '@media (min-width: 60rem)': {
              minWidth: '500px !important'
            }
          }
        }}
        className={cx(
          { 'db absolute left-0': this.props.isOpen },
          { dn: !this.props.isOpen },
          `ml4-l pr0-l ph3 relative db-l w-100 w-auto-l`
        )}
      >
        <IconSearch className="absolute z-999 top-0 mt2 pt1 ml3 moon-gray" />
        <input
          className={cx(
            { 'w-100': this.props.isOpen },
            'pv3 pr3 w6 ba b--moon-gray'
          )}
          id="algolia-doc-search"
          type="search"
{'fraction_non_alphanumeric': 0.1276595744680851, 'fraction_numerical': 0.01795212765957447, 'mean_word_length': 1.8333333333333333, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6626682', 'n_tokens_mistral': 947, 'n_tokens_neox': 919, 'n_words': 220}