Skip to content

Navbar ​

Header Component ​

The Header component is a reusable component that provides a navigation bar with search functionality and displays offline device counts.

File Path ​

The Header component is located at the following path:
iot-frontend/src/components/Header.tsx

Props ​

The Header component accepts the following props:

PropTypeDescription
fetchDataAndUpdate?() => Promise<void>Function to fetch data and update the component.
searchByClientName?stringCurrent value of the client name search input.
setSearchByClientName?(value: string) => voidFunction to update the client name search input value.
searchByDeviceKey?stringCurrent value of the device key search input.
setSearchByDeviceKey?(value: string) => voidFunction to update the device key search input value.
totalDevicesOfflineCount?numberTotal count of offline devices.
clientsOfflineCount?numberCount of offline clients.

Usage ​

To use the Header component, import it into your React component and pass the required props:

jsx
import Header from '@/components/Header';

const MyComponent = () => {
  // ...

  return (
    <div className="w-full flex flex-col">
      <Header
        fetchDataAndUpdate={fetchDataAndUpdate}
        searchByClientName={searchByClientName}
        setSearchByClientName={setSearchByClientName}
        searchByDeviceKey={searchByDeviceKey}
        setSearchByDeviceKey={setSearchByDeviceKey}
        totalDevicesOfflineCount={totalDevicesOfflineCount}
        clientsOfflineCount={clientsOfflineCount}
      />
      {/* Other components */}
    </div>
  );
};

Released under the MIT License.