qpp-style 9.28.3-mo-beta.0 → 9.28.3

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.
@@ -38,7 +38,9 @@ const Accordion = (props) => {
38
38
  return (
39
39
  <div className="accordion-section" data-testid="accordion">
40
40
  <button
41
- className={`accordion ${setActive}`}
41
+ className={`accordion ${setActive} ${
42
+ setActive && props.isSticky ? 'sticky' : ''
43
+ }`}
42
44
  aria-label={props.title}
43
45
  aria-pressed={ariaPressed}
44
46
  aria-expanded={ariaPressed}
@@ -83,11 +85,13 @@ Accordion.propTypes = {
83
85
  centerItem: PropTypes.string,
84
86
  rightItem: PropTypes.string,
85
87
  isOpen: PropTypes.bool,
88
+ isSticky: PropTypes.bool,
86
89
  };
87
90
 
88
91
  Accordion.defaultProps = {
89
92
  title: '',
90
93
  isOpen: false,
94
+ isSticky: false,
91
95
  };
92
96
 
93
97
  export default Accordion;
@@ -54,26 +54,18 @@ const SelectRole = ({ selectedRole, setSelectedRole }) => {
54
54
  }
55
55
  }, []);
56
56
 
57
- const singleRoleUser = ROLE_OPTIONS.length === 1;
58
-
59
- const MultiRoleDropdown = () => (
60
- <Dropdown
61
- value={selectedRole}
62
- name="user-role-selection"
63
- ariaLabel="Select User Role"
64
- className="qpp-u-width--100 SelectRole__Dropdown"
65
- options={ROLE_OPTIONS}
66
- onChange={handleSelection}
67
- disabled={isHelpdeskRoleAndImpersonating}
68
- />
69
- );
70
-
71
57
  return (
72
58
  <div className="SelectRole__Container">
73
- <p className="SelectRole__Text">
74
- You are viewing as a{singleRoleUser ? ` ${selectedRole}` : ''}
75
- </p>
76
- {!singleRoleUser && <MultiRoleDropdown />}
59
+ <p className="SelectRole__Text">You are viewing as a</p>
60
+ <Dropdown
61
+ value={selectedRole}
62
+ name="user-role-selection"
63
+ ariaLabel="Select User Role"
64
+ className="qpp-u-width--100 SelectRole__Dropdown"
65
+ options={ROLE_OPTIONS}
66
+ onChange={handleSelection}
67
+ disabled={isHelpdeskRoleAndImpersonating}
68
+ />
77
69
  </div>
78
70
  );
79
71
  };
@@ -28,6 +28,9 @@ const NavLinkDrawer = ({
28
28
  }) => {
29
29
  const [isOpen, setIsOpen] = useState(openByDefault);
30
30
  const MANAGE_ACCESS = '/user/manage-access';
31
+ const ELIGIBILITY_REPORTING = '/user/dashboard';
32
+ const REGISTRATION = '/user/registration';
33
+ const SUBMISSION_FEEDBACK = '/user/submissions/feedback';
31
34
 
32
35
  const toggleDrawer = () => {
33
36
  if (!isExpanded && typeof sidebarExpand === 'function') {
@@ -44,11 +47,25 @@ const NavLinkDrawer = ({
44
47
  };
45
48
 
46
49
  const reRouteHandler = () => {
47
- if (url === MANAGE_ACCESS) {
48
- return (window.location.href = MANAGE_ACCESS);
50
+ if (url) {
51
+ window.location.href = url;
49
52
  }
50
53
  };
51
54
 
55
+ const parentRerouteUrls = [
56
+ MANAGE_ACCESS,
57
+ ELIGIBILITY_REPORTING,
58
+ REGISTRATION,
59
+ SUBMISSION_FEEDBACK,
60
+ ];
61
+
62
+ const parentReroute = (url) => {
63
+ if (parentRerouteUrls.includes(url)) {
64
+ return false;
65
+ }
66
+ return true;
67
+ };
68
+
52
69
  const isLinkActive = (link, func) => {
53
70
  if (typeof func === 'function') {
54
71
  return func(link);
@@ -201,7 +218,7 @@ const NavLinkDrawer = ({
201
218
  {...(!isAlwaysOpen ? { 'aria-pressed': isOpen } : {})}
202
219
  tabIndex="0"
203
220
  aria-label={label}
204
- {...((url !== MANAGE_ACCESS && isAlwaysOpen) || disabled
221
+ {...((parentReroute(url) && isAlwaysOpen) || disabled
205
222
  ? { disabled: isAlwaysOpen || disabled }
206
223
  : {})}
207
224
  className={`${className} ${expandedClass} ${highlightTitle(