Fix aggregate bar (#11620)
Closes https://github.com/twentyhq/twenty/issues/10943 Also adds stories: <img width="1512" alt="image" src="https://github.com/user-attachments/assets/377059b1-f6b5-4d8c-b7d1-e74e70448445" />
This commit is contained in:
@ -12,6 +12,7 @@ const StyledContainer = styled.div`
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
min-height: 100px;
|
||||
`;
|
||||
|
||||
interface StyledImageProps {
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import styled from '@emotion/styled';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
const StyledLayout = styled.div<{
|
||||
width?: number;
|
||||
backgroundColor?: string | undefined;
|
||||
height: number | 'fit-content';
|
||||
}>`
|
||||
background: ${({ theme, backgroundColor }) =>
|
||||
backgroundColor ?? theme.background.primary};
|
||||
@ -12,7 +14,12 @@ const StyledLayout = styled.div<{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
height: fit-content;
|
||||
height: ${({ height }) =>
|
||||
height === 'fit-content'
|
||||
? 'fit-content'
|
||||
: `
|
||||
${height}px
|
||||
`};
|
||||
max-width: calc(100% - 40px);
|
||||
min-width: ${({ width }) => (width ? 'unset' : '300px')};
|
||||
padding: 20px;
|
||||
@ -22,15 +29,21 @@ const StyledLayout = styled.div<{
|
||||
type ComponentStorybookLayoutProps = {
|
||||
width?: number;
|
||||
backgroundColor?: string | undefined;
|
||||
height?: number;
|
||||
children: JSX.Element;
|
||||
};
|
||||
|
||||
export const ComponentStorybookLayout = ({
|
||||
width,
|
||||
backgroundColor,
|
||||
height,
|
||||
children,
|
||||
}: ComponentStorybookLayoutProps) => (
|
||||
<StyledLayout width={width} backgroundColor={backgroundColor}>
|
||||
<StyledLayout
|
||||
width={width}
|
||||
backgroundColor={backgroundColor}
|
||||
height={isDefined(height) ? height : 'fit-content'}
|
||||
>
|
||||
{children}
|
||||
</StyledLayout>
|
||||
);
|
||||
|
||||
@ -28,6 +28,7 @@ export const ComponentDecorator: Decorator = (Story, context) => {
|
||||
return (
|
||||
<ComponentStorybookLayout
|
||||
width={container?.width}
|
||||
height={container?.height}
|
||||
backgroundColor={backgroundColor}
|
||||
>
|
||||
<Story />
|
||||
|
||||
Reference in New Issue
Block a user