/*
* QQQ - Low-code Application Framework for Engineers.
* Copyright (C) 2021-2022. Kingsrook, LLC
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
* contact@kingsrook.com
* https://github.com/Kingsrook/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
import Box from "@mui/material/Box";
import Icon from "@mui/material/Icon";
import React from "react";
import {Link} from "react-router-dom";
import MDButton from "qqq/components/legacy/MDButton";
// eslint-disable import/prefer-default-export
export const standardWidth = "150px";
interface QCreateNewButtonProps
{
tablePath: string;
}
export function QCreateNewButton({tablePath}: QCreateNewButtonProps): JSX.Element
{
return (
add}>
Create New
);
}
interface QSaveButtonProps
{
label?: string;
iconName?: string;
onClickHandler?: any,
disabled: boolean
}
QSaveButton.defaultProps = {
label: "Save",
iconName: "save"
};
export function QSaveButton({label, iconName, onClickHandler, disabled}: QSaveButtonProps): JSX.Element
{
return (
{iconName}} disabled={disabled}>
{label}
);
}
interface QDeleteButtonProps
{
onClickHandler: any
}
export function QDeleteButton({onClickHandler}: QDeleteButtonProps): JSX.Element
{
return (
delete}>
Delete
);
}
export function QEditButton(): JSX.Element
{
return (
edit}>
Edit
);
}
interface QActionsMenuButtonProps
{
isOpen: boolean;
onClickHandler: any;
}
export function QActionsMenuButton({isOpen, onClickHandler}: QActionsMenuButtonProps): JSX.Element
{
return (
games}
fullWidth
>
actions
keyboard_arrow_down
);
}
export function QSavedViewsMenuButton({isOpen, onClickHandler}: QActionsMenuButtonProps): JSX.Element
{
return (
visibility}
>
Saved Views
keyboard_arrow_down
);
}
interface QCancelButtonProps
{
onClickHandler: any;
disabled: boolean;
label?: string;
iconName?: string
}
export function QCancelButton({
onClickHandler, disabled, label, iconName,
}: QCancelButtonProps): JSX.Element
{
return (
{iconName}} onClick={onClickHandler} disabled={disabled}>
{label}
);
}
QCancelButton.defaultProps = {
label: "cancel",
iconName: "cancel",
};
interface QSubmitButtonProps
{
label?: string
iconName?: string
disabled: boolean
}
export function QSubmitButton({label, iconName, disabled}: QSubmitButtonProps): JSX.Element
{
return (
{iconName}} disabled={disabled}>
{label}
);
}
QSubmitButton.defaultProps = {
label: "Submit",
iconName: "check",
};