import "../../css/components/conversation/title.css"; import React from "react"; import { Box, IconButton, Tooltip, Typography } from "@mui/material"; import { ArrowBack as ArrowBackIcon } from "@mui/icons-material"; import { Link } from "react-router-dom"; import { useBack, useIsSmallScreen } from "../ContextProvider"; /** * It's a component that renders the title of the thread. * @param {number} props.category The category of the thread * @param {string} props.title The title of of the thread * @param {string} props.slink The shortened link of the thread */ export default function Title(props: { /** thread category id */ category: number | undefined; /** thread title */ title: string | undefined; /** buttons */ btns: { icon: JSX.Element; action: () => void; title: string }[]; }) { const { category, title, btns } = props; const [history] = useBack(); const isSmallScreen = useIsSmallScreen(); return (
{(history || category) && ( )} {title}
{!isSmallScreen && btns.map((btn, index) => ( {btn.icon} ))}
); }