Skip to content

Commit

Permalink
feat(TotalLayout): StepContainer with Fullwidth
Browse files Browse the repository at this point in the history
fix(VerticalStepper): Current state instead of Completed when item is active
  • Loading branch information
johan-fx committed Jan 15, 2024
1 parent 76efcb6 commit b27a3ea
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ const TotalLayoutFooterContainer = ({
leftZone,
rightZone,
children,
fullWidth,
}) => {
const [showFooterBorder, setShowFooterBorder] = React.useState(false);
const { classes } = TotalLayoutFooterContainerStyles(
{ showFooterBorder, leftOffset, fixed },
{ showFooterBorder, leftOffset, fixed, fullWidth },
{ name: 'TotalLayoutFooterContainer' },
);

Expand Down Expand Up @@ -72,6 +73,7 @@ TotalLayoutFooterContainer.propTypes = {
rightZone: PropTypes.node,
children: PropTypes.node,
fixed: PropTypes.bool,
fullWidth: PropTypes.bool,
};

export { TotalLayoutFooterContainer };
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createStyles } from '@mantine/styles';

const TotalLayoutFooterContainerStyles = createStyles(
(theme, { showFooterBorder, leftOffset, fixed }) => ({
(theme, { showFooterBorder, leftOffset, fullWidth, fixed }) => ({
root: {},
footer: {
width: 928,
width: fullWidth ? '100%' : 928,
marginLeft: leftOffset,
backgroundColor: 'white',
borderTop: showFooterBorder && `1px solid ${theme.other.divider.background.color.default}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const TOTAL_LAYOUT_STEP_CONTAINER_PROP_TYPES = {
Footer: PropTypes.node,
style: PropTypes.object,
clean: PropTypes.bool,
fullWidth: PropTypes.bool,
};
export const TOTAL_LAYOUT_STEP_CONTAINER_DEFAULT_PROPS = {
stepName: '',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Text, Title } from '../../../typography';
import { Title } from '../../../typography';
import { Stack } from '../../Stack';
import { Box } from '../../Box';
import {
Expand All @@ -8,9 +8,9 @@ import {
} from './TotalLayoutStepContainer.constants';
import { TotalLayoutStepContainerStyles } from './TotalLayoutStepContainer.styles';

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

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

const TotalLayoutStepContainerStyles = createStyles((theme, { hasFooter, clean }) => ({
const TotalLayoutStepContainerStyles = createStyles((theme, { hasFooter, clean, fullWidth }) => ({
root: {},
stepContainer: {
padding: '30px 0 0 0 ',
width: 928,
width: fullWidth ? '100%' : 928,
marginLeft: fullWidth ? theme.spacing[5] : 0,
marginRight: fullWidth ? theme.spacing[5] : 0,
height: '100%',
'@media (min-width: 1920px)': {
maxWidth: 1200,
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/navigation/Tabs/Tabs.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ const WithTotalLayoutTemplate = ({ ...props }) => {
<TotalLayoutStepContainer
style={{ backgroundColor: 'transparent', padding: 0, margin: 0 }}
stepName="Actividades en Curso"
fullWidth
>
<Tabs
{...props}
Expand All @@ -178,6 +179,7 @@ const WithTotalLayoutTemplate = ({ ...props }) => {
))}
<TotalLayoutFooterContainer
fixed
fullWidth
scrollRef={scrollRef}
rightZone={<Button variant="outline">Descargar</Button>}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const VerticalStepper = ({
};

const getStepState = (step, index) => {
if (index === activeIndex) return 'current';
if (step.isChild) {
if (step.siblingsRange.every((childIndex) => completedSteps.includes(childIndex)))
return 'completed';
Expand All @@ -107,7 +108,6 @@ const VerticalStepper = ({
if (completedSteps.includes(index)) {
return step.status || 'completed';
}
if (index === activeIndex) return 'current';
return 'pending';
};

Expand Down

0 comments on commit b27a3ea

Please sign in to comment.