@comicrelief/component-library 8.7.0 → 8.9.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.
@@ -12,7 +12,7 @@ var _spacing = _interopRequireDefault(require("../../../theme/shared/spacing"));
12
12
  const StyledButton = _styledComponents.default.button.withConfig({
13
13
  displayName: "Button__StyledButton",
14
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:auto;}@media ", "{width:auto;padding:", " ", ";margin:0 auto ", ";}"], _ref => {
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
16
  let {
17
17
  theme
18
18
  } = _ref;
@@ -30,23 +30,37 @@ const StyledButton = _styledComponents.default.button.withConfig({
30
30
  return theme.allBreakpoints('M');
31
31
  }, _ref4 => {
32
32
  let {
33
- theme
33
+ fullWidth
34
34
  } = _ref4;
35
+ return fullWidth ? '100%' : 'auto';
36
+ }, _ref5 => {
37
+ let {
38
+ theme
39
+ } = _ref5;
35
40
  return theme.allBreakpoints('L');
41
+ }, _ref6 => {
42
+ let {
43
+ fullWidth
44
+ } = _ref6;
45
+ return fullWidth ? '100%' : 'auto';
36
46
  }, (0, _spacing.default)('md'), (0, _spacing.default)('l'), (0, _spacing.default)('l'));
37
- const Button = /*#__PURE__*/_react.default.forwardRef((_ref5, ref) => {
47
+ const Button = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
38
48
  let {
39
49
  children,
40
50
  wrapper = false,
51
+ fullWidth = false,
41
52
  ...rest
42
- } = _ref5;
53
+ } = _ref7;
43
54
  return /*#__PURE__*/_react.default.createElement(StyledButton, Object.assign({}, rest, {
44
55
  as: wrapper ? 'span' : 'button',
45
- ref: ref
56
+ ref: ref,
57
+ fullWidth: fullWidth
46
58
  }), children);
47
59
  });
48
60
  Button.propTypes = {
49
61
  children: _propTypes.default.node.isRequired,
50
- wrapper: _propTypes.default.bool // Buttons as span
62
+ wrapper: _propTypes.default.bool,
63
+ // Buttons as span
64
+ fullWidth: _propTypes.default.bool
51
65
  };
52
66
  var _default = exports.default = Button;
@@ -5,3 +5,7 @@
5
5
  ```js
6
6
  <Button wrapper>My button as a span</Button>
7
7
  ```
8
+
9
+ ```js
10
+ <Button type="button" fullWidth>Full-width button</Button>
11
+ ```
@@ -26,14 +26,21 @@ const colors = {
26
26
  green: '#49D267',
27
27
  green_dark: '#1B651D',
28
28
  green_light: '#F4F2F4',
29
- grey: '#969598',
30
- grey_dark: '#222222',
31
29
  grey_stone: '#CEDCDA',
32
30
  grey_extra_light: '#f0f0f0',
33
31
  grey_for_forms: '#666',
34
32
  grey_label: '#5C5C5E',
33
+ // this is the Curtis approved list of 5 greys that will be later numbered grey_1 thru grey_5
34
+ // grey_1
35
35
  grey_light: '#F4F3F5',
36
+ // grey_2
36
37
  grey_medium: '#E1E2E3',
38
+ // grey_3
39
+ grey: '#969598',
40
+ // grey_4
41
+ grey_4: '#6E6E6E',
42
+ // grey_5
43
+ grey_dark: '#222222',
37
44
  magenta: '#FC59CE',
38
45
  magenta_dark: '#821C5D',
39
46
  magenta_light: '#FEB4DC',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comicrelief/component-library",
3
3
  "author": "Comic Relief Engineering Team",
4
- "version": "8.7.0",
4
+ "version": "8.9.0",
5
5
  "main": "dist/index.js",
6
6
  "license": "ISC",
7
7
  "jest": {
@@ -22,26 +22,30 @@ const StyledButton = styled.button`
22
22
  text-decoration: none;
23
23
  }
24
24
  ${({ color, theme }) => (color ? theme.buttonColors(color) : theme.buttonColors('red'))};
25
+
25
26
  @media ${({ theme }) => theme.allBreakpoints('M')} {
26
- width: auto;
27
+ width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
27
28
  }
28
29
 
29
30
  @media ${({ theme }) => theme.allBreakpoints('L')} {
30
- width: auto;
31
+ width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
31
32
  padding: ${spacing('md')} ${spacing('l')};
32
33
  margin: 0 auto ${spacing('l')};
33
34
  }
34
35
  `;
35
36
 
36
- const Button = React.forwardRef(({ children, wrapper = false, ...rest }, ref) => (
37
- <StyledButton {...rest} as={wrapper ? 'span' : 'button'} ref={ref}>
37
+ const Button = React.forwardRef(({
38
+ children, wrapper = false, fullWidth = false, ...rest
39
+ }, ref) => (
40
+ <StyledButton {...rest} as={wrapper ? 'span' : 'button'} ref={ref} fullWidth={fullWidth}>
38
41
  {children}
39
42
  </StyledButton>
40
43
  ));
41
44
 
42
45
  Button.propTypes = {
43
46
  children: PropTypes.node.isRequired,
44
- wrapper: PropTypes.bool // Buttons as span
47
+ wrapper: PropTypes.bool, // Buttons as span
48
+ fullWidth: PropTypes.bool
45
49
  };
46
50
 
47
51
  export default Button;
@@ -5,3 +5,7 @@
5
5
  ```js
6
6
  <Button wrapper>My button as a span</Button>
7
7
  ```
8
+
9
+ ```js
10
+ <Button type="button" fullWidth>Full-width button</Button>
11
+ ```
@@ -20,14 +20,21 @@ const colors = {
20
20
  green: '#49D267',
21
21
  green_dark: '#1B651D',
22
22
  green_light: '#F4F2F4',
23
- grey: '#969598',
24
- grey_dark: '#222222',
25
23
  grey_stone: '#CEDCDA',
26
24
  grey_extra_light: '#f0f0f0',
27
25
  grey_for_forms: '#666',
28
26
  grey_label: '#5C5C5E',
27
+ // this is the Curtis approved list of 5 greys that will be later numbered grey_1 thru grey_5
28
+ // grey_1
29
29
  grey_light: '#F4F3F5',
30
+ // grey_2
30
31
  grey_medium: '#E1E2E3',
32
+ // grey_3
33
+ grey: '#969598',
34
+ // grey_4
35
+ grey_4: '#6E6E6E',
36
+ // grey_5
37
+ grey_dark: '#222222',
31
38
  magenta: '#FC59CE',
32
39
  magenta_dark: '#821C5D',
33
40
  magenta_light: '#FEB4DC',