2022-12-09 14:43:47 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import { useSelector } from "react-redux";
|
|
|
|
|
|
2024-08-06 14:52:22 +00:00
|
|
|
import { getTenantConfig } from "ee/selectors/tenantSelectors";
|
|
|
|
|
import { getAssetUrl } from "ee/utils/airgapHelpers";
|
2024-04-17 16:16:44 +00:00
|
|
|
import LeftSideContent from "./LeftSideContent";
|
2024-08-06 14:52:22 +00:00
|
|
|
import { getAppsmithConfigs } from "ee/configs";
|
2024-04-17 16:16:44 +00:00
|
|
|
import { useIsMobileDevice } from "utils/hooks/useDeviceDetect";
|
|
|
|
|
import styled from "styled-components";
|
2022-12-09 14:43:47 +00:00
|
|
|
|
2023-10-11 07:35:24 +00:00
|
|
|
interface ContainerProps {
|
2022-12-09 14:43:47 +00:00
|
|
|
title: string;
|
|
|
|
|
subtitle?: React.ReactNode;
|
|
|
|
|
children: React.ReactNode;
|
|
|
|
|
footer?: React.ReactNode;
|
|
|
|
|
disabledLoginForm?: boolean;
|
2023-08-26 04:22:23 +00:00
|
|
|
testId?: string;
|
2023-10-11 07:35:24 +00:00
|
|
|
}
|
2022-12-09 14:43:47 +00:00
|
|
|
|
2024-04-17 16:16:44 +00:00
|
|
|
const ContainerWrapper = styled.div`
|
|
|
|
|
a {
|
|
|
|
|
span {
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const BoxWrapper = styled.div<{ isMobileView: boolean }>`
|
|
|
|
|
box-shadow: 0px 1px 20px 0px rgba(76, 86, 100, 0.11);
|
|
|
|
|
border-radius: var(--ads-v2-border-radius);
|
|
|
|
|
background: var(--ads-v2-color-bg);
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: var(--ads-v2-spaces-5);
|
|
|
|
|
padding: 32px 24px;
|
|
|
|
|
|
|
|
|
|
${({ isMobileView }) =>
|
|
|
|
|
isMobileView ? "border: 1px solid var(--ads-v2-color-border);" : ""}
|
|
|
|
|
`;
|
|
|
|
|
|
2022-12-09 14:43:47 +00:00
|
|
|
function Container(props: ContainerProps) {
|
2023-08-26 04:22:23 +00:00
|
|
|
const { children, footer, subtitle, testId, title } = props;
|
2022-12-09 14:43:47 +00:00
|
|
|
const tenantConfig = useSelector(getTenantConfig);
|
2024-04-17 16:16:44 +00:00
|
|
|
const { cloudHosting } = getAppsmithConfigs();
|
|
|
|
|
const isMobileDevice = useIsMobileDevice();
|
2022-12-09 14:43:47 +00:00
|
|
|
|
|
|
|
|
return (
|
2024-04-17 16:16:44 +00:00
|
|
|
<ContainerWrapper
|
|
|
|
|
className={`gap-14 my-auto flex items-center justify-center min-w-min`}
|
2023-08-26 04:22:23 +00:00
|
|
|
data-testid={testId}
|
|
|
|
|
>
|
2024-04-17 16:16:44 +00:00
|
|
|
{cloudHosting && !isMobileDevice && <LeftSideContent />}
|
|
|
|
|
<BoxWrapper
|
|
|
|
|
className={`t--login-container ${
|
|
|
|
|
isMobileDevice ? "w-full" : "w-[min(400px,80%)]"
|
|
|
|
|
}`}
|
|
|
|
|
isMobileView={isMobileDevice}
|
|
|
|
|
>
|
|
|
|
|
{!isMobileDevice && (
|
|
|
|
|
<img
|
|
|
|
|
className="h-8 mx-auto"
|
|
|
|
|
src={getAssetUrl(tenantConfig.brandLogoUrl)}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
<div className={`flex flex-col gap-4`}>
|
|
|
|
|
<div className="flex flex-col gap-2 text-center">
|
|
|
|
|
<h1 className="text-lg font-semibold text-center text-[color:var(--ads-v2\-color-fg-emphasis)]">
|
|
|
|
|
{title}
|
|
|
|
|
</h1>
|
|
|
|
|
{subtitle && (
|
|
|
|
|
<p className="text-[14px] text-center text-[color:var(--ads-v2\-color-fg)]">
|
|
|
|
|
{subtitle}
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
{children}
|
|
|
|
|
{footer}
|
2022-12-09 14:43:47 +00:00
|
|
|
</div>
|
2024-04-17 16:16:44 +00:00
|
|
|
</BoxWrapper>
|
|
|
|
|
</ContainerWrapper>
|
2022-12-09 14:43:47 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Container;
|