Skip to content

Add functionality to search bar (student view) #26

@JDC-horizons

Description

@JDC-horizons

Requirement:
user should be able to type into search box on top bar and search for other users by name.

Component:
search bar exists already in pages/dashboard/index.js.

Logic:

  • user can type name or set of names split by space
  • when search bar not empty, search button enables and changes visuals (i.e. change color)
  • current search text stored in state (this is already enabled)
  • search should occur when user clicks search or hits enter.

Search requirements:

  • needs event handler to trigger search when above actions are taken.
  • sends GET request to /users?search={string}
  • use state variable in same file as event handler to track isSearching, default is false, when search happens it should change to true. search should check this variable to ensure it is false before searching to avoid simultaneous searches.
  • while isSearching is set to true, search button should be disabled again to prevent more searches being sent.

Errors:

  • if error occurs, change isSearching to false.
  • error can be displayed using an alert or similar message.

On success:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions