@dxc-technology/halstack-react 0.0.0-efa7c74 → 0.0.0-f00a97a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BackgroundColorContext.d.ts +10 -0
- package/BackgroundColorContext.js +1 -4
- package/HalstackContext.d.ts +12 -0
- package/HalstackContext.js +295 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +15 -47
- package/accordion/Accordion.stories.tsx +307 -0
- package/accordion/Accordion.test.js +72 -0
- package/accordion/types.d.ts +8 -8
- package/accordion-group/AccordionGroup.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +16 -17
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/AccordionGroup.test.js +151 -0
- package/accordion-group/types.d.ts +8 -8
- package/alert/Alert.js +6 -3
- package/alert/Alert.test.js +92 -0
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +6 -4
- package/badge/types.d.ts +5 -0
- package/{radio → badge}/types.js +0 -0
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +51 -0
- package/bleed/Bleed.stories.tsx +341 -0
- package/bleed/types.d.ts +37 -0
- package/bleed/types.js +5 -0
- package/box/Box.js +24 -34
- package/box/Box.test.js +18 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/bulleted-list/types.js +5 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +59 -82
- package/button/Button.stories.tsx +15 -8
- package/button/Button.test.js +35 -0
- package/button/types.d.ts +8 -12
- package/card/Card.js +25 -28
- package/card/Card.stories.tsx +1 -1
- package/card/Card.test.js +50 -0
- package/checkbox/Checkbox.d.ts +1 -1
- package/checkbox/Checkbox.js +45 -41
- package/checkbox/Checkbox.stories.tsx +124 -128
- package/checkbox/Checkbox.test.js +78 -0
- package/checkbox/types.d.ts +8 -4
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +16 -76
- package/chip/Chip.stories.tsx +6 -8
- package/chip/Chip.test.js +56 -0
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/common/variables.js +282 -355
- package/date-input/DateInput.js +66 -55
- package/date-input/DateInput.stories.tsx +7 -7
- package/date-input/DateInput.test.js +479 -0
- package/date-input/types.d.ts +16 -9
- package/dialog/Dialog.js +50 -53
- package/dialog/Dialog.stories.tsx +1 -2
- package/dialog/Dialog.test.js +70 -0
- package/dialog/types.d.ts +2 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +242 -272
- package/dropdown/Dropdown.stories.tsx +312 -0
- package/dropdown/Dropdown.test.js +591 -0
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +80 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +92 -0
- package/dropdown/types.d.ts +30 -19
- package/file-input/FileInput.d.ts +1 -1
- package/file-input/FileInput.js +165 -83
- package/file-input/FileInput.stories.tsx +507 -0
- package/file-input/FileInput.test.js +457 -0
- package/file-input/FileItem.js +12 -8
- package/file-input/types.d.ts +32 -7
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +57 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +21 -0
- package/flex/types.js +5 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +32 -113
- package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
- package/footer/Footer.test.js +109 -0
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +4 -4
- package/footer/types.d.ts +21 -17
- package/header/Header.js +97 -116
- package/header/Header.stories.tsx +46 -36
- package/header/Header.test.js +79 -0
- package/header/Icons.d.ts +2 -0
- package/header/Icons.js +2 -2
- package/header/types.d.ts +2 -2
- package/heading/Heading.js +1 -1
- package/heading/Heading.stories.tsx +3 -2
- package/heading/Heading.test.js +186 -0
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +51 -0
- package/inset/Inset.stories.tsx +229 -0
- package/inset/types.d.ts +37 -0
- package/inset/types.js +5 -0
- package/layout/ApplicationLayout.d.ts +20 -0
- package/layout/ApplicationLayout.js +71 -135
- package/layout/ApplicationLayout.stories.tsx +161 -0
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +42 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +3 -2
- package/link/Link.js +61 -86
- package/link/Link.stories.tsx +99 -52
- package/link/Link.test.js +83 -0
- package/link/types.d.ts +9 -29
- package/main.d.ts +12 -12
- package/main.js +64 -58
- package/number-input/NumberInput.js +14 -24
- package/number-input/NumberInput.stories.tsx +5 -5
- package/number-input/NumberInput.test.js +506 -0
- package/number-input/types.d.ts +17 -10
- package/package.json +14 -10
- package/paginator/Paginator.js +19 -46
- package/paginator/Paginator.test.js +308 -0
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.js +23 -19
- package/password-input/PasswordInput.stories.tsx +3 -3
- package/password-input/PasswordInput.test.js +180 -0
- package/password-input/types.d.ts +26 -21
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +59 -53
- package/progress-bar/ProgressBar.stories.jsx +13 -11
- package/progress-bar/ProgressBar.test.js +110 -0
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +118 -0
- package/quick-nav/QuickNav.stories.tsx +264 -0
- package/quick-nav/types.d.ts +21 -0
- package/quick-nav/types.js +5 -0
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +141 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +281 -0
- package/radio-group/RadioGroup.stories.tsx +100 -0
- package/radio-group/RadioGroup.test.js +695 -0
- package/radio-group/types.d.ts +114 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/ResultsetTable.d.ts +1 -1
- package/resultsetTable/ResultsetTable.js +9 -4
- package/resultsetTable/ResultsetTable.stories.tsx +275 -0
- package/resultsetTable/ResultsetTable.test.js +348 -0
- package/resultsetTable/types.d.ts +6 -2
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +199 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +110 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +158 -380
- package/select/Select.stories.tsx +231 -176
- package/select/Select.test.js +2175 -0
- package/select/types.d.ts +210 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +186 -54
- package/sidenav/Sidenav.stories.tsx +154 -139
- package/sidenav/Sidenav.test.js +44 -0
- package/sidenav/types.d.ts +50 -27
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +7 -6
- package/slider/Slider.stories.tsx +8 -8
- package/slider/Slider.test.js +187 -0
- package/slider/types.d.ts +4 -0
- package/spinner/Spinner.js +3 -3
- package/spinner/Spinner.stories.jsx +1 -0
- package/spinner/Spinner.test.js +64 -0
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +129 -57
- package/switch/Switch.stories.tsx +21 -43
- package/switch/Switch.test.js +212 -0
- package/switch/types.d.ts +9 -6
- package/table/Table.js +2 -2
- package/table/Table.stories.jsx +2 -1
- package/table/Table.test.js +26 -0
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +17 -19
- package/tabs/Tabs.stories.tsx +7 -16
- package/tabs/Tabs.test.js +140 -0
- package/tabs/types.d.ts +27 -15
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +170 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +130 -0
- package/tabs-nav/types.d.ts +53 -0
- package/tabs-nav/types.js +5 -0
- package/tag/Tag.d.ts +1 -1
- package/tag/Tag.js +18 -28
- package/tag/Tag.stories.tsx +26 -29
- package/tag/Tag.test.js +60 -0
- package/tag/types.d.ts +23 -14
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +55 -0
- package/text-input/TextInput.js +100 -124
- package/text-input/TextInput.stories.tsx +473 -0
- package/text-input/TextInput.test.js +1712 -0
- package/text-input/types.d.ts +44 -23
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +39 -79
- package/textarea/Textarea.stories.jsx +37 -15
- package/textarea/Textarea.test.js +437 -0
- package/textarea/types.d.ts +137 -0
- package/textarea/types.js +5 -0
- package/toggle-group/ToggleGroup.d.ts +1 -1
- package/toggle-group/ToggleGroup.js +15 -17
- package/toggle-group/ToggleGroup.stories.tsx +27 -32
- package/toggle-group/ToggleGroup.test.js +156 -0
- package/toggle-group/types.d.ts +47 -26
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/useTheme.d.ts +2 -0
- package/useTheme.js +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.d.ts +1 -1
- package/wizard/Wizard.js +112 -58
- package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +33 -24
- package/wizard/Wizard.test.js +141 -0
- package/wizard/types.d.ts +13 -12
- package/ThemeContext.js +0 -246
- package/V3Select/V3Select.js +0 -455
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -260
- package/V3Textarea/index.d.ts +0 -27
- package/chip/index.d.ts +0 -22
- package/date/Date.js +0 -373
- package/date/index.d.ts +0 -27
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -611
- package/input-text/index.d.ts +0 -36
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/types.d.ts +0 -54
- package/select/index.d.ts +0 -131
- package/textarea/index.d.ts +0 -117
- package/toggle/Toggle.js +0 -186
- package/toggle/index.d.ts +0 -21
- package/upload/Upload.js +0 -201
- package/upload/buttons-upload/ButtonsUpload.js +0 -111
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -115
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -109
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -104
- package/upload/transactions/Transactions.js +0 -94
- package/wizard/Icons.js +0 -65
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import DxcFlex from "./Flex";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Flex",
|
|
8
|
+
component: DxcFlex,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<Title title="Default" level={4} />
|
|
14
|
+
<Container>
|
|
15
|
+
<DxcFlex>
|
|
16
|
+
<Placeholder />
|
|
17
|
+
<Placeholder width="50px" />
|
|
18
|
+
<Placeholder />
|
|
19
|
+
<Placeholder width="50px" />
|
|
20
|
+
<Placeholder width="50px" />
|
|
21
|
+
</DxcFlex>
|
|
22
|
+
</Container>
|
|
23
|
+
<Title title="Direction column, wrap, justify content end, align items center and gap" level={4} />
|
|
24
|
+
<Container>
|
|
25
|
+
<DxcFlex direction="column" wrap="wrap" justifyContent="end" alignItems="center" gap="20px">
|
|
26
|
+
<Placeholder />
|
|
27
|
+
<Placeholder width="100px" />
|
|
28
|
+
<Placeholder />
|
|
29
|
+
<Placeholder width="100px" />
|
|
30
|
+
<Placeholder />
|
|
31
|
+
</DxcFlex>
|
|
32
|
+
</Container>
|
|
33
|
+
<Title title="Wrap with align content space between, row and column gaps, and as a span" level={4} />
|
|
34
|
+
<Container height="250px">
|
|
35
|
+
<DxcFlex wrap="wrap" alignContent="space-between" as="span" gap={{ rowGap: "10px", columnGap: "20px" }}>
|
|
36
|
+
<Placeholder />
|
|
37
|
+
<Placeholder />
|
|
38
|
+
<Placeholder />
|
|
39
|
+
<Placeholder />
|
|
40
|
+
<Placeholder width="100px" />
|
|
41
|
+
<Placeholder />
|
|
42
|
+
<Placeholder />
|
|
43
|
+
<Placeholder width="100px" />
|
|
44
|
+
<Placeholder />
|
|
45
|
+
<Placeholder />
|
|
46
|
+
<Placeholder width="100px" />
|
|
47
|
+
<Placeholder />
|
|
48
|
+
</DxcFlex>
|
|
49
|
+
</Container>
|
|
50
|
+
<Title title="Basis 100%, order, grow and align self" level={4} />
|
|
51
|
+
<Container height="75px">
|
|
52
|
+
<DxcFlex basis="100%">
|
|
53
|
+
<DxcFlex order={3} grow={1} alignSelf="flex-end">
|
|
54
|
+
<PlaceholderGrowAndShrink>order 3, grow 1, align self end</PlaceholderGrowAndShrink>
|
|
55
|
+
</DxcFlex>
|
|
56
|
+
<DxcFlex order={-1} grow={4}>
|
|
57
|
+
<PlaceholderGrowAndShrink>order -1, grow 4</PlaceholderGrowAndShrink>
|
|
58
|
+
</DxcFlex>
|
|
59
|
+
<DxcFlex order={5} grow={1}>
|
|
60
|
+
<PlaceholderGrowAndShrink>order 5, grow 1</PlaceholderGrowAndShrink>
|
|
61
|
+
</DxcFlex>
|
|
62
|
+
<DxcFlex order={2} grow={2}>
|
|
63
|
+
<PlaceholderGrowAndShrink>order 2. grow 2</PlaceholderGrowAndShrink>
|
|
64
|
+
</DxcFlex>
|
|
65
|
+
</DxcFlex>
|
|
66
|
+
</Container>
|
|
67
|
+
<Title title="Basis and shrink" level={4} />
|
|
68
|
+
<Container>
|
|
69
|
+
<DxcFlex basis="600px">
|
|
70
|
+
<DxcFlex shrink={4} basis="400px">
|
|
71
|
+
<PlaceholderGrowAndShrink>shrink 4</PlaceholderGrowAndShrink>
|
|
72
|
+
</DxcFlex>
|
|
73
|
+
<DxcFlex shrink={2} basis="400px">
|
|
74
|
+
<PlaceholderGrowAndShrink>shrink 2</PlaceholderGrowAndShrink>
|
|
75
|
+
</DxcFlex>
|
|
76
|
+
<DxcFlex shrink={1} basis="400px">
|
|
77
|
+
<PlaceholderGrowAndShrink>shrink 1</PlaceholderGrowAndShrink>
|
|
78
|
+
</DxcFlex>
|
|
79
|
+
</DxcFlex>
|
|
80
|
+
</Container>
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const Container = styled.div<{ height?: string }>`
|
|
85
|
+
display: flex;
|
|
86
|
+
background: #f2eafa;
|
|
87
|
+
margin: 2.5rem;
|
|
88
|
+
${({ height }) => (height ? `height: ${height}` : "max-height: 150px")};
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
const Placeholder = styled.div<{ width?: string }>`
|
|
92
|
+
height: 40px;
|
|
93
|
+
min-width: ${({ width }) => width || "200px"};
|
|
94
|
+
border: 1px solid #a46ede;
|
|
95
|
+
background-color: #e5d5f6;
|
|
96
|
+
`;
|
|
97
|
+
|
|
98
|
+
const PlaceholderGrowAndShrink = styled.div`
|
|
99
|
+
height: 40px;
|
|
100
|
+
width: 100%;
|
|
101
|
+
border: 1px solid #a46ede;
|
|
102
|
+
background-color: #e5d5f6;
|
|
103
|
+
`;
|
package/flex/types.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Gap = {
|
|
3
|
+
rowGap: string;
|
|
4
|
+
columnGap: string;
|
|
5
|
+
};
|
|
6
|
+
declare type Props = {
|
|
7
|
+
direction?: "row" | "row-reverse" | "column" | "column-reverse";
|
|
8
|
+
wrap?: "nowrap" | "wrap" | "wrap-reverse";
|
|
9
|
+
justifyContent?: "flex-start" | "flex-end" | "start" | "end" | "left" | "right" | "center" | "space-between" | "space-around" | "space-evenly";
|
|
10
|
+
alignItems?: "stretch" | "flex-start" | "flex-end" | "start" | "end" | "self-start" | "self-end" | "center" | "baseline";
|
|
11
|
+
alignContent?: "normal" | "flex-start" | "flex-end" | "start" | "end" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch";
|
|
12
|
+
alignSelf?: "auto" | "flex-start" | "flex-end" | "center" | "baseline" | "stretch";
|
|
13
|
+
gap?: string | Gap;
|
|
14
|
+
order?: number;
|
|
15
|
+
grow?: number;
|
|
16
|
+
shrink?: number;
|
|
17
|
+
basis?: string;
|
|
18
|
+
as?: keyof HTMLElementTagNameMap;
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
};
|
|
21
|
+
export default Props;
|
package/flex/types.js
ADDED
package/footer/Footer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import FooterPropsType from "./types";
|
|
3
|
-
declare const DxcFooter: ({ socialLinks, bottomLinks, copyright, children, padding, margin, tabIndex }: FooterPropsType) => JSX.Element;
|
|
3
|
+
declare const DxcFooter: ({ socialLinks, bottomLinks, copyright, children, padding, margin, tabIndex, }: FooterPropsType) => JSX.Element;
|
|
4
4
|
export default DxcFooter;
|
package/footer/Footer.js
CHANGED
|
@@ -9,11 +9,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
13
|
|
|
16
|
-
var
|
|
14
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
15
|
|
|
18
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
17
|
|
|
@@ -21,13 +19,15 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
21
19
|
|
|
22
20
|
var _variables = require("../common/variables.js");
|
|
23
21
|
|
|
24
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
22
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
23
|
+
|
|
24
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
25
25
|
|
|
26
|
-
var _BackgroundColorContext = require("../BackgroundColorContext
|
|
26
|
+
var _BackgroundColorContext = require("../BackgroundColorContext");
|
|
27
27
|
|
|
28
|
-
var _Icons =
|
|
28
|
+
var _Icons = require("./Icons");
|
|
29
29
|
|
|
30
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
|
|
30
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
|
|
31
31
|
|
|
32
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
33
|
|
|
@@ -36,83 +36,37 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
36
36
|
var DxcFooter = function DxcFooter(_ref) {
|
|
37
37
|
var socialLinks = _ref.socialLinks,
|
|
38
38
|
bottomLinks = _ref.bottomLinks,
|
|
39
|
-
|
|
40
|
-
copyright = _ref$copyright === void 0 ? "" : _ref$copyright,
|
|
39
|
+
copyright = _ref.copyright,
|
|
41
40
|
children = _ref.children,
|
|
42
41
|
padding = _ref.padding,
|
|
43
42
|
margin = _ref.margin,
|
|
44
43
|
_ref$tabIndex = _ref.tabIndex,
|
|
45
44
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
46
|
-
var ref = (0, _react.useRef)(null);
|
|
47
|
-
|
|
48
|
-
var _useState = (0, _react.useState)(),
|
|
49
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
50
|
-
refSize = _useState2[0],
|
|
51
|
-
setRefSize = _useState2[1];
|
|
52
|
-
|
|
53
|
-
var _useState3 = (0, _react.useState)(false),
|
|
54
|
-
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
55
|
-
isResponsiveTablet = _useState4[0],
|
|
56
|
-
setIsResponsiveTablet = _useState4[1];
|
|
57
|
-
|
|
58
|
-
var _useState5 = (0, _react.useState)(false),
|
|
59
|
-
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
60
|
-
isResponsivePhone = _useState6[0],
|
|
61
|
-
setIsResponsivePhone = _useState6[1];
|
|
62
|
-
|
|
63
45
|
var colorsTheme = (0, _useTheme["default"])();
|
|
46
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
64
47
|
var footerLogo = (0, _react.useMemo)(function () {
|
|
65
48
|
if (!colorsTheme.footer.logo) {
|
|
66
|
-
return _Icons
|
|
49
|
+
return _Icons.dxcLogo;
|
|
67
50
|
}
|
|
68
51
|
|
|
69
52
|
if (typeof colorsTheme.footer.logo === "string") {
|
|
70
53
|
return /*#__PURE__*/_react["default"].createElement(LogoImg, {
|
|
71
|
-
alt:
|
|
54
|
+
alt: translatedLabels.formFields.logoAlternativeText,
|
|
72
55
|
src: colorsTheme.footer.logo
|
|
73
56
|
});
|
|
74
57
|
}
|
|
75
58
|
|
|
76
59
|
return colorsTheme.footer.logo;
|
|
77
60
|
}, [colorsTheme.footer.logo]);
|
|
78
|
-
|
|
79
|
-
var handleResize = function handleResize(refWidth) {
|
|
80
|
-
if (ref.current) {
|
|
81
|
-
setRefSize(refWidth);
|
|
82
|
-
|
|
83
|
-
if (refWidth <= _variables.responsiveSizes.tablet && refWidth > _variables.responsiveSizes.mobileLarge) {
|
|
84
|
-
setIsResponsiveTablet(true);
|
|
85
|
-
setIsResponsivePhone(false);
|
|
86
|
-
} else if (refWidth <= _variables.responsiveSizes.tablet && refWidth <= _variables.responsiveSizes.mobileLarge) {
|
|
87
|
-
setIsResponsivePhone(true);
|
|
88
|
-
setIsResponsiveTablet(false);
|
|
89
|
-
} else {
|
|
90
|
-
setIsResponsiveTablet(false);
|
|
91
|
-
setIsResponsivePhone(false);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
var handleEventListener = function handleEventListener() {
|
|
97
|
-
handleResize(ref.current.offsetWidth);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
(0, _react.useEffect)(function () {
|
|
101
|
-
window.addEventListener("resize", handleEventListener);
|
|
102
|
-
handleResize(ref.current.offsetWidth);
|
|
103
|
-
return function () {
|
|
104
|
-
window.removeEventListener("resize", handleEventListener);
|
|
105
|
-
};
|
|
106
|
-
}, []);
|
|
107
61
|
var socialLink = socialLinks === null || socialLinks === void 0 ? void 0 : socialLinks.map(function (link, index) {
|
|
108
62
|
return /*#__PURE__*/_react["default"].createElement(SocialAnchor, {
|
|
109
63
|
tabIndex: tabIndex,
|
|
110
64
|
key: "social".concat(index).concat(link.href),
|
|
111
65
|
index: index,
|
|
112
66
|
href: link && link.href ? link.href : ""
|
|
113
|
-
},
|
|
114
|
-
src: link.
|
|
115
|
-
}));
|
|
67
|
+
}, /*#__PURE__*/_react["default"].createElement(SocialIconContainer, null, typeof link.logo === "string" ? /*#__PURE__*/_react["default"].createElement(SocialIconImg, {
|
|
68
|
+
src: link.logo
|
|
69
|
+
}) : link.logo));
|
|
116
70
|
});
|
|
117
71
|
var bottomLink = bottomLinks === null || bottomLinks === void 0 ? void 0 : bottomLinks.map(function (link, index) {
|
|
118
72
|
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
@@ -127,32 +81,17 @@ var DxcFooter = function DxcFooter(_ref) {
|
|
|
127
81
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
128
82
|
theme: colorsTheme.footer
|
|
129
83
|
}, /*#__PURE__*/_react["default"].createElement(FooterContainer, {
|
|
130
|
-
margin: margin
|
|
131
|
-
|
|
132
|
-
ref: ref
|
|
133
|
-
}, /*#__PURE__*/_react["default"].createElement(FooterHeader, null, /*#__PURE__*/_react["default"].createElement(LogoContainer, null, footerLogo), /*#__PURE__*/_react["default"].createElement("div", null, socialLink)), isResponsivePhone && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(FooterFooter, {
|
|
134
|
-
className: "footerFooter",
|
|
135
|
-
refSize: refSize
|
|
136
|
-
}, /*#__PURE__*/_react["default"].createElement(BottomLinks, {
|
|
137
|
-
refSize: refSize
|
|
138
|
-
}, bottomLink), /*#__PURE__*/_react["default"].createElement(Copyright, {
|
|
139
|
-
refSize: refSize
|
|
140
|
-
}, copyright))), (!isResponsiveTablet && !isResponsivePhone || isResponsiveTablet) && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(ChildComponents, {
|
|
84
|
+
margin: margin
|
|
85
|
+
}, /*#__PURE__*/_react["default"].createElement(FooterHeader, null, /*#__PURE__*/_react["default"].createElement(LogoContainer, null, footerLogo), /*#__PURE__*/_react["default"].createElement(SocialLinkContainer, null, socialLink)), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(ChildComponents, {
|
|
141
86
|
padding: padding
|
|
142
87
|
}, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
|
|
143
88
|
color: colorsTheme.footer.backgroundColor
|
|
144
89
|
}, children)), /*#__PURE__*/_react["default"].createElement(FooterFooter, {
|
|
145
90
|
className: "footerFooter"
|
|
146
|
-
}, /*#__PURE__*/_react["default"].createElement(BottomLinks,
|
|
147
|
-
refSize: refSize
|
|
148
|
-
}, bottomLink), /*#__PURE__*/_react["default"].createElement(Copyright, {
|
|
149
|
-
refSize: refSize
|
|
150
|
-
}, copyright)))));
|
|
91
|
+
}, /*#__PURE__*/_react["default"].createElement(BottomLinks, null, bottomLink), /*#__PURE__*/_react["default"].createElement(Copyright, null, copyright || translatedLabels.footer.copyrightText(new Date().getFullYear()))))));
|
|
151
92
|
};
|
|
152
93
|
|
|
153
|
-
var FooterContainer = _styledComponents["default"].footer(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n padding: ", ";\n background-color: ", ";\n margin-top: ", ";\n width: 100%;\n box-sizing: border-box;\n min-height: ", ";\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n"])), function (props) {
|
|
154
|
-
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "20px 20px 20px 20px" : "24px 36px 24px 36px";
|
|
155
|
-
}, function (props) {
|
|
94
|
+
var FooterContainer = _styledComponents["default"].footer(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n @media (min-width: ", "rem) {\n padding: 24px 36px 24px 36px;\n }\n\n @media (max-width: ", "rem) {\n //mobile phones\n padding: 20px;\n }\n\n background-color: ", ";\n margin-top: ", ";\n width: 100%;\n box-sizing: border-box;\n min-height: ", ";\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n"])), _variables.responsiveSizes.small, _variables.responsiveSizes.small, function (props) {
|
|
156
95
|
return props.theme.backgroundColor;
|
|
157
96
|
}, function (props) {
|
|
158
97
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
@@ -160,27 +99,17 @@ var FooterContainer = _styledComponents["default"].footer(_templateObject || (_t
|
|
|
160
99
|
return props.theme.height;
|
|
161
100
|
});
|
|
162
101
|
|
|
163
|
-
var FooterHeader = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n"])));
|
|
102
|
+
var FooterHeader = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n flex-wrap: wrap;\n row-gap: 24px;\n"])));
|
|
164
103
|
|
|
165
|
-
var FooterFooter = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n
|
|
166
|
-
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "column" : "row";
|
|
167
|
-
}, function (props) {
|
|
168
|
-
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "center" : "";
|
|
169
|
-
}, function (props) {
|
|
104
|
+
var FooterFooter = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n\n @media (min-width: ", "rem) {\n flex-direction: row;\n }\n\n @media (max-width: ", "rem) {\n //mobile phones\n flex-direction: column;\n align-items: center;\n }\n\n border-top: ", ";\n margin-top: 16px;\n"])), _variables.responsiveSizes.small, _variables.responsiveSizes.small, function (props) {
|
|
170
105
|
return "".concat(props.theme.bottomLinksDividerThickness, " ").concat(props.theme.bottomLinksDividerStyle, " ").concat(props.theme.bottomLinksDividerColor);
|
|
171
106
|
});
|
|
172
107
|
|
|
173
|
-
var BottomLinks = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n padding-top: ", ";\n display: inline-flex;\n flex-wrap: wrap;\n
|
|
108
|
+
var BottomLinks = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n padding-top: ", ";\n display: inline-flex;\n flex-wrap: wrap;\n\n @media (min-width: ", "rem) {\n max-width: 60%;\n }\n\n @media (max-width: ", "rem) {\n //mobile phones\n max-width: 100%;\n width: 100%;\n }\n\n & > span:last-child span {\n display: none;\n }\n align-self: center;\n"])), function (props) {
|
|
174
109
|
return props.theme.bottomLinksDividerSpacing;
|
|
175
|
-
},
|
|
176
|
-
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "100%" : "60%";
|
|
177
|
-
}, function (props) {
|
|
178
|
-
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "100%" : "";
|
|
179
|
-
}, function (props) {
|
|
180
|
-
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "40px 0 40px 0" : "";
|
|
181
|
-
});
|
|
110
|
+
}, _variables.responsiveSizes.small, _variables.responsiveSizes.small);
|
|
182
111
|
|
|
183
|
-
var ChildComponents = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n min-height:
|
|
112
|
+
var ChildComponents = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 16px;\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n overflow: hidden;\n"])), function (props) {
|
|
184
113
|
return props.padding && (0, _typeof2["default"])(props.padding) !== "object" ? _variables.spaces[props.padding] : "0px";
|
|
185
114
|
}, function (props) {
|
|
186
115
|
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.top ? _variables.spaces[props.padding.top] : "";
|
|
@@ -192,7 +121,7 @@ var ChildComponents = _styledComponents["default"].div(_templateObject5 || (_tem
|
|
|
192
121
|
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
|
|
193
122
|
});
|
|
194
123
|
|
|
195
|
-
var Copyright = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n
|
|
124
|
+
var Copyright = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n\n @media (min-width: ", "rem) {\n max-width: 40%;\n text-align: right;\n }\n\n @media (max-width: ", "rem) {\n //mobile phones\n max-width: 100%;\n width: 100%;\n text-align: left;\n }\n\n padding-top: ", ";\n"])), function (props) {
|
|
196
125
|
return props.theme.copyrightFontFamily;
|
|
197
126
|
}, function (props) {
|
|
198
127
|
return props.theme.copyrightFontSize;
|
|
@@ -202,13 +131,7 @@ var Copyright = _styledComponents["default"].div(_templateObject6 || (_templateO
|
|
|
202
131
|
return props.theme.copyrightFontWeight;
|
|
203
132
|
}, function (props) {
|
|
204
133
|
return props.theme.copyrightFontColor;
|
|
205
|
-
}, function (props) {
|
|
206
|
-
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "100%" : "40%";
|
|
207
|
-
}, function (props) {
|
|
208
|
-
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "100%" : "";
|
|
209
|
-
}, function (props) {
|
|
210
|
-
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "center" : "right";
|
|
211
|
-
}, function (props) {
|
|
134
|
+
}, _variables.responsiveSizes.small, _variables.responsiveSizes.small, function (props) {
|
|
212
135
|
return props.theme.bottomLinksDividerSpacing;
|
|
213
136
|
});
|
|
214
137
|
|
|
@@ -224,19 +147,15 @@ var LogoImg = _styledComponents["default"].img(_templateObject8 || (_templateObj
|
|
|
224
147
|
return props.theme.logoWidth;
|
|
225
148
|
});
|
|
226
149
|
|
|
227
|
-
var
|
|
150
|
+
var SocialLinkContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-self: center;\n"])));
|
|
151
|
+
|
|
152
|
+
var SocialAnchor = _styledComponents["default"].a(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n & {\n display: inline-flex;\n margin-left: ", ";\n }\n"])), function (props) {
|
|
228
153
|
return props.index === 0 ? "0px" : props.theme.socialLinksGutter;
|
|
229
154
|
});
|
|
230
155
|
|
|
231
|
-
var
|
|
232
|
-
return props.theme.socialLinksSize;
|
|
233
|
-
}, function (props) {
|
|
234
|
-
return props.theme.socialLinksSize;
|
|
235
|
-
}, function (props) {
|
|
236
|
-
return props.theme.socialLinksColor;
|
|
237
|
-
});
|
|
156
|
+
var SocialIconImg = _styledComponents["default"].img(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
238
157
|
|
|
239
|
-
var SocialIconContainer = _styledComponents["default"].div(
|
|
158
|
+
var SocialIconContainer = _styledComponents["default"].div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n & {\n display: inline-flex;\n height: ", ";\n width: ", ";\n color: ", ";\n }\n\n overflow: hidden;\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
240
159
|
return props.theme.socialLinksSize;
|
|
241
160
|
}, function (props) {
|
|
242
161
|
return props.theme.socialLinksSize;
|
|
@@ -244,11 +163,11 @@ var SocialIconContainer = _styledComponents["default"].div(_templateObject11 ||
|
|
|
244
163
|
return props.theme.socialLinksColor;
|
|
245
164
|
});
|
|
246
165
|
|
|
247
|
-
var Point = _styledComponents["default"].span(
|
|
166
|
+
var Point = _styledComponents["default"].span(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0px 10px;\n color: ", ";\n"])), function (props) {
|
|
248
167
|
return props.theme.bottomLinksFontColor;
|
|
249
168
|
});
|
|
250
169
|
|
|
251
|
-
var BottomLink = _styledComponents["default"].a(
|
|
170
|
+
var BottomLink = _styledComponents["default"].a(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n text-decoration: ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
252
171
|
return props.theme.bottomLinksTextDecoration;
|
|
253
172
|
}, function (props) {
|
|
254
173
|
return props.theme.bottomLinksFontColor;
|
|
@@ -28,28 +28,7 @@ const social = [
|
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
href: "https://twitter.com/dxctechnology",
|
|
31
|
-
logo:
|
|
32
|
-
<svg version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 438.536 438.536" fill="currentColor">
|
|
33
|
-
<g>
|
|
34
|
-
<path
|
|
35
|
-
d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
|
|
36
|
-
C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
|
|
37
|
-
h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
|
|
38
|
-
C438.532,59.576,430.49,40.204,414.41,24.123z M335.471,168.735c0.191,1.713,0.288,4.278,0.288,7.71
|
|
39
|
-
c0,15.989-2.334,32.025-6.995,48.104c-4.661,16.087-11.8,31.504-21.416,46.254c-9.606,14.749-21.074,27.791-34.396,39.115
|
|
40
|
-
c-13.325,11.32-29.311,20.365-47.968,27.117c-18.648,6.762-38.637,10.143-59.953,10.143c-33.116,0-63.76-8.952-91.931-26.836
|
|
41
|
-
c4.568,0.568,9.329,0.855,14.275,0.855c27.6,0,52.439-8.565,74.519-25.7c-12.941-0.185-24.506-4.179-34.688-11.991
|
|
42
|
-
c-10.185-7.803-17.273-17.699-21.271-29.691c4.947,0.76,8.658,1.137,11.132,1.137c4.187,0,9.042-0.76,14.56-2.279
|
|
43
|
-
c-13.894-2.669-25.598-9.562-35.115-20.697c-9.519-11.136-14.277-23.84-14.277-38.114v-0.571
|
|
44
|
-
c10.085,4.755,19.602,7.229,28.549,7.422c-17.321-11.613-25.981-28.265-25.981-49.963c0-10.66,2.758-20.747,8.278-30.264
|
|
45
|
-
c15.035,18.464,33.311,33.213,54.816,44.252c21.507,11.038,44.54,17.227,69.092,18.558c-0.95-3.616-1.427-8.186-1.427-13.704
|
|
46
|
-
c0-16.562,5.853-30.692,17.56-42.399c11.703-11.706,25.837-17.561,42.394-17.561c17.515,0,32.079,6.283,43.688,18.846
|
|
47
|
-
c13.134-2.474,25.892-7.33,38.26-14.56c-4.757,14.652-13.613,25.788-26.55,33.402c12.368-1.716,23.88-4.95,34.537-9.708
|
|
48
|
-
C357.458,149.793,347.462,160.166,335.471,168.735z"
|
|
49
|
-
/>
|
|
50
|
-
</g>
|
|
51
|
-
</svg>
|
|
52
|
-
),
|
|
31
|
+
logo: "http://assets.stickpng.com/images/580b57fcd9996e24bc43c53e.png",
|
|
53
32
|
},
|
|
54
33
|
{
|
|
55
34
|
href: "https://www.facebook.com/DXCTechnology/",
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
|
|
9
|
+
var _linkedin = _interopRequireDefault(require("../../app/src/images/linkedin.svg"));
|
|
10
|
+
|
|
11
|
+
var _Footer = _interopRequireDefault(require("./Footer"));
|
|
12
|
+
|
|
13
|
+
describe("Footer component tests", function () {
|
|
14
|
+
test("Footer renders with default logo", function () {
|
|
15
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], null)),
|
|
16
|
+
getByTitle = _render.getByTitle;
|
|
17
|
+
|
|
18
|
+
expect(getByTitle("DXC Logo")).toBeTruthy();
|
|
19
|
+
});
|
|
20
|
+
test("Footer renders with social links", function () {
|
|
21
|
+
var social = [{
|
|
22
|
+
href: "https://www.test.com/test",
|
|
23
|
+
logo: _linkedin["default"]
|
|
24
|
+
}];
|
|
25
|
+
|
|
26
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], {
|
|
27
|
+
socialLinks: social
|
|
28
|
+
})),
|
|
29
|
+
getByRole = _render2.getByRole;
|
|
30
|
+
|
|
31
|
+
var socialIcon = getByRole("link");
|
|
32
|
+
expect(socialIcon.getAttribute("href")).toBe("https://www.test.com/test");
|
|
33
|
+
});
|
|
34
|
+
test("Footer renders with bottom links", function () {
|
|
35
|
+
var bottom = [{
|
|
36
|
+
href: "https://www.test.com/test",
|
|
37
|
+
text: "bottom-link-text"
|
|
38
|
+
}];
|
|
39
|
+
|
|
40
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], {
|
|
41
|
+
bottomLinks: bottom
|
|
42
|
+
})),
|
|
43
|
+
getByText = _render3.getByText;
|
|
44
|
+
|
|
45
|
+
var link = getByText("bottom-link-text");
|
|
46
|
+
expect(link.getAttribute("href")).toBe("https://www.test.com/test");
|
|
47
|
+
});
|
|
48
|
+
test("Footer renders with copyright text", function () {
|
|
49
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], {
|
|
50
|
+
copyright: "test-copyright"
|
|
51
|
+
})),
|
|
52
|
+
getByText = _render4.getByText;
|
|
53
|
+
|
|
54
|
+
expect(getByText("test-copyright")).toBeTruthy();
|
|
55
|
+
});
|
|
56
|
+
test("Footer renders with correct children", function () {
|
|
57
|
+
//We need to force the offsetWidth value
|
|
58
|
+
Object.defineProperty(HTMLElement.prototype, "offsetWidth", {
|
|
59
|
+
configurable: true,
|
|
60
|
+
value: 1024
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], null, /*#__PURE__*/_react["default"].createElement("p", null, "footer-child-text"))),
|
|
64
|
+
getByText = _render5.getByText;
|
|
65
|
+
|
|
66
|
+
expect(getByText("footer-child-text")).toBeTruthy();
|
|
67
|
+
});
|
|
68
|
+
test("Footer renders with children in mobile", function () {
|
|
69
|
+
//425 is mobile width
|
|
70
|
+
Object.defineProperty(HTMLElement.prototype, "offsetWidth", {
|
|
71
|
+
configurable: true,
|
|
72
|
+
value: 425
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], null, /*#__PURE__*/_react["default"].createElement("p", null, "footer-child-text"))),
|
|
76
|
+
queryByText = _render6.queryByText;
|
|
77
|
+
|
|
78
|
+
expect(queryByText("footer-child-text")).toBeTruthy();
|
|
79
|
+
});
|
|
80
|
+
test("Footer is fully rendered", function () {
|
|
81
|
+
Object.defineProperty(HTMLElement.prototype, "offsetWidth", {
|
|
82
|
+
configurable: true,
|
|
83
|
+
value: 1024
|
|
84
|
+
});
|
|
85
|
+
var social = [{
|
|
86
|
+
href: "https://www.test.com/social",
|
|
87
|
+
logo: _linkedin["default"]
|
|
88
|
+
}];
|
|
89
|
+
var bottom = [{
|
|
90
|
+
href: "https://www.test.com/bottom",
|
|
91
|
+
text: "bottom-link-text"
|
|
92
|
+
}];
|
|
93
|
+
|
|
94
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], {
|
|
95
|
+
socialLinks: social,
|
|
96
|
+
bottomLinks: bottom,
|
|
97
|
+
copyright: "test-copyright"
|
|
98
|
+
}, /*#__PURE__*/_react["default"].createElement("p", null, "footer-child-text"))),
|
|
99
|
+
getAllByRole = _render7.getAllByRole,
|
|
100
|
+
getByText = _render7.getByText;
|
|
101
|
+
|
|
102
|
+
var socialIcon = getAllByRole("link")[0];
|
|
103
|
+
expect(socialIcon.getAttribute("href")).toBe("https://www.test.com/social");
|
|
104
|
+
var bottomLink = getByText("bottom-link-text");
|
|
105
|
+
expect(bottomLink.getAttribute("href")).toBe("https://www.test.com/bottom");
|
|
106
|
+
expect(getByText("test-copyright")).toBeTruthy();
|
|
107
|
+
expect(getByText("footer-child-text")).toBeTruthy();
|
|
108
|
+
});
|
|
109
|
+
});
|
package/footer/Icons.js
CHANGED
|
@@ -5,14 +5,14 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports
|
|
8
|
+
exports.dxcLogo = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var dxcLogo = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
13
13
|
id: "g10",
|
|
14
14
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
-
width: "
|
|
15
|
+
width: "100%",
|
|
16
16
|
height: "32",
|
|
17
17
|
viewBox: "0 0 280.781 32"
|
|
18
18
|
}, /*#__PURE__*/_react["default"].createElement("title", null, "DXC Logo"), /*#__PURE__*/_react["default"].createElement("g", {
|
|
@@ -74,4 +74,4 @@ var _default = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
|
74
74
|
fill: "#fff"
|
|
75
75
|
})));
|
|
76
76
|
|
|
77
|
-
exports
|
|
77
|
+
exports.dxcLogo = dxcLogo;
|
package/footer/types.d.ts
CHANGED
|
@@ -6,34 +6,38 @@ declare type Size = {
|
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
+
declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
9
10
|
declare type SocialLink = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Element used as the icon for the link.
|
|
13
|
+
*/
|
|
14
|
+
logo: string | SVG;
|
|
15
|
+
/**
|
|
16
|
+
* URL of the page the link goes to.
|
|
17
|
+
*/
|
|
18
|
+
href: string;
|
|
13
19
|
};
|
|
14
20
|
declare type BottomLink = {
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Text for the link.
|
|
23
|
+
*/
|
|
24
|
+
text: string;
|
|
25
|
+
/**
|
|
26
|
+
* URL of the page the link goes to.
|
|
27
|
+
*/
|
|
28
|
+
href: string;
|
|
17
29
|
};
|
|
18
|
-
declare type ImgElement = HTMLElement & (SVGElement | HTMLImageElement);
|
|
19
30
|
declare type FooterPropsType = {
|
|
20
31
|
/**
|
|
21
32
|
* An array of objects representing the links that will be rendered as
|
|
22
|
-
* icons at the top-right side of the footer.
|
|
23
|
-
* following properties:
|
|
24
|
-
* - logo: Element used as the icon for the link.
|
|
25
|
-
* - logoSrc: The path of an icon for the link. @deprecated
|
|
26
|
-
* - href: URL of the page the link goes to.
|
|
33
|
+
* icons at the top-right side of the footer.
|
|
27
34
|
*/
|
|
28
|
-
socialLinks?:
|
|
35
|
+
socialLinks?: SocialLink[];
|
|
29
36
|
/**
|
|
30
37
|
* An array of objects representing the links that will be rendered at
|
|
31
|
-
* the bottom part of the footer.
|
|
32
|
-
* properties:
|
|
33
|
-
* - text: Text for the link.
|
|
34
|
-
* - href: URL of the page the link goes to.
|
|
38
|
+
* the bottom part of the footer.
|
|
35
39
|
*/
|
|
36
|
-
bottomLinks?:
|
|
40
|
+
bottomLinks?: BottomLink[];
|
|
37
41
|
/**
|
|
38
42
|
* The center section of the footer. Can be used to render custom
|
|
39
43
|
* content in this area.
|