Skip to content

Commit

Permalink
feat: Design changes for test
Browse files Browse the repository at this point in the history
  • Loading branch information
Cerberupo committed Jan 18, 2024
1 parent a04fec5 commit 61d0d3b
Show file tree
Hide file tree
Showing 21 changed files with 539 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,28 @@ import {
ACTIVITY_ACCORDION_PROP_TYPES,
} from './ActivityAccordion.constants';

function AccordionLabel({ label, icon, rightSection, compact, classes }) {
function AccordionLabel({ label, title, icon, hideIcon, rightSection, compact, classes }) {
return (
<Stack fullWidth alignItems="center">
<Stack fullWidth justifyContent="start" alignItems="center" spacing={4}>
<Box className={classes.iconWrapper}>
{icon
? React.cloneElement(icon, {
width: compact ? 16 : 22,
height: compact ? 16 : 22,
className: classes.labelIcon,
})
: null}
</Box>
<Text size="md" strong color="primary" role="productive" className={classes.label}>
{label}
</Text>
{!hideIcon ? (
<Box className={classes.iconWrapper}>
{icon
? React.cloneElement(icon, {
width: compact ? 16 : 22,
height: compact ? 16 : 22,
className: classes.labelIcon,
})
: null}
</Box>
) : null}

{label ? (
<Text size="md" strong color="primary" role="productive" className={classes.label}>
{label}
</Text>
) : null}
{title || null}
</Stack>
<Box skipFlex>{rightSection || null}</Box>
</Stack>
Expand All @@ -35,6 +41,8 @@ function AccordionLabel({ label, icon, rightSection, compact, classes }) {
AccordionLabel.propTypes = {
label: PropTypes.string,
icon: PropTypes.node,
title: PropTypes.node,
hideIcon: PropTypes.bool,
rightSection: PropTypes.any,
compact: PropTypes.bool,
classes: PropTypes.any,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createStyles } from '@mantine/styles';
import { pxToRem, getPaddings, getFontExpressive, getFontProductive } from '../../theme.mixins';
import { pxToRem } from '../../theme.mixins';

const BORDER_RADIUS = 8;

Expand All @@ -21,7 +21,7 @@ export const ActivityAccordionStyles = createStyles((theme, { compact }) => {
border: 'none',
},
content: {
background: PANEL_COLORS.default,
// background: PANEL_COLORS.default,
borderBottomRightRadius: BORDER_RADIUS,
borderBottomLeftRadius: BORDER_RADIUS,
wordBreak: 'normal',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { CustomLegendStyles } from './CustomLegend.styles';
import { CUSTOM_LEGEND_DEFAULT_PROPS, CUSTOM_LEGEND_PROP_TYPES } from './CustomLegend.constants';
import { CheckIcon, RemoveBoldIcon } from '@bubbles-ui/icons/solid';
import { CheckBoldIcon, RemoveBoldIcon, SlashIcon } from '@bubbles-ui/icons/solid';

const CustomLegend = ({ id }) => {
const { classes, cx } = CustomLegendStyles({}, { name: 'CustomLegend' });
Expand All @@ -11,28 +11,13 @@ const CustomLegend = ({ id }) => {

const getLegendIcon = () => {
if (isOK)
return <CheckIcon x={4} y={4} height={12} width={12} className={classes.legendIcon} />;
return <CheckBoldIcon x={4} y={4} height={12} width={12} className={classes.legendIconOK} />;
if (isKO)
return <RemoveBoldIcon x={4} y={4} height={12} width={12} className={classes.legendIcon} />;
return (
<text x={7.5} y={15.5} className={classes.legendSlash}>
/
</text>
);
return <RemoveBoldIcon x={4} y={4} height={12} width={12} className={classes.legendIconKO} />;
return <SlashIcon x={4} y={4} height={10} width={10} className={classes.legendIconSlash} />;
};

const getLegendFill = () => {
if (isOK) return '#4BA773';
if (isKO) return '#C9516C';
return '#8E97A3';
};

return (
<g>
<rect fill={getLegendFill()} height={20} width={20} rx="2" ry="2"></rect>
{getLegendIcon()}
</g>
);
return <g>{getLegendIcon()}</g>;
};

CustomLegend.defaultProps = CUSTOM_LEGEND_DEFAULT_PROPS;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createStyles } from '@mantine/styles';
import { pxToRem, getPaddings, getFontExpressive, getFontProductive } from '../../../theme.mixins';

export const CustomLegendStyles = createStyles((theme, {}) => {
return {
root: {},
legendIcon: { color: theme.colors.mainWhite },
legendSlash: { fill: theme.colors.mainWhite, fontWeight: 600, fontSize: pxToRem(17) },
legendIconOK: { color: '#5CBC6A' },
legendIconKO: { color: '#D13B3B' },
legendIconSlash: { color: '#4D5358' },
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ const TotalLayoutFooterContainer = ({
rightZone,
children,
fullWidth,
showFooterBorder: _showFooterBorder,
}) => {
const [showFooterBorder, setShowFooterBorder] = React.useState(false);
const { classes } = TotalLayoutFooterContainerStyles(
{ showFooterBorder, leftOffset, fixed, fullWidth },
{ showFooterBorder: showFooterBorder || _showFooterBorder, leftOffset, fixed, fullWidth },
{ name: 'TotalLayoutFooterContainer' },
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@ import { Title } from '../../../typography';
import { Stack } from '../../Stack';
import { Box } from '../../Box';
import {
TOTAL_LAYOUT_STEP_CONTAINER_PROP_TYPES,
TOTAL_LAYOUT_STEP_CONTAINER_DEFAULT_PROPS,
TOTAL_LAYOUT_STEP_CONTAINER_PROP_TYPES,
} from './TotalLayoutStepContainer.constants';
import { TotalLayoutStepContainerStyles } from './TotalLayoutStepContainer.styles';

const TotalLayoutStepContainer = ({ stepName, fullWidth, noMargin, children, Footer, clean }) => {
const TotalLayoutStepContainer = ({
stepName,
fullWidth,
noMargin,
children,
footerPadding,
Footer,
clean,
}) => {
const { classes } = TotalLayoutStepContainerStyles(
{ hasFooter: !!Footer, clean, fullWidth, noMargin },
{ hasFooter: !!Footer, clean, fullWidth, noMargin, footerPadding },
{ name: 'TotalLayoutStepContainer' },
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createStyles } from '@mantine/styles';

const TotalLayoutStepContainerStyles = createStyles(
(theme, { hasFooter, clean, fullWidth, noMargin }) => ({
(theme, { hasFooter, clean, fullWidth, noMargin, footerPadding }) => ({
root: {},
stepContainer: {
padding: '30px 0 0 0 ',
Expand All @@ -16,7 +16,7 @@ const TotalLayoutStepContainerStyles = createStyles(
formContainer: {
backgroundColor: !clean && 'white',
padding: !clean && 24,
paddingBottom: hasFooter ? 70 : 24,
paddingBottom: footerPadding || hasFooter ? 70 : 24,
},
stepName: {
marginBottom: 12,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import PropTypes from 'prop-types';

export const VERTICAL_CONTAINER_DEFAULT_PROPS = {
disableContentPadding: false,
navWidth: 276,
stickyAt: 0,
legible: true,
};
export const VERTICAL_CONTAINER_PROP_TYPES = {
padding: PropTypes.number,
disableContentPadding: PropTypes.bool,
navWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
stickyAt: PropTypes.number,
legible: PropTypes.bool,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React, { forwardRef } from 'react';
import { VerticalContainerStyles } from './VerticalContainer.styles';
import { Box } from '../Box';
import { Stack } from '../Stack';
import {
VERTICAL_CONTAINER_DEFAULT_PROPS,
VERTICAL_CONTAINER_PROP_TYPES,
} from './VerticalContainer.constants';

const VerticalContainer = forwardRef(({ children, scrollRef, leftZone, ...props }, ref) => {
const { classes } = VerticalContainerStyles({ name: 'VerticalStepperContainer' });

return (
<Box ref={ref} className={classes.root}>
<Stack
ref={scrollRef}
justifyContent="center"
fullWidth
fullHeight
style={{
backgroundColor: '#f8f9fb',
overflow: 'auto',
position: 'relative',
}}
>
<Box className={classes.stepper}>{leftZone}</Box>
<Box className={classes.content}>{children}</Box>
</Stack>
</Box>
);
});

VerticalContainer.displayName = 'VerticalContainer';
VerticalContainer.defaultProps = VERTICAL_CONTAINER_DEFAULT_PROPS;
VerticalContainer.propTypes = VERTICAL_CONTAINER_PROP_TYPES;

export { VerticalContainer };
165 changes: 165 additions & 0 deletions packages/components/src/layout/VerticalContainer/VerticalContainer.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
import { Preview, Props, Story } from '@storybook/addon-docs';
import { VerticalContainer } from './VerticalContainer.js';
import { ThemeProvider } from './../../ThemeProvider';
import { Box, ContextContainer } from '../../layout';
import { Paragraph } from '../../typography';

# VerticalStepperContainer

[Source code](https://github.com/leemonade/bubbles/tree/main/packages/components/src/layout/VerticalStepperContainer/VerticalStepperContainer.js)

## Table of Contents

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Overview](#overview)
- [VerticalStepper width](#verticalstepper-width)
- [Content padding](#content-padding)
- [VerticalStepper sticky at](#verticalstepper-sticky-at)
- [Component API](#component-api)
- [References](#references)
- [Feedback](#feedback)

## Overview

VerticalStepperContainer is component to render a VerticalStepper including the steps.

<ThemeProvider>
<VerticalContainer
data={[
{
label: 'Resumen',
badge: 'Badge',
status: 'OK',
},
{
label: 'Pruebas',
onClick: () => {
},
},
]}
></VerticalContainer>
</ThemeProvider>

## VerticalStepper width

You can control the width of the VerticalStepper with the ``navWidth` prop.

<ThemeProvider>
<VerticalContainer
navWidth={400}
data={[
{
label: 'Resumen',
badge: 'Badge',
status: 'OK',
},
{
label: 'Pruebas',
onClick: () => {
},
},
]}
></VerticalContainer>
<VerticalContainer
navWidth={800}
data={[
{
label: 'Resumen',
badge: 'Badge',
status: 'OK',
},
{
label: 'Pruebas',
onClick: () => {
},
},
]}
></VerticalContainer>
</ThemeProvider>

## Content padding

With the boolean props `disableContentPadding`, control if you want padding for the content or not

<ThemeProvider>
<VerticalContainer
disableContentPadding
data={[
{
label: 'Resumen',
badge: 'Badge',
status: 'OK',
},
{
label: 'Pruebas',
},
]}
>
<ContextContainer title="Step 1">
<Box>
<Paragraph>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
est laborum
</Paragraph>
</Box>
</ContextContainer>
</VerticalContainer>
</ThemeProvider>

## VerticalStepper sticky at

With the `stickyAt` prop, control the position in pixels from the top at which the VerticalStepper becomes sticky.

<ThemeProvider>
<VerticalContainer
stickyAt={50}
data={[
{
label: 'Resumen',
badge: 'Badge',
status: 'OK',
},
{
label: 'Pruebas',
},
]}
>
<ContextContainer title="Step 1">
<Box>
<Paragraph>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
est laborum
</Paragraph>
</Box>
</ContextContainer>
</VerticalContainer>
</ThemeProvider>

## Component API

<Preview>
<Story id="atoms-layout-verticalsteppercontainer--playground" />
</Preview>

<Props of={VerticalContainer} />

## References

[MDN: ARIA navigation role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/navigation_role)

[W3: Role attribute](https://www.w3.org/WAI/PF/HTML/wiki/RoleAttribute)

## Feedback

Help us improve this component by providing feedback, asking questions on Slack, or updating this file on
[GitHub](https://github.com/leemonade/bubbles/edit/main/packages/components/src/layout/VerticalStepperContainer/VerticalStepperContainer.mdx)
Loading

0 comments on commit 61d0d3b

Please sign in to comment.