@comicrelief/component-library 8.48.2 → 8.49.0
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/dist/components/Atoms/Button/Button.js +15 -42
- package/dist/components/Atoms/Button/Button.md +91 -1
- package/dist/components/Atoms/Button/Button.style.js +47 -0
- package/dist/components/Atoms/Button/Button.test.js +40 -12
- package/dist/components/Atoms/ButtonWithStates/ButtonWithStates.js +1 -1
- package/dist/components/Atoms/Link/Link.js +8 -5
- package/dist/components/Atoms/Link/Link.md +81 -78
- package/dist/components/Atoms/Link/Link.style.js +22 -18
- package/dist/components/Atoms/Link/Link.test.js +20 -19
- package/dist/components/Molecules/CardDs/CardDs.md +3 -3
- package/dist/components/Molecules/CardDs/CardDs.test.js +1 -1
- package/dist/components/Molecules/CardDs/__snapshots__/CardDs.test.js.snap +43 -41
- package/dist/components/Molecules/Lookup/Lookup.js +9 -16
- package/dist/components/Molecules/Promo/__snapshots__/Promo.test.js.snap +42 -40
- package/dist/components/Molecules/SingleMessage/__snapshots__/SingleMessage.test.js.snap +42 -40
- package/dist/components/Molecules/SingleMessageDS/__snapshots__/SingleMessageDs.test.js.snap +20 -19
- package/dist/components/Organisms/CookieBanner/CookieBanner.test.js +21 -20
- package/dist/components/Organisms/EmailSignUp/_EmailSignUp.js +1 -1
- package/dist/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +41 -17
- package/dist/components/Organisms/FooterNew/__snapshots__/FooterNew.test.js.snap +39 -12
- package/dist/components/Organisms/Header2025/Header2025.style.js +1 -1
- package/dist/components/Organisms/Header2025/HeaderNav2025/HeaderNav2025.style.js +1 -1
- package/dist/theme/crTheme/buttonColors.js +84 -72
- package/dist/theme/crTheme/buttonTypes.js +12 -0
- package/dist/theme/crTheme/colors.js +13 -1
- package/dist/theme/crTheme/fontConfig.js +3 -4
- package/dist/theme/crTheme/theme.js +2 -0
- package/package.json +1 -1
- package/playwright/components/organisms/emailSignUpForm.spec.js +1 -1
- package/src/components/Atoms/Button/Button.js +18 -36
- package/src/components/Atoms/Button/Button.md +91 -1
- package/src/components/Atoms/Button/Button.style.js +37 -0
- package/src/components/Atoms/Button/Button.test.js +44 -16
- package/src/components/Atoms/ButtonWithStates/ButtonWithStates.js +1 -1
- package/src/components/Atoms/Link/Link.js +15 -5
- package/src/components/Atoms/Link/Link.md +81 -78
- package/src/components/Atoms/Link/Link.style.js +32 -27
- package/src/components/Atoms/Link/Link.test.js +20 -19
- package/src/components/Molecules/CardDs/CardDs.md +3 -3
- package/src/components/Molecules/CardDs/CardDs.test.js +1 -1
- package/src/components/Molecules/CardDs/__snapshots__/CardDs.test.js.snap +43 -41
- package/src/components/Molecules/Lookup/Lookup.js +4 -15
- package/src/components/Molecules/Promo/__snapshots__/Promo.test.js.snap +42 -40
- package/src/components/Molecules/SingleMessage/__snapshots__/SingleMessage.test.js.snap +42 -40
- package/src/components/Molecules/SingleMessageDS/__snapshots__/SingleMessageDs.test.js.snap +20 -19
- package/src/components/Organisms/CookieBanner/CookieBanner.test.js +21 -20
- package/src/components/Organisms/EmailSignUp/_EmailSignUp.js +1 -1
- package/src/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +41 -17
- package/src/components/Organisms/FooterNew/__snapshots__/FooterNew.test.js.snap +39 -12
- package/src/components/Organisms/Header2025/Header2025.style.js +2 -1
- package/src/components/Organisms/Header2025/HeaderNav2025/HeaderNav2025.style.js +1 -1
- package/src/theme/crTheme/buttonColors.js +116 -76
- package/src/theme/crTheme/buttonTypes.js +7 -0
- package/src/theme/crTheme/colors.js +14 -1
- package/src/theme/crTheme/fontConfig.js +3 -4
- package/src/theme/crTheme/theme.js +3 -0
|
@@ -7,60 +7,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
const
|
|
13
|
-
displayName: "Button__StyledButton",
|
|
14
|
-
componentId: "sc-1gm5vj0-0"
|
|
15
|
-
})(["display:inline-flex;position:relative;padding:0.5rem 1.25rem;text-decoration:none;font-weight:700;font-size:", ";border-radius:2rem;transition:all 0.3s;height:3.125rem;width:100%;justify-content:center;align-items:center;border:none;cursor:pointer;> a{text-decoration:none;}", ";@media ", "{width:", ";}@media ", "{width:", ";padding:", " ", ";margin:0 auto ", ";}"], _ref => {
|
|
16
|
-
let {
|
|
17
|
-
theme
|
|
18
|
-
} = _ref;
|
|
19
|
-
return theme.fontSize('s');
|
|
20
|
-
}, _ref2 => {
|
|
21
|
-
let {
|
|
22
|
-
color,
|
|
23
|
-
theme
|
|
24
|
-
} = _ref2;
|
|
25
|
-
return color ? theme.buttonColors(color) : theme.buttonColors('red');
|
|
26
|
-
}, _ref3 => {
|
|
27
|
-
let {
|
|
28
|
-
theme
|
|
29
|
-
} = _ref3;
|
|
30
|
-
return theme.allBreakpoints('M');
|
|
31
|
-
}, _ref4 => {
|
|
32
|
-
let {
|
|
33
|
-
fullWidth
|
|
34
|
-
} = _ref4;
|
|
35
|
-
return fullWidth ? '100%' : 'auto';
|
|
36
|
-
}, _ref5 => {
|
|
37
|
-
let {
|
|
38
|
-
theme
|
|
39
|
-
} = _ref5;
|
|
40
|
-
return theme.allBreakpoints('L');
|
|
41
|
-
}, _ref6 => {
|
|
42
|
-
let {
|
|
43
|
-
fullWidth
|
|
44
|
-
} = _ref6;
|
|
45
|
-
return fullWidth ? '100%' : 'auto';
|
|
46
|
-
}, (0, _spacing.default)('md'), (0, _spacing.default)('l'), (0, _spacing.default)('l'));
|
|
47
|
-
const Button = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
|
|
10
|
+
var _Button = _interopRequireDefault(require("./Button.style"));
|
|
11
|
+
var _buttonTypes = _interopRequireDefault(require("../../../theme/crTheme/buttonTypes"));
|
|
12
|
+
const Button = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
48
13
|
let {
|
|
49
14
|
children,
|
|
15
|
+
color = 'red',
|
|
50
16
|
wrapper = false,
|
|
51
17
|
fullWidth = false,
|
|
18
|
+
buttonType = _buttonTypes.default.PRIMARY,
|
|
52
19
|
...rest
|
|
53
|
-
} =
|
|
54
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
20
|
+
} = _ref;
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement(_Button.default, Object.assign({}, rest, {
|
|
55
22
|
as: wrapper ? 'span' : 'button',
|
|
56
23
|
ref: ref,
|
|
57
|
-
fullWidth: fullWidth
|
|
24
|
+
fullWidth: fullWidth,
|
|
25
|
+
color: color,
|
|
26
|
+
buttonType: buttonType
|
|
58
27
|
}), children);
|
|
59
28
|
});
|
|
60
29
|
Button.propTypes = {
|
|
61
30
|
children: _propTypes.default.node.isRequired,
|
|
62
31
|
wrapper: _propTypes.default.bool,
|
|
63
32
|
// Buttons as span
|
|
64
|
-
fullWidth: _propTypes.default.bool
|
|
33
|
+
fullWidth: _propTypes.default.bool,
|
|
34
|
+
color: _propTypes.default.string,
|
|
35
|
+
// Primary will the default for the vast majority of contexts; with
|
|
36
|
+
// Secondary and Tertirary being manually set by developers where required
|
|
37
|
+
buttonType: _propTypes.default.oneOf([_buttonTypes.default.PRIMARY, _buttonTypes.default.SECONDARY, _buttonTypes.default.TERTIARY])
|
|
65
38
|
};
|
|
66
39
|
var _default = exports.default = Button;
|
|
@@ -1,5 +1,95 @@
|
|
|
1
1
|
```js
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import buttonTypes from '../../../theme/crTheme/buttonTypes';
|
|
4
|
+
|
|
5
|
+
<>
|
|
6
|
+
<h1>Primary</h1>
|
|
7
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
8
|
+
<Button type="button">Primary red button (default)</Button>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
12
|
+
<Button type="button" disabled>Primary red button (default): disabled</Button>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
16
|
+
<Button type="button" color="black">Primary black button</Button>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
20
|
+
<Button type="button" color="black" disabled>Primary black button: disabled</Button>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
24
|
+
<Button type="button" color="white">Primary white button</Button>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
28
|
+
<Button type="button" color="white" disabled>Primary white button: disabled</Button>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
32
|
+
<Button type="button" color="non-existent-colour">Using a non-existent colour will default to red</Button>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<br/>
|
|
36
|
+
<h1>Secondary</h1>
|
|
37
|
+
|
|
38
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px", borderRadius: "5px"}}>
|
|
39
|
+
<Button type="button" buttonType={buttonTypes.SECONDARY}>Secondary red button</Button>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
43
|
+
<Button type="button" buttonType={buttonTypes.SECONDARY} disabled>Secondary red button: disabled</Button>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
47
|
+
<Button type="button" color="black" buttonType={buttonTypes.SECONDARY}>Secondary black button</Button>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
51
|
+
<Button type="button" color="black" buttonType={buttonTypes.SECONDARY} disabled>Secondary black button: disabled</Button>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
56
|
+
<Button type="button" color="white" buttonType={buttonTypes.SECONDARY} buttonType={buttonTypes.SECONDARY}>Secondary white button</Button>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
60
|
+
<Button type="button" color="white" buttonType={buttonTypes.SECONDARY} disabled>Secondary white button: disabled</Button>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<br/>
|
|
64
|
+
<h1>Teritary</h1>
|
|
65
|
+
|
|
66
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
67
|
+
<Button type="button" buttonType={buttonTypes.TERTIARY}>Tertiary red button</Button>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
71
|
+
<Button type="button" buttonType={buttonTypes.TERTIARY} disabled>Tertiary red button: disabled</Button>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
75
|
+
<Button type="button" color="black" buttonType={buttonTypes.TERTIARY}>Tertiary black button</Button>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
79
|
+
<Button type="button" color="black" buttonType={buttonTypes.TERTIARY} disabled>Tertiary black button: disabled</Button>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
84
|
+
<Button type="button" color="white" buttonType={buttonTypes.TERTIARY} buttonType={buttonTypes.TERTIARY}>Tertiary white button</Button>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
88
|
+
<Button type="button" color="white" buttonType={buttonTypes.TERTIARY} disabled>Tertiary white button: disabled</Button>
|
|
89
|
+
</div>
|
|
90
|
+
</>
|
|
91
|
+
|
|
92
|
+
|
|
3
93
|
```
|
|
4
94
|
|
|
5
95
|
```js
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
10
|
+
var _fontHelper = _interopRequireDefault(require("../../../theme/crTheme/fontHelper"));
|
|
11
|
+
const StyledButton = _styledComponents.default.button.withConfig({
|
|
12
|
+
displayName: "Buttonstyle__StyledButton",
|
|
13
|
+
componentId: "sc-k17brs-0"
|
|
14
|
+
})(["display:inline-flex;position:relative;text-decoration:none;transition:all 0.2s;min-height:2.5rem;width:100%;justify-content:center;align-items:center;border:none;cursor:pointer;padding:0.6rem 1rem;border-radius:0.5rem;> a{text-decoration:none;}", ";", " @media ", "{width:", ";}@media ", "{width:", ";}"], _ref => {
|
|
15
|
+
let {
|
|
16
|
+
color,
|
|
17
|
+
theme,
|
|
18
|
+
buttonType
|
|
19
|
+
} = _ref;
|
|
20
|
+
return theme.buttonColors(color, buttonType);
|
|
21
|
+
}, _ref2 => {
|
|
22
|
+
let {
|
|
23
|
+
theme
|
|
24
|
+
} = _ref2;
|
|
25
|
+
return (0, _styledComponents.css)(["", ""], (0, _fontHelper.default)(theme, 'button'));
|
|
26
|
+
}, _ref3 => {
|
|
27
|
+
let {
|
|
28
|
+
theme
|
|
29
|
+
} = _ref3;
|
|
30
|
+
return theme.allBreakpoints('M');
|
|
31
|
+
}, _ref4 => {
|
|
32
|
+
let {
|
|
33
|
+
fullWidth
|
|
34
|
+
} = _ref4;
|
|
35
|
+
return fullWidth ? '100%' : 'auto';
|
|
36
|
+
}, _ref5 => {
|
|
37
|
+
let {
|
|
38
|
+
theme
|
|
39
|
+
} = _ref5;
|
|
40
|
+
return theme.allBreakpoints('L');
|
|
41
|
+
}, _ref6 => {
|
|
42
|
+
let {
|
|
43
|
+
fullWidth
|
|
44
|
+
} = _ref6;
|
|
45
|
+
return fullWidth ? '100%' : 'auto';
|
|
46
|
+
});
|
|
47
|
+
var _default = exports.default = StyledButton;
|
|
@@ -5,7 +5,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
5
5
|
require("jest-styled-components");
|
|
6
6
|
var _shallowWithTheme = _interopRequireDefault(require("../../../../tests/hoc/shallowWithTheme"));
|
|
7
7
|
var _Button = _interopRequireDefault(require("./Button"));
|
|
8
|
-
it(
|
|
8
|
+
it('renders a standard styled link correctly', () => {
|
|
9
9
|
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
10
10
|
type: "submit"
|
|
11
11
|
}, "A standard link")).toJSON();
|
|
@@ -16,15 +16,11 @@ it("renders a standard styled link correctly", () => {
|
|
|
16
16
|
display: -ms-inline-flexbox;
|
|
17
17
|
display: inline-flex;
|
|
18
18
|
position: relative;
|
|
19
|
-
padding: 0.5rem 1.25rem;
|
|
20
19
|
-webkit-text-decoration: none;
|
|
21
20
|
text-decoration: none;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
-webkit-transition: all 0.3s;
|
|
26
|
-
transition: all 0.3s;
|
|
27
|
-
height: 3.125rem;
|
|
21
|
+
-webkit-transition: all 0.2s;
|
|
22
|
+
transition: all 0.2s;
|
|
23
|
+
min-height: 2.5rem;
|
|
28
24
|
width: 100%;
|
|
29
25
|
-webkit-box-pack: center;
|
|
30
26
|
-webkit-justify-content: center;
|
|
@@ -36,8 +32,19 @@ it("renders a standard styled link correctly", () => {
|
|
|
36
32
|
align-items: center;
|
|
37
33
|
border: none;
|
|
38
34
|
cursor: pointer;
|
|
35
|
+
padding: 0.6rem 1rem;
|
|
36
|
+
border-radius: 0.5rem;
|
|
39
37
|
background-color: #E52630;
|
|
40
38
|
color: #FFFFFF;
|
|
39
|
+
font-family: 'Montserrat',Helvetica,Arial,sans-serif;
|
|
40
|
+
font-weight: 700;
|
|
41
|
+
text-transform: inherit;
|
|
42
|
+
-webkit-letter-spacing: 0;
|
|
43
|
+
-moz-letter-spacing: 0;
|
|
44
|
+
-ms-letter-spacing: 0;
|
|
45
|
+
letter-spacing: 0;
|
|
46
|
+
font-size: 1rem;
|
|
47
|
+
line-height: 1.25rem;
|
|
41
48
|
}
|
|
42
49
|
|
|
43
50
|
.c0 > a {
|
|
@@ -45,9 +52,31 @@ it("renders a standard styled link correctly", () => {
|
|
|
45
52
|
text-decoration: none;
|
|
46
53
|
}
|
|
47
54
|
|
|
48
|
-
.c0:hover
|
|
55
|
+
.c0:hover,
|
|
56
|
+
.c0:focus,
|
|
57
|
+
.c0:focus-within,
|
|
58
|
+
.c0:focus-visible {
|
|
49
59
|
background-color: #890B11;
|
|
50
|
-
|
|
60
|
+
outline-offset: 3px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.c0:disabled {
|
|
64
|
+
cursor: not-allowed;
|
|
65
|
+
opacity: 0.5;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@media (min-width:740px) {
|
|
69
|
+
.c0 {
|
|
70
|
+
font-size: 1rem;
|
|
71
|
+
line-height: 1.25rem;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@media (min-width:1024px) {
|
|
76
|
+
.c0 {
|
|
77
|
+
font-size: 1.125rem;
|
|
78
|
+
line-height: 1.375rem;
|
|
79
|
+
}
|
|
51
80
|
}
|
|
52
81
|
|
|
53
82
|
@media (min-width:740px) {
|
|
@@ -59,13 +88,12 @@ it("renders a standard styled link correctly", () => {
|
|
|
59
88
|
@media (min-width:1024px) {
|
|
60
89
|
.c0 {
|
|
61
90
|
width: auto;
|
|
62
|
-
padding: 1rem 2rem;
|
|
63
|
-
margin: 0 auto 2rem;
|
|
64
91
|
}
|
|
65
92
|
}
|
|
66
93
|
|
|
67
94
|
<button
|
|
68
95
|
className="c0"
|
|
96
|
+
color="red"
|
|
69
97
|
type="submit"
|
|
70
98
|
>
|
|
71
99
|
A standard link
|
|
@@ -14,7 +14,7 @@ var _Button = _interopRequireDefault(require("../Button/Button"));
|
|
|
14
14
|
const ButtonWithDisabledState = (0, _styledComponents.default)(_Button.default).withConfig({
|
|
15
15
|
displayName: "ButtonWithStates__ButtonWithDisabledState",
|
|
16
16
|
componentId: "sc-7gb81g-0"
|
|
17
|
-
})(["&:disabled{cursor:not-allowed;opacity:0.
|
|
17
|
+
})(["&:disabled{cursor:not-allowed;opacity:0.5;}"]);
|
|
18
18
|
const LoaderContainer = _styledComponents.default.div.withConfig({
|
|
19
19
|
displayName: "ButtonWithStates__LoaderContainer",
|
|
20
20
|
componentId: "sc-7gb81g-1"
|
|
@@ -10,20 +10,22 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _Link = _interopRequireWildcard(require("./Link.style"));
|
|
11
11
|
var _allowListed = _interopRequireDefault(require("../../../utils/allowListed"));
|
|
12
12
|
var _internalLinkHelper = require("../../../utils/internalLinkHelper");
|
|
13
|
+
var _buttonTypes = _interopRequireDefault(require("../../../theme/crTheme/buttonTypes"));
|
|
13
14
|
let window = '';
|
|
14
15
|
const Link = _ref => {
|
|
15
16
|
let {
|
|
17
|
+
href,
|
|
16
18
|
children,
|
|
17
19
|
color = 'red',
|
|
18
|
-
mobileColour = null,
|
|
19
|
-
href,
|
|
20
|
-
target = null,
|
|
21
20
|
type = 'standard',
|
|
22
21
|
home = false,
|
|
23
22
|
underline = true,
|
|
24
|
-
icon = null,
|
|
25
23
|
iconFirst = false,
|
|
26
24
|
fullWidth = false,
|
|
25
|
+
buttonType = _buttonTypes.default.PRIMARY,
|
|
26
|
+
target = null,
|
|
27
|
+
mobileColour = null,
|
|
28
|
+
icon = null,
|
|
27
29
|
...rest
|
|
28
30
|
} = _ref;
|
|
29
31
|
const [documentHost, setDocumentHost] = (0, _react.useState)('');
|
|
@@ -63,7 +65,8 @@ const Link = _ref => {
|
|
|
63
65
|
home: home,
|
|
64
66
|
iconFirst: iconFirst,
|
|
65
67
|
underline: underline,
|
|
66
|
-
fullWidth: fullWidth
|
|
68
|
+
fullWidth: fullWidth,
|
|
69
|
+
buttonType: buttonType
|
|
67
70
|
}), children, window === '_blank' && /*#__PURE__*/_react.default.createElement(_Link.HelperText, null, "(opens in new window)"), hasIcon && /*#__PURE__*/_react.default.createElement(_Link.IconWrapper, {
|
|
68
71
|
type: type
|
|
69
72
|
}, icon));
|
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
```js
|
|
2
2
|
import { External, Download, Favourite, Internal } from '../Icons/index';
|
|
3
|
+
|
|
3
4
|
<div>
|
|
4
|
-
<div style={{
|
|
5
|
-
<Link href="#anchor" target="blank"
|
|
5
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
6
|
+
<Link href="#anchor" target="blank">
|
|
6
7
|
Link standard
|
|
7
8
|
</Link>
|
|
8
9
|
</div>
|
|
9
|
-
<div style={{
|
|
10
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
10
11
|
<Link
|
|
11
12
|
href="#anchor"
|
|
12
13
|
target="blank"
|
|
13
|
-
type="standard"
|
|
14
14
|
icon={<Download colour="black" />}
|
|
15
15
|
>
|
|
16
16
|
Link standard icon
|
|
17
17
|
</Link>
|
|
18
18
|
</div>
|
|
19
19
|
<div
|
|
20
|
-
style={{
|
|
21
|
-
display: 'block',
|
|
22
|
-
padding: '10px',
|
|
23
|
-
marginBottom: '10px',
|
|
24
|
-
backgroundColor: '#000'
|
|
25
|
-
}}
|
|
20
|
+
style={{backgroundColor:"#000", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}
|
|
26
21
|
>
|
|
27
22
|
<Link href="#anchor" type="standard_white">
|
|
28
23
|
Link standard white
|
|
@@ -31,13 +26,78 @@ import { External, Download, Favourite, Internal } from '../Icons/index';
|
|
|
31
26
|
</div>;
|
|
32
27
|
```
|
|
33
28
|
|
|
34
|
-
|
|
29
|
+
```js
|
|
30
|
+
|
|
31
|
+
import buttonTypes from '../../../theme/crTheme/buttonTypes';
|
|
32
|
+
|
|
33
|
+
<div>
|
|
34
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
35
|
+
<Link color="black" href="#anchor" target="self" type="button">
|
|
36
|
+
Link as button
|
|
37
|
+
</Link>
|
|
38
|
+
</div>
|
|
39
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
40
|
+
<Link color="red" href="/test" target="self" type="button">
|
|
41
|
+
Link as button
|
|
42
|
+
</Link>
|
|
43
|
+
</div>
|
|
44
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
45
|
+
<Link color="yellow" href="/test" target="blank" type="button">
|
|
46
|
+
Link as button
|
|
47
|
+
</Link>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
52
|
+
<Link color="red" href="#anchor" target="self" type="button" buttonType={buttonTypes.SECONDARY}>
|
|
53
|
+
Link as button (secondary)
|
|
54
|
+
</Link>
|
|
55
|
+
</div>
|
|
56
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
57
|
+
<Link color="black" href="/test" target="self" type="button"buttonType={buttonTypes.SECONDARY}>
|
|
58
|
+
Link as button (secondary)
|
|
59
|
+
</Link>
|
|
60
|
+
</div>
|
|
61
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
62
|
+
<Link color="white" href="/test" target="blank" type="button" buttonType={buttonTypes.SECONDARY}>
|
|
63
|
+
Link as button (secondary)
|
|
64
|
+
</Link>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
68
|
+
<Link color="red" href="#anchor" target="self" type="button" buttonType={buttonTypes.TERTIARY}>
|
|
69
|
+
Link as button (tertiary)
|
|
70
|
+
</Link>
|
|
71
|
+
</div>
|
|
72
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
73
|
+
<Link color="black" href="/test" target="self" type="button"buttonType={buttonTypes.TERTIARY}>
|
|
74
|
+
Link as button (tertiary)
|
|
75
|
+
</Link>
|
|
76
|
+
</div>
|
|
77
|
+
<div style={{backgroundColor:"#222222", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
78
|
+
<Link color="white" href="/test" target="blank" type="button" buttonType={buttonTypes.TERTIARY}>
|
|
79
|
+
Link as button (tertiary)
|
|
80
|
+
</Link>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
84
|
+
|
|
85
|
+
<div style={{ display: 'block', marginTop: '10px' }}>
|
|
86
|
+
<Link color="red" href="/test" target="blank" type="button" fullWidth>
|
|
87
|
+
Link as full-width red button
|
|
88
|
+
</Link>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
```
|
|
93
|
+
|
|
35
94
|
|
|
95
|
+
## Iconography
|
|
36
96
|
```js
|
|
37
97
|
import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from '../Icons/index';
|
|
38
98
|
|
|
39
99
|
<div>
|
|
40
|
-
<div style={{
|
|
100
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
41
101
|
<Link
|
|
42
102
|
color="red"
|
|
43
103
|
mobileColour="blue"
|
|
@@ -50,7 +110,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
50
110
|
</Link>
|
|
51
111
|
</div>
|
|
52
112
|
|
|
53
|
-
<div style={{
|
|
113
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
54
114
|
<Link
|
|
55
115
|
color="blue"
|
|
56
116
|
mobileColour="black"
|
|
@@ -63,7 +123,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
63
123
|
</Link>
|
|
64
124
|
</div>
|
|
65
125
|
|
|
66
|
-
<div style={{
|
|
126
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
67
127
|
<Link
|
|
68
128
|
color="red"
|
|
69
129
|
href="#anchor"
|
|
@@ -75,7 +135,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
75
135
|
</Link>
|
|
76
136
|
</div>
|
|
77
137
|
|
|
78
|
-
<div style={{
|
|
138
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
79
139
|
<Link
|
|
80
140
|
color="red"
|
|
81
141
|
href="#anchor"
|
|
@@ -87,7 +147,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
87
147
|
</Link>
|
|
88
148
|
</div>
|
|
89
149
|
|
|
90
|
-
<div style={{
|
|
150
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
91
151
|
<Link
|
|
92
152
|
color="red"
|
|
93
153
|
href="#anchor"
|
|
@@ -99,7 +159,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
99
159
|
</Link>
|
|
100
160
|
</div>
|
|
101
161
|
|
|
102
|
-
<div style={{
|
|
162
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
103
163
|
<Link
|
|
104
164
|
color="red"
|
|
105
165
|
href="#anchor"
|
|
@@ -111,7 +171,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
111
171
|
</Link>
|
|
112
172
|
</div>
|
|
113
173
|
|
|
114
|
-
<div style={{
|
|
174
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
115
175
|
<Link
|
|
116
176
|
color="red"
|
|
117
177
|
href="#anchor"
|
|
@@ -123,7 +183,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
123
183
|
</Link>
|
|
124
184
|
</div>
|
|
125
185
|
|
|
126
|
-
<div style={{
|
|
186
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
127
187
|
<Link
|
|
128
188
|
color="red"
|
|
129
189
|
href="#anchor"
|
|
@@ -135,7 +195,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
135
195
|
</Link>
|
|
136
196
|
</div>
|
|
137
197
|
|
|
138
|
-
<div style={{
|
|
198
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
139
199
|
<Link
|
|
140
200
|
color="red"
|
|
141
201
|
href="#anchor"
|
|
@@ -148,7 +208,7 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
148
208
|
</Link>
|
|
149
209
|
</div>
|
|
150
210
|
|
|
151
|
-
<div style={{
|
|
211
|
+
<div style={{backgroundColor:"#ddd", padding: "15px", marginBottom: "10px", borderRadius: "5px"}}>
|
|
152
212
|
<Link
|
|
153
213
|
color="red"
|
|
154
214
|
href="#anchor"
|
|
@@ -161,60 +221,3 @@ import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from
|
|
|
161
221
|
</div>
|
|
162
222
|
</div>;
|
|
163
223
|
```
|
|
164
|
-
|
|
165
|
-
```js
|
|
166
|
-
<div>
|
|
167
|
-
<div style={{ display: 'block', marginBottom: '10px' }}>
|
|
168
|
-
<Link color="black" href="#anchor" target="self" type="button">
|
|
169
|
-
Link as button
|
|
170
|
-
</Link>
|
|
171
|
-
</div>
|
|
172
|
-
<div style={{ display: 'block', marginBottom: '10px' }}>
|
|
173
|
-
<Link color="red" href="/test" target="self" type="button">
|
|
174
|
-
Link as button
|
|
175
|
-
</Link>
|
|
176
|
-
</div>
|
|
177
|
-
<div style={{ display: 'block', marginBottom: '10px' }}>
|
|
178
|
-
<Link color="yellow" href="/test" target="blank" type="button">
|
|
179
|
-
Link as button
|
|
180
|
-
</Link>
|
|
181
|
-
</div>
|
|
182
|
-
<div style={{ display: 'block', marginBottom: '10px' }}>
|
|
183
|
-
<Link color="yellow_light" href="/test" target="blank" type="button">
|
|
184
|
-
Link as button
|
|
185
|
-
</Link>
|
|
186
|
-
</div>
|
|
187
|
-
<div style={{ display: 'block', marginBottom: '10px' }}>
|
|
188
|
-
<Link color="yellow_dark" href="/test" target="blank" type="button">
|
|
189
|
-
Link as button
|
|
190
|
-
</Link>
|
|
191
|
-
</div>
|
|
192
|
-
<div
|
|
193
|
-
style={{
|
|
194
|
-
display: 'block',
|
|
195
|
-
padding: '10px',
|
|
196
|
-
marginBottom: '10px',
|
|
197
|
-
backgroundColor: '#22CFD8'
|
|
198
|
-
}}
|
|
199
|
-
>
|
|
200
|
-
<div style={{ display: 'block', marginBottom: '10px' }}>
|
|
201
|
-
<Link color="grey" href="/test" target="blank" type="button">
|
|
202
|
-
Link as button
|
|
203
|
-
</Link>
|
|
204
|
-
</div>
|
|
205
|
-
<Link color="transparent" href="/test" target="blank" type="button">
|
|
206
|
-
Link as transparent button
|
|
207
|
-
</Link>
|
|
208
|
-
<div style={{ display: 'block', marginTop: '10px' }}>
|
|
209
|
-
<Link color="white" href="/test" target="blank" type="button">
|
|
210
|
-
White button
|
|
211
|
-
</Link>
|
|
212
|
-
</div>
|
|
213
|
-
<div style={{ display: 'block', marginTop: '10px' }}>
|
|
214
|
-
<Link color="red" href="/test" target="blank" type="button" fullWidth>
|
|
215
|
-
Full-width red button
|
|
216
|
-
</Link>
|
|
217
|
-
</div>
|
|
218
|
-
</div>
|
|
219
|
-
</div>
|
|
220
|
-
```
|