bright-components 10.2.6 → 10.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/circle.yml +1 -2
  2. package/deploy.sh +6 -0
  3. package/dist/components/DayPicker/NewDayPicker/index.js +0 -28
  4. package/dist/components/DayPicker/index.js +2 -20
  5. package/dist/components/DayPickerPanel/HeaderDayPickerPanel/index.js +1 -18
  6. package/dist/components/DayPickerPanel/HeaderMonthPanel/index.js +0 -14
  7. package/dist/components/DayPickerPanel/HeaderYearPanel/index.js +2 -15
  8. package/dist/components/DayPickerPanel/Shortcuts/index.js +2 -16
  9. package/dist/components/DayPickerPanel/index.js +2 -74
  10. package/dist/components/EmployeeCard/index.js +1 -14
  11. package/dist/components/EmployeePicker/FilterBar/index.js +1 -28
  12. package/dist/components/EmployeePicker/Group/index.js +1 -41
  13. package/dist/components/FilterRadioGroup/index.js +2 -14
  14. package/dist/components/Form/index.js +4 -47
  15. package/dist/components/RadioBlock/index.js +10 -41
  16. package/dist/components/Time/OverlayBase/index.js +2 -25
  17. package/dist/components/Time/TimePicker/TimeOverlay/index.js +3 -26
  18. package/dist/components/TimePicker/Time/TimeOverlay/index.js +1 -58
  19. package/dist/setupTests.js +0 -7
  20. package/package.json +5 -7
  21. package/src/components/DayPicker/NewDayPicker/index.js +0 -21
  22. package/src/components/DayPicker/index.js +1 -16
  23. package/src/components/DayPicker/test.js +0 -85
  24. package/src/components/DayPickerPanel/HeaderDayPickerPanel/index.js +2 -22
  25. package/src/components/DayPickerPanel/HeaderDayPickerPanel/test.js +0 -34
  26. package/src/components/DayPickerPanel/HeaderMonthPanel/index.js +0 -10
  27. package/src/components/DayPickerPanel/HeaderMonthPanel/test.js +0 -25
  28. package/src/components/DayPickerPanel/HeaderYearPanel/index.js +3 -12
  29. package/src/components/DayPickerPanel/HeaderYearPanel/test.js +0 -17
  30. package/src/components/DayPickerPanel/Shortcuts/index.js +3 -17
  31. package/src/components/DayPickerPanel/Shortcuts/test.js +0 -39
  32. package/src/components/DayPickerPanel/index.js +1 -69
  33. package/src/components/DayPickerPanel/test.js +0 -177
  34. package/src/components/EmployeeCard/index.js +1 -15
  35. package/src/components/EmployeeCard/test.js +0 -20
  36. package/src/components/EmployeePicker/FilterBar/index.js +2 -26
  37. package/src/components/EmployeePicker/FilterBar/test.js +0 -29
  38. package/src/components/EmployeePicker/Group/index.js +1 -42
  39. package/src/components/EmployeePicker/Group/test.js +0 -21
  40. package/src/components/FilterRadioGroup/index.js +2 -14
  41. package/src/components/FilterRadioGroup/test.js +0 -13
  42. package/src/components/Form/index.js +1 -49
  43. package/src/components/Form/test.js +0 -73
  44. package/src/components/Modal/test.js +9 -9
  45. package/src/components/RadioBlock/index.js +14 -33
  46. package/src/components/RadioBlock/test.js +35 -155
  47. package/src/components/ResponsiveTabs/test.js +49 -86
  48. package/src/components/Time/OverlayBase/index.js +3 -21
  49. package/src/components/Time/OverlayBase/test.js +0 -50
  50. package/src/components/Time/TimePicker/TimeOverlay/index.js +4 -30
  51. package/src/components/Time/TimePicker/TimeOverlay/test.js +0 -24
  52. package/src/components/TimePicker/DayPart/test.js +1 -1
  53. package/src/components/TimePicker/Time/TimeOverlay/index.js +2 -50
  54. package/src/components/TimePicker/Time/TimeOverlay/test.js +1 -220
  55. package/src/index.js +1 -1
  56. package/src/setupTests.js +0 -2
  57. package/dist/components/TimePicker/utils/PickerGA/index.js +0 -24
  58. package/dist/utils/trackForm/index.js +0 -48
  59. package/src/components/TimePicker/utils/PickerGA/index.js +0 -6
  60. package/src/components/TimePicker/utils/PickerGA/test.js +0 -29
  61. package/src/utils/trackForm/index.js +0 -36
  62. package/src/utils/trackForm/test.js +0 -110
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
- import { event } from 'react-ga';
4
3
  import {
5
4
  arrayOf,
6
5
  shape,
@@ -11,7 +10,6 @@ import {
11
10
  oneOfType,
12
11
  node
13
12
  } from 'prop-types';
14
-
15
13
  import H3 from 'components/Typography/H3';
16
14
  import Chevron from 'components/Chevron/Chevron';
17
15
  import ButtonGroup from 'components/ButtonGroup';
@@ -76,14 +74,7 @@ class Group extends React.Component {
76
74
  }
77
75
 
78
76
  render() {
79
- const {
80
- title,
81
- users,
82
- onClick,
83
- hideButtons,
84
- toggleUsers,
85
- GA
86
- } = this.props;
77
+ const { title, users, onClick, hideButtons, toggleUsers } = this.props;
87
78
  const { show } = this.state;
88
79
  const selectedUsers = getSelected(users);
89
80
  const deselectedUsers = getNotSelected(users);
@@ -92,29 +83,6 @@ class Group extends React.Component {
92
83
  <Bar>
93
84
  <CH3
94
85
  onClick={() => {
95
- if (show) {
96
- event({
97
- action: 'Contract Selected Group',
98
- category: GA.category
99
- });
100
- if (title === 'No group') {
101
- event({
102
- action: 'Contract No Group',
103
- category: GA.category
104
- });
105
- }
106
- } else {
107
- event({
108
- action: 'Expand Selected Group',
109
- category: GA.category
110
- });
111
- if (title === 'No group') {
112
- event({
113
- action: 'Expand No Group',
114
- category: GA.category
115
- });
116
- }
117
- }
118
86
  this.toggleShow();
119
87
  }}
120
88
  >
@@ -130,10 +98,6 @@ class Group extends React.Component {
130
98
  <LinkButton
131
99
  disabled={selectedUsers.length === users.length}
132
100
  onClick={() => {
133
- event({
134
- action: 'Select Group',
135
- category: GA.category
136
- });
137
101
  toggleUsers(
138
102
  deselectedUsers
139
103
  .filter(filterDisabled)
@@ -147,10 +111,6 @@ class Group extends React.Component {
147
111
  <LinkButton
148
112
  disabled={selectedUsers.length === 0}
149
113
  onClick={() => {
150
- event({
151
- action: 'Deselect Group',
152
- category: GA.category
153
- });
154
114
  toggleUsers(
155
115
  selectedUsers
156
116
  .filter(filterDisabled)
@@ -180,7 +140,6 @@ class Group extends React.Component {
180
140
  Group.displayName = 'Group';
181
141
 
182
142
  Group.propTypes = {
183
- GA: shape({ category: string }).isRequired,
184
143
  users: arrayOf(
185
144
  shape({
186
145
  id: oneOfType([number, string]).isRequired,
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { render, fireEvent } from '@testing-library/react';
3
- import { event } from 'react-ga';
4
3
 
5
4
  import Container from '.';
6
5
 
@@ -25,8 +24,6 @@ const users = [
25
24
  }
26
25
  ];
27
26
 
28
- jest.mock('react-ga');
29
-
30
27
  describe('EmployeePickerContainer', () => {
31
28
  let element;
32
29
  let onClick;
@@ -37,7 +34,6 @@ describe('EmployeePickerContainer', () => {
37
34
  toggleUsers = jest.fn();
38
35
  element = render(
39
36
  <Container
40
- GA={{ category: 'category' }}
41
37
  title="No group"
42
38
  users={users}
43
39
  onClick={onClick}
@@ -67,25 +63,16 @@ describe('EmployeePickerContainer', () => {
67
63
  it('should allow the user to select the group', () => {
68
64
  fireEvent.click(element.getByText('Select group'));
69
65
  expect(toggleUsers).toHaveBeenCalledWith([1, 2]);
70
- expect(event).toHaveBeenLastCalledWith({
71
- action: 'Select Group',
72
- category: 'category'
73
- });
74
66
  });
75
67
 
76
68
  it('should allow the user to deselect the group', () => {
77
69
  fireEvent.click(element.getByText('Deselect group'));
78
70
  expect(toggleUsers).toHaveBeenCalledWith([3]);
79
- expect(event).toHaveBeenLastCalledWith({
80
- action: 'Deselect Group',
81
- category: 'category'
82
- });
83
71
  });
84
72
 
85
73
  it('should hide the button group if hideButtons is true', () => {
86
74
  element.rerender(
87
75
  <Container
88
- GA={{ category: 'category' }}
89
76
  title="No group"
90
77
  users={users}
91
78
  onClick={onClick}
@@ -108,19 +95,11 @@ describe('EmployeePickerContainer', () => {
108
95
  expect(
109
96
  element.container.querySelector('[data-e2e="Group-No group"]')
110
97
  ).not.toBeVisible();
111
- expect(event).toHaveBeenLastCalledWith({
112
- action: 'Contract No Group',
113
- category: 'category'
114
- });
115
98
 
116
99
  fireEvent.click(element.getByText('No group (1)'));
117
100
 
118
101
  expect(
119
102
  element.container.querySelector('[data-e2e="Group-No group"]')
120
103
  ).toBeVisible();
121
- expect(event).toHaveBeenLastCalledWith({
122
- action: 'Expand No Group',
123
- category: 'category'
124
- });
125
104
  });
126
105
  });
@@ -1,11 +1,9 @@
1
1
  import React from 'react';
2
- import { arrayOf, string, func, shape } from 'prop-types';
3
-
2
+ import { arrayOf, string, func } from 'prop-types';
4
3
  import styled from 'styled-components';
5
4
  import Colors from 'constants/colors';
6
5
  import Spacing from 'constants/spacing';
7
6
  import Variables from 'constants/vars';
8
- import { event } from 'react-ga';
9
7
 
10
8
  const Option = styled.label`
11
9
  display: inline-block;
@@ -47,7 +45,6 @@ const FilterRadioGroup = ({
47
45
  options,
48
46
  handleFilter,
49
47
  selectedOption,
50
- GA,
51
48
  name,
52
49
  ...props
53
50
  }) => {
@@ -63,11 +60,6 @@ const FilterRadioGroup = ({
63
60
  data-testid="filter-buttons"
64
61
  onChange={() => {
65
62
  handleFilter(option);
66
- event({
67
- action: GA.action,
68
- category: GA.category,
69
- label: option
70
- });
71
63
  }}
72
64
  type="radio"
73
65
  name="filters"
@@ -83,11 +75,7 @@ FilterRadioGroup.propTypes = {
83
75
  options: arrayOf(string).isRequired,
84
76
  handleFilter: func.isRequired,
85
77
  name: string.isRequired,
86
- selectedOption: string,
87
- GA: shape({
88
- category: string,
89
- action: string
90
- }).isRequired
78
+ selectedOption: string
91
79
  };
92
80
 
93
81
  FilterRadioGroup.defaultProps = {
@@ -1,12 +1,8 @@
1
1
  import React from 'react';
2
2
  import { render, fireEvent, getByTestId } from '@testing-library/react';
3
3
  import Colors from 'constants/colors';
4
- import { event } from 'react-ga';
5
-
6
4
  import FilterRadioGroup from '.';
7
5
 
8
- jest.mock('react-ga');
9
-
10
6
  describe('FilterRadioGroup', () => {
11
7
  it('should render filter buttons for each supplied string', () => {
12
8
  const { getAllByTestId } = render(
@@ -14,7 +10,6 @@ describe('FilterRadioGroup', () => {
14
10
  options={['string1', 'string2', 'string3']}
15
11
  handleFilter={() => {}}
16
12
  selected={undefined}
17
- GA={{ category: 'category', action: 'action' }}
18
13
  name="filters"
19
14
  />
20
15
  );
@@ -29,18 +24,12 @@ describe('FilterRadioGroup', () => {
29
24
  options={['string1', 'string2']}
30
25
  handleFilter={handleFilter}
31
26
  selected={undefined}
32
- GA={{ category: 'category', action: 'action' }}
33
27
  name="filters"
34
28
  />
35
29
  );
36
30
 
37
31
  fireEvent.click(getAllByTestId('filter-buttons')[1]);
38
32
  expect(handleFilter).toHaveBeenCalledWith('string2');
39
- expect(event).toHaveBeenCalledWith({
40
- action: 'action',
41
- category: 'category',
42
- label: 'string2'
43
- });
44
33
  });
45
34
 
46
35
  it('should default with a selected state', () => {
@@ -49,7 +38,6 @@ describe('FilterRadioGroup', () => {
49
38
  options={['string1', 'string2', 'string3']}
50
39
  handleFilter={() => {}}
51
40
  selectedOption="string2"
52
- GA={{ category: 'category', action: 'action' }}
53
41
  name="filters"
54
42
  />
55
43
  );
@@ -66,7 +54,6 @@ describe('FilterRadioGroup', () => {
66
54
  name="filters"
67
55
  handleFilter={() => {}}
68
56
  selectedOption="string2"
69
- GA={{ category: 'category', action: 'action' }}
70
57
  />
71
58
  );
72
59
 
@@ -6,11 +6,8 @@ import set from 'lodash.set';
6
6
  import get from 'lodash.get';
7
7
  import cloneDeep from 'lodash.clonedeep';
8
8
  import isEqual from 'fast-deep-equal';
9
-
10
9
  import autoBind from 'react-autobind';
11
-
12
10
  import Validation from 'components/Validation';
13
- import trackForm from 'utils/trackForm';
14
11
  import runFormValidation from './utils/runFormValidation';
15
12
 
16
13
  const setData = (original, key, value) => {
@@ -45,9 +42,6 @@ class Form extends Component {
45
42
  this.props.fieldValidation
46
43
  );
47
44
 
48
- const analyticsTracking = trackForm(props.name);
49
- let currentValue;
50
-
51
45
  this.state = {
52
46
  error: false,
53
47
  formData: initialData,
@@ -57,38 +51,6 @@ class Form extends Component {
57
51
 
58
52
  this.initialState = cloneDeep(this.state);
59
53
 
60
- this.gaChangeField = e => {
61
- // special case for checkboxes because hidden so no blur event
62
- if (e.target.type === 'checkbox') {
63
- analyticsTracking(e);
64
- }
65
- };
66
-
67
- this.gaButtonClick = e => {
68
- if (e.target.type === 'button' || e.target.type === 'submit') {
69
- analyticsTracking(e);
70
- }
71
- };
72
-
73
- this.gaHover = e => {
74
- const trackTooltip =
75
- e.target && e.target.getAttribute('data-track-tooltip');
76
-
77
- if (trackTooltip) {
78
- analyticsTracking(e);
79
- }
80
- };
81
-
82
- this.gaFocusField = e => {
83
- currentValue = e.target.value;
84
- };
85
-
86
- this.trackEvent = e => {
87
- if (currentValue !== e.target.value) {
88
- analyticsTracking(e);
89
- }
90
- };
91
-
92
54
  this.componentMounted = false;
93
55
  }
94
56
 
@@ -355,17 +317,7 @@ class Form extends Component {
355
317
  };
356
318
 
357
319
  return (
358
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions
359
- <form
360
- {...props}
361
- onSubmit={this.onSubmit}
362
- onReset={this.onReset}
363
- onFocus={this.gaFocusField}
364
- onChange={this.gaChangeField}
365
- onBlur={this.trackEvent}
366
- onClick={this.gaButtonClick}
367
- onMouseOver={this.gaHover}
368
- >
320
+ <form {...props} onSubmit={this.onSubmit} onReset={this.onReset}>
369
321
  {children(formApi)}
370
322
  </form>
371
323
  );
@@ -3,17 +3,6 @@ import { shallow } from 'enzyme';
3
3
 
4
4
  import Form from '.';
5
5
 
6
- const mockTrackEvent = jest.fn();
7
-
8
- jest.mock('utils/trackForm', () =>
9
- jest.fn(name => e =>
10
- mockTrackEvent({
11
- name,
12
- ...e
13
- })
14
- )
15
- );
16
-
17
6
  const NOOP = () => {};
18
7
 
19
8
  it('should render a form element', () => {
@@ -1109,13 +1098,6 @@ describe('FormApi', () => {
1109
1098
  value: 'pass'
1110
1099
  }
1111
1100
  });
1112
-
1113
- expect(mockTrackEvent).toHaveBeenCalledWith(
1114
- expect.objectContaining({
1115
- name: 'Form',
1116
- target: { name: 'name', value: 'pass' }
1117
- })
1118
- );
1119
1101
  });
1120
1102
 
1121
1103
  it("should not track when a user focuses on a field but doesn't change it", () => {
@@ -1146,8 +1128,6 @@ describe('FormApi', () => {
1146
1128
  value: 'pass'
1147
1129
  }
1148
1130
  });
1149
-
1150
- expect(mockTrackEvent).not.toHaveBeenCalled();
1151
1131
  });
1152
1132
 
1153
1133
  it('should track when a user clicks a button', () => {
@@ -1171,17 +1151,6 @@ describe('FormApi', () => {
1171
1151
  type: 'button'
1172
1152
  }
1173
1153
  });
1174
-
1175
- expect(mockTrackEvent).toHaveBeenCalledWith(
1176
- expect.objectContaining({
1177
- name: 'Form',
1178
- target: {
1179
- name: 'name',
1180
- value: 'pass',
1181
- type: 'button'
1182
- }
1183
- })
1184
- );
1185
1154
  });
1186
1155
 
1187
1156
  it('should track when a user clicks a submit button', () => {
@@ -1205,17 +1174,6 @@ describe('FormApi', () => {
1205
1174
  type: 'submit'
1206
1175
  }
1207
1176
  });
1208
-
1209
- expect(mockTrackEvent).toHaveBeenCalledWith(
1210
- expect.objectContaining({
1211
- name: 'Form',
1212
- target: {
1213
- name: 'name',
1214
- value: 'pass',
1215
- type: 'submit'
1216
- }
1217
- })
1218
- );
1219
1177
  });
1220
1178
 
1221
1179
  it('should not track when a user clicks an input', () => {
@@ -1239,8 +1197,6 @@ describe('FormApi', () => {
1239
1197
  type: 'input'
1240
1198
  }
1241
1199
  });
1242
-
1243
- expect(mockTrackEvent).not.toHaveBeenCalled();
1244
1200
  });
1245
1201
 
1246
1202
  it('should track when a user hovers over a tooltip', () => {
@@ -1269,18 +1225,6 @@ describe('FormApi', () => {
1269
1225
  type: 'submit'
1270
1226
  }
1271
1227
  });
1272
-
1273
- expect(mockTrackEvent).toHaveBeenCalledWith(
1274
- expect.objectContaining({
1275
- name: 'Form',
1276
- target: {
1277
- getAttribute: expect.any(Function),
1278
- name: 'name',
1279
- value: 'pass',
1280
- type: 'submit'
1281
- }
1282
- })
1283
- );
1284
1228
  });
1285
1229
 
1286
1230
  it('should not track when a user hovers over anything other than a tooltip', () => {
@@ -1309,8 +1253,6 @@ describe('FormApi', () => {
1309
1253
  type: 'submit'
1310
1254
  }
1311
1255
  });
1312
-
1313
- expect(mockTrackEvent).not.toHaveBeenCalled();
1314
1256
  });
1315
1257
 
1316
1258
  it('should track when a user changes a checkbox', () => {
@@ -1334,17 +1276,6 @@ describe('FormApi', () => {
1334
1276
  type: 'checkbox'
1335
1277
  }
1336
1278
  });
1337
-
1338
- expect(mockTrackEvent).toHaveBeenCalledWith(
1339
- expect.objectContaining({
1340
- name: 'Form',
1341
- target: {
1342
- name: 'name',
1343
- value: 'pass',
1344
- type: 'checkbox'
1345
- }
1346
- })
1347
- );
1348
1279
  });
1349
1280
 
1350
1281
  it('should not track when a user changes an input', () => {
@@ -1368,8 +1299,6 @@ describe('FormApi', () => {
1368
1299
  type: 'input'
1369
1300
  }
1370
1301
  });
1371
-
1372
- expect(mockTrackEvent).not.toHaveBeenCalled();
1373
1302
  });
1374
1303
 
1375
1304
  it('should not track when a user clicks a checkbox', () => {
@@ -1393,8 +1322,6 @@ describe('FormApi', () => {
1393
1322
  type: 'checkbox'
1394
1323
  }
1395
1324
  });
1396
-
1397
- expect(mockTrackEvent).not.toHaveBeenCalled();
1398
1325
  });
1399
1326
  });
1400
1327
 
@@ -11,7 +11,7 @@ describe('<Modal />', () => {
11
11
  beforeEach(() => {
12
12
  width = 'small';
13
13
  wrapper = render(
14
- <Modal close={closeFn} width={width}>
14
+ <Modal close={closeFn} width={width} version="2">
15
15
  <Header>Modal Title</Header>
16
16
  </Modal>
17
17
  );
@@ -31,7 +31,7 @@ describe('<Modal />', () => {
31
31
  closeFn = jest.fn(Modal.defaultProps.close);
32
32
  Modal.defaultProps.close = closeFn;
33
33
  wrapper.rerender(
34
- <Modal close={closeFn}>
34
+ <Modal close={closeFn} version="2">
35
35
  <Header>Modal Title</Header>
36
36
  </Modal>
37
37
  );
@@ -47,7 +47,7 @@ describe('<Modal />', () => {
47
47
  it('should not call a function if bgDismiss is false', () => {
48
48
  closeFn = jest.fn();
49
49
  wrapper.rerender(
50
- <Modal close={closeFn} bgDismiss={false}>
50
+ <Modal version="2" close={closeFn} bgDismiss={false}>
51
51
  <Header>Modal Title</Header>
52
52
  </Modal>
53
53
  );
@@ -64,7 +64,7 @@ describe('<Modal />', () => {
64
64
 
65
65
  width = 'medium';
66
66
  wrapper.rerender(
67
- <Modal close={closeFn} width={width}>
67
+ <Modal version="2" close={closeFn} width={width}>
68
68
  <Header>Modal Title</Header>
69
69
  </Modal>
70
70
  );
@@ -81,7 +81,7 @@ describe('<Modal />', () => {
81
81
 
82
82
  it('should call the correct function on the onClick event handler', () => {
83
83
  wrapper.rerender(
84
- <Modal close={closeFn} width={width}>
84
+ <Modal version="2" close={closeFn} width={width}>
85
85
  <Header>Modal Title</Header>
86
86
  </Modal>
87
87
  );
@@ -95,7 +95,7 @@ describe('<Modal />', () => {
95
95
  it('should call the close function on the onClick event handler if bgDismiss is true', () => {
96
96
  const close = jest.fn();
97
97
  wrapper.rerender(
98
- <Modal close={close} width={width} bgDismiss>
98
+ <Modal version="2" close={close} width={width} bgDismiss>
99
99
  <Header>Modal Title</Header>
100
100
  </Modal>
101
101
  );
@@ -113,7 +113,7 @@ describe('<Modal />', () => {
113
113
 
114
114
  const createModalWithConditionallyRenderedChildren = () =>
115
115
  render(
116
- <Modal>
116
+ <Modal version="2">
117
117
  <Header>Modal Title</Header>
118
118
  {notTrue && <div>stuff</div>}
119
119
  </Modal>
@@ -126,7 +126,7 @@ describe('<Modal />', () => {
126
126
 
127
127
  it('assigns the correct overflow style to the wrapper if you pass the prop', () => {
128
128
  wrapper.rerender(
129
- <Modal close={closeFn} allowOverflow={false}>
129
+ <Modal version="2" close={closeFn} allowOverflow={false}>
130
130
  <Header>Modal Title</Header>
131
131
  </Modal>
132
132
  );
@@ -135,7 +135,7 @@ describe('<Modal />', () => {
135
135
  expect(modalContainer).toHaveStyleRule('overflow-x', 'hidden');
136
136
 
137
137
  wrapper.rerender(
138
- <Modal close={closeFn} allowOverflow>
138
+ <Modal version="2" close={closeFn} allowOverflow>
139
139
  <Header>Modal Title</Header>
140
140
  </Modal>
141
141
  );
@@ -1,25 +1,24 @@
1
- import React from 'react';
2
- import { bool, func, string, node, shape } from 'prop-types';
3
- import styled from 'styled-components';
4
- import Colors from 'constants/colors';
5
- import Variables from 'constants/vars';
6
- import { event } from 'react-ga';
1
+ import React from "react";
2
+ import { bool, func, string, node, shape } from "prop-types";
3
+ import styled from "styled-components";
4
+ import Colors from "constants/colors";
5
+ import Variables from "constants/vars";
7
6
 
8
7
  const Option = styled.div`
9
8
  position: relative;
10
9
  text-align: left;
11
10
  border: 1px solid
12
11
  ${props => (props.selected ? Colors.primaryLight : Colors.borderColor)};
13
- background: ${props => (props.selected ? Colors.primaryLighter : '#fff')};
12
+ background: ${props => (props.selected ? Colors.primaryLighter : "#fff")};
14
13
  ${props => props.selected && `box-shadow: 1px 4px 8px -4px #888888`};
15
14
  border-radius: ${Variables.borderRadius};
16
15
  height: 100%;
17
- opacity: ${props => (props.disabled ? '0.3' : 1)};
16
+ opacity: ${props => (props.disabled ? "0.3" : 1)};
18
17
  `;
19
- Option.displayName = 'Option';
18
+ Option.displayName = "Option";
20
19
 
21
20
  const Radio = styled.input`
22
- cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};
21
+ cursor: ${props => (props.disabled ? "not-allowed" : "pointer")};
23
22
  opacity: 0 !important;
24
23
  position: absolute;
25
24
  top: 0;
@@ -29,19 +28,11 @@ const Radio = styled.input`
29
28
  width: 100%;
30
29
  height: 100%;
31
30
  `;
32
- Radio.displayName = 'Radio';
31
+ Radio.displayName = "Radio";
33
32
 
34
33
  class RadioBlock extends React.Component {
35
34
  componentDidMount() {
36
- const {
37
- GA: { category, action },
38
- checked
39
- } = this.props;
40
-
41
- if (category && action && checked) {
42
- const defaultAction = `Defaulted to ${action}`;
43
- event({ category, action: defaultAction });
44
- }
35
+ const { checked } = this.props;
45
36
  }
46
37
 
47
38
  render() {
@@ -53,7 +44,6 @@ class RadioBlock extends React.Component {
53
44
  value,
54
45
  children,
55
46
  className,
56
- GA: { category, action },
57
47
  ...props
58
48
  } = this.props;
59
49
 
@@ -72,10 +62,6 @@ class RadioBlock extends React.Component {
72
62
  checked={checked}
73
63
  disabled={disabled}
74
64
  onChange={evt => {
75
- if (category && action && !checked) {
76
- const defaultAction = `Switched to ${action}`;
77
- event({ category, action: defaultAction });
78
- }
79
65
  onChange(evt);
80
66
  }}
81
67
  {...props}
@@ -92,17 +78,12 @@ RadioBlock.propTypes = {
92
78
  name: string.isRequired,
93
79
  value: string.isRequired,
94
80
  children: node.isRequired,
95
- className: string,
96
- GA: shape({
97
- category: string,
98
- action: string
99
- })
81
+ className: string
100
82
  };
101
83
 
102
84
  RadioBlock.defaultProps = {
103
- className: '',
104
- disabled: false,
105
- GA: {}
85
+ className: "",
86
+ disabled: false
106
87
  };
107
88
 
108
89
  export default RadioBlock;