feat(frontend): fixed height for create service modal

pull/85/head
Samuel Rowe 3 years ago
parent 7261903ece
commit 4859d14422

@ -11,6 +11,7 @@ import {
getInitialValues, getInitialValues,
validationSchema validationSchema
} from "./form-utils"; } from "./form-utils";
import { styled } from "@mui/joy";
interface IModalServiceProps { interface IModalServiceProps {
onHide: CallbackFunction; onHide: CallbackFunction;
@ -44,6 +45,38 @@ const tabs = [
} }
]; ];
const FormContainer = styled("div")`
width: 640px;
height: 800px;
display: flex;
flex-direction: column;
justify-content: space-between;
`;
const TabBody = styled("div")`
overflow: auto;
height: 700px;
::-webkit-scrollbar {
width: 4px;
}
/* Track */
::-webkit-scrollbar-track {
background: #f1f1f1;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #888;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: #555;
}
`;
const ModalServiceCreate = (props: IModalServiceProps) => { const ModalServiceCreate = (props: IModalServiceProps) => {
const { onHide, onAddEndpoint } = props; const { onHide, onAddEndpoint } = props;
const [openTab, setOpenTab] = useState("General"); const [openTab, setOpenTab] = useState("General");
@ -87,40 +120,42 @@ const ModalServiceCreate = (props: IModalServiceProps) => {
validationSchema={validationSchema} validationSchema={validationSchema}
> >
{(formik) => ( {(formik) => (
<> <FormContainer>
<div className="border-b border-gray-200 px-4 md:px-8"> <div>
<nav <div className="border-b border-gray-200 px-4 md:px-8">
className="-mb-px flex space-x-4 md:space-x-8" <nav
aria-label="Tabs" className="-mb-px flex space-x-4 md:space-x-8"
> aria-label="Tabs"
{tabs.map((tab) => ( >
<a {tabs.map((tab) => (
key={tab.name} <a
href={tab.href} key={tab.name}
className={classNames( href={tab.href}
tab.name === openTab className={classNames(
? "border-indigo-500 text-indigo-600" tab.name === openTab
: "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300", ? "border-indigo-500 text-indigo-600"
"whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm", : "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300",
tab.hidden ? "hidden" : "" "whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm",
)} tab.hidden ? "hidden" : ""
aria-current={tab.current ? "page" : undefined} )}
onClick={(e) => { aria-current={tab.current ? "page" : undefined}
e.preventDefault(); onClick={(e) => {
setOpenTab(tab.name); e.preventDefault();
}} setOpenTab(tab.name);
> }}
{tab.name} >
</a> {tab.name}
))} </a>
</nav> ))}
</div> </nav>
</div>
<div className="relative px-4 py-3 flex-auto"> <TabBody className="relative px-4 py-3 flex-auto">
{openTab === "General" && <General />} {openTab === "General" && <General />}
{openTab === "Environment" && <Environment />} {openTab === "Environment" && <Environment />}
{openTab === "Volumes" && <Volumes />} {openTab === "Volumes" && <Volumes />}
{openTab === "Labels" && <Labels />} {openTab === "Labels" && <Labels />}
</TabBody>
</div> </div>
<div className="flex items-center justify-end px-4 py-3 border-t border-solid border-blueGray-200 rounded-b"> <div className="flex items-center justify-end px-4 py-3 border-t border-solid border-blueGray-200 rounded-b">
@ -132,7 +167,7 @@ const ModalServiceCreate = (props: IModalServiceProps) => {
Add Add
</button> </button>
</div> </div>
</> </FormContainer>
)} )}
</Formik> </Formik>
</div> </div>

Loading…
Cancel
Save