mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
re-structure to monorepo.
This commit is contained in:
17
packages/webapp/src/components/FlexGrid/Flex.style.tsx
Normal file
17
packages/webapp/src/components/FlexGrid/Flex.style.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
// @ts-nocheck
|
||||
import styled from 'styled-components';
|
||||
import { FlexProps } from './interfaces';
|
||||
|
||||
export const FlexStyled = styled.div<FlexProps>`
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
align-items: ${({ align }) => align || 'center'};
|
||||
|
||||
&:after {
|
||||
content: '';
|
||||
max-width: ${({ col, gap = 1 }) =>
|
||||
col && col < 12 ? `${(100 * col) / 12 - gap}%` : '100%'};
|
||||
width: 100%;
|
||||
}
|
||||
`;
|
||||
27
packages/webapp/src/components/FlexGrid/Flex.tsx
Normal file
27
packages/webapp/src/components/FlexGrid/Flex.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
// @ts-nocheck
|
||||
import * as React from 'react';
|
||||
import { FlexProps } from './interfaces';
|
||||
import { FlexItem } from './FlexItem';
|
||||
import { FlexStyled } from './Flex.style';
|
||||
|
||||
export function Flex({
|
||||
children,
|
||||
col = 12,
|
||||
gap,
|
||||
align,
|
||||
className,
|
||||
style,
|
||||
}: FlexProps) {
|
||||
return (
|
||||
<FlexStyled
|
||||
col={col}
|
||||
gap={gap}
|
||||
align={align}
|
||||
className={className}
|
||||
style={style}
|
||||
>
|
||||
{children}
|
||||
<FlexItem col={col} gap={gap} />
|
||||
</FlexStyled>
|
||||
);
|
||||
}
|
||||
20
packages/webapp/src/components/FlexGrid/FlexItem.style.tsx
Normal file
20
packages/webapp/src/components/FlexGrid/FlexItem.style.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
// @ts-nocheck
|
||||
import styled from 'styled-components';
|
||||
import { ItemProps } from './interfaces';
|
||||
|
||||
export const FlexItem = styled.div<ItemProps>`
|
||||
width: 100%;
|
||||
max-width: ${({ col, gap = 1 }) =>
|
||||
col && col < 12 ? `${(100 * col) / 12 - gap}%` : '100%'};
|
||||
${({ marginBottom }) =>
|
||||
marginBottom &&
|
||||
`
|
||||
margin-bottom: ${marginBottom}px;
|
||||
`}
|
||||
${({ stretch }) =>
|
||||
stretch &&
|
||||
`
|
||||
display: flex;
|
||||
align-self: stretch;
|
||||
`}
|
||||
`;
|
||||
2
packages/webapp/src/components/FlexGrid/FlexItem.tsx
Normal file
2
packages/webapp/src/components/FlexGrid/FlexItem.tsx
Normal file
@@ -0,0 +1,2 @@
|
||||
// @ts-nocheck
|
||||
export * from './FlexItem.style';
|
||||
5
packages/webapp/src/components/FlexGrid/index.ts
Normal file
5
packages/webapp/src/components/FlexGrid/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// @ts-nocheck
|
||||
export * from './Flex.style';
|
||||
export * from './Flex';
|
||||
export * from './FlexItem.style';
|
||||
export * from './interfaces';
|
||||
23
packages/webapp/src/components/FlexGrid/interfaces.ts
Normal file
23
packages/webapp/src/components/FlexGrid/interfaces.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
// @ts-nocheck
|
||||
import { HTMLAttributes, Component, StyleHTMLAttributes } from 'react';
|
||||
|
||||
export type Range = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
||||
|
||||
export interface ItemProps extends HTMLAttributes<HTMLDivElement> {
|
||||
gap?: number;
|
||||
col: Range;
|
||||
marginBottom?: number;
|
||||
stretch?: boolean;
|
||||
as?: string | Component;
|
||||
className?: string;
|
||||
style?: StyleHTMLAttributes<HTMLDivElement>;
|
||||
}
|
||||
|
||||
export interface FlexProps extends HTMLAttributes<HTMLDivElement> {
|
||||
gap?: number;
|
||||
align?: 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch';
|
||||
col?: Range;
|
||||
className?: string;
|
||||
style?: StyleHTMLAttributes<HTMLDivElement>;
|
||||
as?: string | Component;
|
||||
}
|
||||
Reference in New Issue
Block a user