Skip to content

Commit

Permalink
feature(core): Setup recoil for state management (#8369)
Browse files Browse the repository at this point in the history
* feature(core): Setup recoil for state management

* Move atom to nav folder
  • Loading branch information
caseyhebebrand committed Jun 26, 2020
1 parent 8000d61 commit eea8d14
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
7 changes: 7 additions & 0 deletions app/scripts/modules/core/src/application/nav/navAtoms.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { atom } from 'recoil';
import { CollapsibleSectionStateCache } from '../../cache/collapsibleSectionStateCache';

export const verticalNavExpandedAtom = atom({
key: 'verticalNavExpanded',
default: !CollapsibleSectionStateCache.isSet('verticalNav') || CollapsibleSectionStateCache.isExpanded('verticalNav'),
});
5 changes: 3 additions & 2 deletions app/scripts/modules/core/src/bootstrap/SpinnakerContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { UIView } from '@uirouter/react';
import { RecoilRoot } from 'recoil';

import { CustomBanner } from '../header/customBanner/CustomBanner';
import { Notifier } from '../widgets/notifier/Notifier';
Expand All @@ -12,7 +13,7 @@ export interface ISpinnakerContainerProps {
}

export const SpinnakerContainer = ({ authenticating, routing }: ISpinnakerContainerProps) => (
<>
<RecoilRoot>
<div className="spinnaker-container grid-container">
{!authenticating && routing && (
<div className="transition-overlay">
Expand All @@ -26,5 +27,5 @@ export const SpinnakerContainer = ({ authenticating, routing }: ISpinnakerContai
<div className="spinnaker-content grid-contents">{!authenticating && <UIView name="main" />}</div>
</div>
<Notifier />
</>
</RecoilRoot>
);
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"react-virtualized": "9.18.5",
"react-virtualized-select": "^3.1.3",
"react2angular": "^3.2.1",
"recoil": "^0.0.10",
"reflect-metadata": "^0.1.9",
"rxjs": "^5.4.2",
"select2-bootstrap-css": "git://github.com/t0m/select2-bootstrap-css.git#v1.3.1",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14752,6 +14752,11 @@ rechoir@^0.6.2:
dependencies:
resolve "^1.1.6"

recoil@^0.0.10:
version "0.0.10"
resolved "https://registry.yarnpkg.com/recoil/-/recoil-0.0.10.tgz#679ab22306f559f8a63c46fd5ff5241539f9248f"
integrity sha512-+9gRqehw3yKETmoZbhSnWu4GO10HDb5xYf1CjLF1oXGK2uT6GX5Lu9mfTXwjxV/jXxEKx8MIRUUbgPxvbJ8SEw==

recursive-readdir@2.2.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/recursive-readdir/-/recursive-readdir-2.2.2.tgz#9946fb3274e1628de6e36b2f6714953b4845094f"
Expand Down

0 comments on commit eea8d14

Please sign in to comment.