import React from "react";
import Anchor from "../Anchor";
import "./AdminSidebarLink.scss";

export interface AdminSidebarLinkProps {
  to: string;
  path: string;
  id?: string;
}
export interface AdminSidebarLinkState { }

class AdminSidebarLink extends React.Component<AdminSidebarLinkProps, AdminSidebarLinkState> {
  render() {
    const { to, path, children, id } = this.props;
    const activeClass = to === path ? "active" : "";

    return (
      <Anchor id={id} to={to} className={`admin-sidebar-link ${activeClass}`}>
        {children}
      </Anchor>
    );
  }
}

export default AdminSidebarLink;
