Skip to content

Commit 757bc34

Browse files
authored
Merge pull request #1785 from dxc-technology/Mil4n0r/header_footer_types-fix
Fixed typings from footer/header margins
2 parents f7c88cc + 2105e5d commit 757bc34

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

lib/src/footer/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const FooterContainer = styled.footer<{ margin: FooterPropsType["margin"] }>`
7878
justify-content: space-between;
7979
width: 100%;
8080
min-height: ${(props) => props.theme.height};
81-
margin-top: ${(props) => (props.margin && typeof props.margin !== "object" ? spaces[props.margin] : "0px")};
81+
margin-top: ${(props) => (props.margin ? spaces[props.margin] : "0px")};
8282
background-color: ${(props) => props.theme.backgroundColor};
8383
8484
@media (min-width: ${responsiveSizes.small}rem) {

lib/src/footer/types.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
2-
type Size = {
3-
top?: Space;
4-
bottom?: Space;
5-
left?: Space;
6-
right?: Space;
7-
};
82
type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
93

104
type SocialLink = {
@@ -56,7 +50,7 @@ type FooterPropsType = {
5650
/**
5751
* Size of the top margin to be applied to the footer.
5852
*/
59-
margin?: Space | Size;
53+
margin?: Space;
6054
/**
6155
* Value of the tabindex for all interactive elements, except those
6256
* inside the custom area.

lib/src/header/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ const HeaderContainer = styled.header<{ margin: HeaderPropsType["margin"]; under
167167
align-items: center;
168168
justify-content: space-between;
169169
min-height: ${(props) => props.theme.minHeight};
170-
margin-bottom: ${(props) => (props.margin && typeof props.margin !== "object" ? spaces[props.margin] : "0px")};
170+
margin-bottom: ${(props) => (props.margin ? spaces[props.margin] : "0px")};
171171
padding: ${(props) =>
172172
`${props.theme.paddingTop} ${props.theme.paddingRight} ${props.theme.paddingBottom} ${props.theme.paddingLeft}`};
173173
background-color: ${(props) => props.theme.backgroundColor};

lib/src/header/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
2+
13
type Props = {
24
/**
35
* Whether a contrast line should appear at the bottom of the header.
@@ -21,7 +23,7 @@ type Props = {
2123
/**
2224
* Size of the bottom margin to be applied to the header.
2325
*/
24-
margin?: "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
26+
margin?: Space;
2527
/**
2628
* Value of the tabindex for all interactive elements, except those inside the
2729
* custom area.

0 commit comments

Comments
 (0)