fix: Invoice form layout

This commit is contained in:
Ahmed Bouhuolia
2024-10-12 20:49:56 +02:00
parent 817ef906dc
commit b7b86bb0c5
38 changed files with 1582 additions and 940 deletions

View File

@@ -1,4 +1,5 @@
// @ts-nocheck
import { defaultTheme, ThemeProvider } from '@xstyled/emotion';
import { lazy, Suspense } from 'react';
import { Router, Switch, Route } from 'react-router';
import { createBrowserHistory } from 'history';
@@ -35,6 +36,13 @@ const OneClickDemoPage = lazy(
const PaymentPortalPage = lazy(
() => import('@/containers/PaymentPortal/PaymentPortalPage'),
);
const theme = {
...defaultTheme,
// Customize your theme here
}
/**
* App inner.
*/
@@ -42,30 +50,38 @@ function AppInsider({ history }) {
return (
<div className="App">
<DashboardThemeProvider>
<Suspense fallback={'Loading...'}>
<Router history={history}>
<Switch>
<Route path={'/one_click_demo'} children={<OneClickDemoPage />} />
<Route path={'/auth/register/verify'}>
<EnsureAuthenticated>
<EnsureUserEmailNotVerified>
<RegisterVerify />
</EnsureUserEmailNotVerified>
</EnsureAuthenticated>
</Route>
<ThemeProvider theme={theme}>
<Suspense fallback={'Loading...'}>
<Router history={history}>
<Switch>
<Route
path={'/one_click_demo'}
children={<OneClickDemoPage />}
/>
<Route path={'/auth/register/verify'}>
<EnsureAuthenticated>
<EnsureUserEmailNotVerified>
<RegisterVerify />
</EnsureUserEmailNotVerified>
</EnsureAuthenticated>
</Route>
<Route
path={'/auth/email_confirmation'}
children={<EmailConfirmation />}
/>
<Route path={'/auth'} children={<AuthenticationPage />} />
<Route path={'/payment/:linkId'} children={<PaymentPortalPage />} />
<Route path={'/'} children={<DashboardPrivatePages />} />
</Switch>
</Router>
</Suspense>
<Route
path={'/auth/email_confirmation'}
children={<EmailConfirmation />}
/>
<Route path={'/auth'} children={<AuthenticationPage />} />
<Route
path={'/payment/:linkId'}
children={<PaymentPortalPage />}
/>
<Route path={'/'} children={<DashboardPrivatePages />} />
</Switch>
</Router>
</Suspense>
<GlobalErrors />
<GlobalErrors />
</ThemeProvider>
</DashboardThemeProvider>
</div>
);

View File

@@ -2,6 +2,7 @@
import React from 'react';
import classnames from 'classnames';
import { LoadingIndicator } from '../Indicator';
import { css } from '@emotion/css';
export function DashboardInsider({
loading,
@@ -9,6 +10,7 @@ export function DashboardInsider({
name,
mount = false,
className,
style
}) {
return (
<div
@@ -17,9 +19,11 @@ export function DashboardInsider({
dashboard__insider: true,
'dashboard__insider--loading': loading,
[`dashboard__insider--${name}`]: !!name,
},
className,
)}
style={style}
>
<LoadingIndicator loading={loading} mount={mount}>
{children}

View File

@@ -0,0 +1,90 @@
import React, { FC } from 'react';
import clsx from 'classnames';
import { x, SystemProps } from '@xstyled/emotion';
import { css } from '@emotion/css';
import { Group, GroupProps } from '@/components';
interface PageFormProps extends SystemProps {
children: React.ReactNode;
}
/**
*
* @returns {React.ReactNode}
*/
export const PageForm = ({ children, ...props }: PageFormProps) => {
return (
<x.div display="flex" flexDirection={'column'} overflow="hidden" {...props}>
{children}
</x.div>
);
};
PageForm.displayName = 'PageFormBody';
/**
*
* @returns {React.ReactNode}
*/
const PageFormBody: FC<{ children: React.ReactNode } & SystemProps> = ({
children,
}) => {
return (
<x.div flex="1" overflow="auto">
{children}{' '}
</x.div>
);
};
PageFormBody.displayName = 'PageFormBody';
/**
*
* @returns {React.ReactNode}
*/
const PageFormFooter: FC<{ children: React.ReactNode } & SystemProps> = ({ children }) => {
return <x.div>{children} </x.div>;
};
PageFormFooter.displayName = 'PageFormFooter';
const footerActionsStyle = `
width: 100%;
background: #fff;
padding: 14px 18px;
border-top: 1px solid rgb(210, 221, 226);
box-shadow: 0px -1px 4px 0px rgba(0, 0, 0, 0.05);
.bp4-button-group{
.bp4-button{
&:not(:last-child),
&.bp4-popover-wrapper:not(:last-child) {
border-right: 1px solid rgba(92, 112, 127, 0.3);
margin-right: 0;
&.bp4-intent-primary{
border-right: 1px solid rgba(255, 255, 255, 0.3);
}
}
}
}
`;
const PageFormFooterActions: FC<GroupProps> = ({
children,
className,
...restProps
}) => {
return (
<Group
spacing={20}
{...restProps}
className={clsx(css(footerActionsStyle), className)}
>
{children}
</Group>
);
};
PageFormFooterActions.displayName = 'PageFormFooterActions';
PageForm.Body = PageFormBody;
PageForm.Footer = PageFormFooter;
PageForm.FooterActions = PageFormFooterActions;

View File

@@ -2,3 +2,4 @@
export * from './FormTopbar';
export * from './FormTopbarSelectInputs';
export * from './PageFormBigNumber';
export * from './PageForm';

View File

@@ -1,13 +1,20 @@
// @ts-nocheck
import React from 'react';
import styled from 'styled-components';
import { x, SystemProps } from '@xstyled/emotion';
export function Paper({ children, className }) {
return <PaperRoot className={className}>{children}</PaperRoot>;
interface PaperProps extends SystemProps {
children: React.ReactNode;
}
const PaperRoot = styled.div`
border: 1px solid #d2dce2;
background: #fff;
padding: 10px;
`;
export const Paper = ({ children, ...props }: PaperProps) => {
return (
<x.div
background={'white'}
p={'10px'}
border={'1px solid #d2dce2'}
{...props}
>
{children}
</x.div>
);
};
Paper.displayName = 'Paper';