How to use the react-instantsearch/connectors.connectMenu function in react-instantsearch

To help you get started, weā€™ve selected a few react-instantsearch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github algolia / react-instantsearch / examples / react-native / src / Home.js View on Github external
onPress={() =>
        /* eslint-disable new-cap */
        Actions.Filters({
          searchState,
          onSearchStateChange,
        })
      }
      /* eslint-enable new-cap */
      title={`Filters (${items.length})`}
      color="#162331"
    />
  )
);
const VirtualRange = connectRange(() => null);
const VirtualRefinementList = connectRefinementList(() => null);
const VirtualMenu = connectMenu(() => null);
github algolia / react-instantsearch / examples / react-native / src / Filters.js View on Github external
);
  }
}

Refinements.propTypes = {
  searchState: PropTypes.object.isRequired,
  refine: PropTypes.func.isRequired,
  onSearchStateChange: PropTypes.func.isRequired,
  items: PropTypes.array.isRequired,
};

const ConnectedRefinements = connectCurrentRefinements(Refinements);
const VirtualRefinementList = connectRefinementList(() => null);
const VirtualSearchBox = connectSearchBox(() => null);
const VirtualMenu = connectMenu(() => null);
const VirtualRange = connectRange(() => null);

export default Filters;
github algolia / react-instantsearch / examples / react-native / src / Price.js View on Github external
);
    return ;
  }
}

Range.propTypes = {
  min: PropTypes.number,
  max: PropTypes.number,
  currentRefinement: PropTypes.object,
  refine: PropTypes.func.isRequired,
};

const VirtualRefinementList = connectRefinementList(() => null);
const VirtualSearchBox = connectSearchBox(() => null);
const VirtualMenu = connectMenu(() => null);
const ConnectedRange = connectRange(Range);
github algolia / react-instantsearch / examples / react-native / src / Rating.js View on Github external
);
  }
}

const VirtualRefinementList = connectRefinementList(() => null);
const VirtualSearchBox = connectSearchBox(() => null);
const VirtualMenu = connectMenu(() => null);
const VirtualRange = connectRange(() => null);
const ConnectedRating = connectRange(Rating);
github EnMarche / transformer.en-marche.fr / src / js / components / profiles.js View on Github external
)
    });
    return (
      <div>
        {this.props.children}
        <ul>
          {buttons}
        </ul>
      </div>
    );
  }
  
}

Profiles = connectMenu(Profiles);

export { Profiles };
  

class ProfilesDropdown extends Component {
  state = {}
  
  constructor(props) {
    super(props);
    let active = props.profiles[props.activeProfile];
    if (active) {
      this.state = {
        value: active.id,
        label: active.title
      };
    }
github algolia / react-instantsearch / examples / react-native / src / Categories.js View on Github external
backgroundColor: adjacentRowHighlighted ? '#3B5998' : '#CCCCCC',
      }}
    />
  );
}

Menu.propTypes = {
  query: PropTypes.string,
  saveQuery: PropTypes.func,
  searchForItems: PropTypes.func,
  refine: PropTypes.func,
  items: PropTypes.array,
  isFromSearch: PropTypes.bool,
};

const ConnectedMenu = connectMenu(Menu);
const VirtualSearchBox = connectSearchBox(() => null);
const VirtualRefinementList = connectRefinementList(() => null);
const VirtualRange = connectRange(() => null);
github EnMarche / transformer.en-marche.fr / src / js / components / manifesto.js View on Github external
}

  render() {
    let { visibleManifestos } = this.state;

    return visibleManifestos.map(manifesto =&gt;
       this.props.toggle(manifesto)} /&gt;
    );
  }
}

ManifestoFilters = connectMenu(ManifestoFilters);

class ManifestoListItem extends Component {
  state = {}

  measureButton() {
    let textWidth = this.button.children[0].getBoundingClientRect().width;
    this.setState({style: {flexBasis: textWidth + 24}});
  }

  componentDidMount() {
    this.measureButton();
  }

  componentWillReceiveProps() {
    this.measureButton();
  }
github EnMarche / transformer.en-marche.fr / src / js / components / profiles.js View on Github external
}
  
  render() {
    return <select value="{this.state.value}" placeholder="Je suis...">
  }
};

ProfilesDropdown = connectMenu(ProfilesDropdown);

ProfilesDropdown = connect(({ profiles: { profiles, items, activeProfile }}) =&gt; ({
  profileOptions: items.map(id =&gt; ({label: profiles[id].title, value: id})).sort((a, b) =&gt; a.label.localeCompare(b.label)),
  profiles,
  activeProfile
}), dispatch =&gt; ({
  push: url =&gt; dispatch(push(url)),
  toggleProfile: profile =&gt; dispatch(setProfile(profile)),
  resetParams: (...args) =&gt; dispatch(resetParams(...args))
}))(ProfilesDropdown);

export { ProfilesDropdown };
</select>
github jscoach / client / src / Tabs.js View on Github external
key={label}&gt;
    <span>{label}</span>
  
);

const Tabs = ({ attributeName, currentRefinement, items, ...otherProps }) =&gt; (
  <div>
    {items.length &gt; 0 &amp;&amp; (
      
    )}

    {items.map(item =&gt; )}
  </div>
);

export default connectMenu(Tabs);
github algolia / react-instantsearch / examples / react-native / src / Type.js View on Github external
);
}

RefinementList.propTypes = {
  query: PropTypes.string,
  saveQuery: PropTypes.func,
  searchForItems: PropTypes.func,
  refine: PropTypes.func,
  items: PropTypes.array,
  isFromSearch: PropTypes.bool,
};

const ConnectedRefinementList = connectRefinementList(RefinementList);
const VirtualSearchBox = connectSearchBox(() => null);
const VirtualRange = connectRange(() => null);
const VirtualMenu = connectMenu(() => null);