Skip to content

Commit 52d2aa5

Browse files
author
Hector Arce De Las Heras
committed
Footer and Modal Scroll Enhancements
This commit introduces improvements to the Footer and Modal Scroll behavior. Changes include: Footer: Now, a div in the footer will not be rendered if it has no content. This optimizes the rendering process and improves the overall performance of the application. Modal Scroll: The shadow styles are now applied immediately when the user starts to scroll. This provides a more responsive and visually appealing user experience.
1 parent 904d2ec commit 52d2aa5

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

src/components/footer/components/footerContent.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,24 @@ interface IFooterContent {
88
contentDirection?: ContentDirectionType;
99
forceVertical?: boolean;
1010
children: React.ReactNode[];
11+
margin?: boolean;
12+
marginLeft?: boolean;
13+
marginRight?: boolean;
1114
}
1215

1316
export const FooterContent = (props: IFooterContent): JSX.Element | null => {
1417
// always returned something, cause we need to put container to flex direction
1518
const flexDirectionDesktopTablet = props.forceVertical ? 'column' : 'row';
1619

20+
if (!props.children.length) {
21+
return null;
22+
}
23+
1724
return (
1825
<FooterContentStyled
26+
$margin={props.margin}
27+
$marginLeft={props.marginLeft}
28+
$marginRight={props.marginRight}
1929
aria-hidden={!props.children.length}
2030
contentDirection={props.contentDirection}
2131
flexDirectionDesktopTablet={flexDirectionDesktopTablet}

src/components/footer/footer.styled.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ type FooterStylesType = {
1010
contentDirection?: ContentDirectionType;
1111
flexDirectionDesktopTablet?: string;
1212
alignItems?: string;
13+
$margin?: boolean;
14+
$marginLeft?: boolean;
15+
$marginRight?: boolean;
1316
};
1417

1518
type RootContainerStyledType = FooterStylesType & {
@@ -36,4 +39,7 @@ export const FooterContentStyled = styled.div<FooterStylesType>`
3639
justify-content: ${props =>
3740
props.contentDirection === ContentDirectionType.HORIZONTAL ? 'flex-start' : 'center'};
3841
${props => getStyles(props.styles?.contentContainer)}
42+
margin: ${props => props.$margin && 'auto'};
43+
margin-left: ${props => props.$marginLeft && 'auto'};
44+
margin-right: ${props => props.$marginRight && 'auto'};
3945
`;

src/components/footer/footerStandAlone.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,23 @@ const FooterStandAloneComponent = (
8080
<FooterContent
8181
contentDirection={props.contentDirection}
8282
forceVertical={props.forceVertical}
83+
marginRight={true}
8384
styles={props.styles}
8485
>
8586
{firstContent}
8687
</FooterContent>
8788
<FooterContent
8889
contentDirection={props.contentDirection}
8990
forceVertical={props.forceVertical}
91+
margin={true}
9092
styles={props.styles}
9193
>
9294
{secondContent}
9395
</FooterContent>
9496
<FooterContent
9597
contentDirection={props.contentDirection}
9698
forceVertical={props.forceVertical}
99+
marginLeft={true}
97100
styles={props.styles}
98101
>
99102
{thridContent}

src/hooks/useScrollEffect/useScrollEffect.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const defaultShadow = 'none';
1515
export const useScrollEffect = (
1616
conditional = true,
1717
shadowStyles = defaultShadow,
18-
shadowVisible = 99
18+
shadowVisible = 1
1919
): CustomHookReturnValue => {
2020
// the scrollable element ref
2121
const innerScrollableRef = useRef<HTMLElement | null>(null);

0 commit comments

Comments
 (0)