File size: 807 Bytes
e9b63e6
e4526cf
e9b63e6
 
 
 
951c0af
a56bf2f
870454a
8e65602
e9b63e6
 
 
 
3637bbd
e9b63e6
a155b02
8fba2a6
 
e9b63e6
951c0af
8e65602
951c0af
870454a
951c0af
a56bf2f
 
 
e9b63e6
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { useNavigate } from "react-router-dom";
import React from "react";
import styles from "./SideBarChatButton.module.css";
import Text from "../../Text/Text";

interface ChatButtonProps {
  title: string;
  isActive: boolean;
  chatId: string;
  className?: string;
}

function SideBarChatButton(props: Readonly<ChatButtonProps>) {
  const navigate = useNavigate();

  const handleClick = () => {
    navigate(`/chats/${props.chatId}`);
  };

  return (
    <button
      className={`${styles.chatButton} ${props.isActive ? styles.active : styles.inactive} ${props.className}`}
      onClick={handleClick}
      disabled={props.isActive}
    >
      <Text colorVariant={props.isActive ? "button" : "primary"}>
        {props.title}
      </Text>
    </button>
  );
}

export default SideBarChatButton;