import React, { useState } from 'react'; import '../css/Buttons.css'; import { ArrowUpShort, ArrowDownShort } from 'react-bootstrap-icons'; /** * Buttons - set of button components that are reusable throughout the app. */ export const ToggleButton = ({ defVal=true, icons=[, ], text="", clickAction=()=>{} }) => { /** * ToggleButton - A button component for making a toggle button * defVal: default value, true/false * icons: array of two jsx values that are displayed depending on value * text: text next to toggle button * clickAction: function that will run when clicked. value is passed to this function. */ const [value, setValue] = useState(defVal); return (
{setValue(!value); clickAction(value);}} >
{icons[0]}
{icons[1]}
{text}
); }; export const Button = ({children, onClick=()=>{}, href=null, className=""}) => { if (href === null) { return ( ); } else { return ( {children} ); } }