Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Conversation

@debuggy
Copy link
Contributor

@debuggy debuggy commented Dec 10, 2020

Implementation:

  • type some keywords and press enter to trigger onSearch event
  • set two states in SideBar: type and keyword, when the states are changes the url will changed to/?type=<type>&keyword=<keyword>
  • ItemList will fetch items from api based on url, i.e. send items request with query ?type=<type>&keyword=<keyword>
  • In rest server, uses sequelize [Op.substring] operation to query sql database

Demo:

image

Test Cases:

#160

Known Issues:

  • search keyword is case sensitive because [Op.substring] is case sensitive

Left work

  • show results number and keyword in itemlist

const SideBar = props => {
const { type } = props;
const SideBar = () => {
const [type, setType] = useState(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is here change type propagation from props to redux ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change props to state by using react hook

@debuggy debuggy merged commit 676c572 into master Dec 14, 2020
@debuggy debuggy deleted the mintao/search-bar branch December 14, 2020 07:02
@debuggy debuggy restored the mintao/search-bar branch December 17, 2020 06:45
@debuggy debuggy deleted the mintao/search-bar branch December 22, 2020 07:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants