/*!
=========================================================
* Argon Dashboard React - v1.2.4
=========================================================
* Product Page: https://www.creative-tim.com/product/argon-dashboard-react
* Copyright 2024 Creative Tim (https://www.creative-tim.com)
* Licensed under MIT (https://github.com/creativetimofficial/argon-dashboard-react/blob/master/LICENSE.md)
* Coded by Creative Tim
=========================================================
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/
/*eslint-disable*/
import { useState } from "react";
import { NavLink as NavLinkRRD, Link } from "react-router-dom";
// nodejs library to set properties for components
import { PropTypes } from "prop-types";
// reactstrap components
import {
Button,
Card,
CardHeader,
CardBody,
CardTitle,
Collapse,
DropdownMenu,
DropdownItem,
UncontrolledDropdown,
DropdownToggle,
FormGroup,
Form,
Input,
InputGroupAddon,
InputGroupText,
InputGroup,
Media,
NavbarBrand,
Navbar,
NavItem,
NavLink,
Nav,
Progress,
Table,
Container,
Row,
Col,
} from "reactstrap";
var ps;
const Sidebar = (props) => {
const [collapseOpen, setCollapseOpen] = useState();
// verifies if routeName is the one active (in browser input)
const activeRoute = (routeName) => {
return props.location.pathname.indexOf(routeName) > -1 ? "active" : "";
};
// toggles collapse between opened and closed (true/false)
const toggleCollapse = () => {
setCollapseOpen((data) => !data);
};
// closes the collapse
const closeCollapse = () => {
setCollapseOpen(false);
};
// creates the links that appear in the left menu / Sidebar
const createLinks = (routes) => {
return routes.map((prop, key) => {
return (
{prop.name}
);
});
};
const { bgColor, routes, logo } = props;
let navbarBrandProps;
if (logo && logo.innerLink) {
navbarBrandProps = {
to: logo.innerLink,
tag: Link,
};
} else if (logo && logo.outterLink) {
navbarBrandProps = {
href: logo.outterLink,
target: "_blank",
};
}
return (
{/* Toggler */}
{/* Brand */}
{logo ? (
) : null}
{/* User */}
Action
Another action
Something else here
Welcome!
My profile
Settings
Activity
Support
e.preventDefault()}>
Logout
{/* Collapse */}
{/* Collapse header */}
{logo ? (
{logo.innerLink ? (
) : (
)}
) : null}
{/* Form */}
{/* Navigation */}
{createLinks(routes)}
{/* Divider */}
{/* Heading */}
Documentation
{/* Navigation */}
Getting started
Foundation
Components
Upgrade to PRO
);
};
Sidebar.defaultProps = {
routes: [{}],
};
Sidebar.propTypes = {
// links that will be displayed inside the component
routes: PropTypes.arrayOf(PropTypes.object),
logo: PropTypes.shape({
// innerLink is for links that will direct the user within the app
// it will be rendered as ... tag
innerLink: PropTypes.string,
// outterLink is for links that will direct the user outside the app
// it will be rendered as simple ... tag
outterLink: PropTypes.string,
// the image src of the logo
imgSrc: PropTypes.string.isRequired,
// the alt for the img
imgAlt: PropTypes.string.isRequired,
}),
};
export default Sidebar;