/** @jsx createElement */
import { createElement, Component, render } from 'rax';
import SearchBar from 'nuke-search-bar';
import { StyleProvider } from 'nuke-theme-provider';
import {
  decodeVar,
  DemoContainer,
  DemoSection,
  Demo,
  DemoItem,
  initDemo,
} from '@alife/nuke-demo-helper';

const App = class NukeDemoIndex extends Component {
  constructor() {
    super();
    this.state = {
      showSearchButton: true,

      value2: '',
    };
  }

  render() {
    return (
      <StyleProvider style={decodeVar(this.props.variable)}>
        <DemoContainer>
          <DemoSection title="normal">
            <Demo>
              <DemoItem>
                <SearchBar style={styles.wrap} placeholder="输入搜索关键词" />
              </DemoItem>
            </Demo>
          </DemoSection>
          <DemoSection title="无按钮">
            <Demo>
              <DemoItem>
                <SearchBar
                  placeholder="Search"
                  style={styles.wrap}
                  showSearchButton={false}
                />
              </DemoItem>
            </Demo>
          </DemoSection>
        </DemoContainer>
      </StyleProvider>
    );
  }
};
const styles = {
  wrap: { backgroundColor: '#EBECF0' },
};
// render(<App />);
window.renderDemo = function (lang, variable) {
  render(<App variable={variable} />);
};

renderDemo('en-us', window.THEME_VARIABLE);

initDemo('search-bar');
