Introduce ComponentState (#4386)
* Proof of concept ComponentState * Migrate to createState and createFamilyState * Refactor * Fix * Fix tests * Fix lint * Fix tests * Re-enable coverage
This commit is contained in:
@@ -28,8 +28,8 @@ const StyledContainerActionBar = styled.div`
|
||||
`;
|
||||
|
||||
export const ActionBar = () => {
|
||||
const contextMenuIsOpen = useRecoilValue(contextMenuIsOpenState);
|
||||
const actionBarEntries = useRecoilValue(actionBarEntriesState);
|
||||
const contextMenuIsOpen = useRecoilValue(contextMenuIsOpenState());
|
||||
const actionBarEntries = useRecoilValue(actionBarEntriesState());
|
||||
const wrapperRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
if (contextMenuIsOpen) {
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import { actionBarOpenState } from '../../states/actionBarIsOpenState';
|
||||
import { ActionBar } from '../ActionBar';
|
||||
|
||||
const FilledActionBar = () => {
|
||||
const setActionBarOpenState = useSetRecoilState(actionBarOpenState);
|
||||
const setActionBarOpenState = useSetRecoilState(actionBarOpenState());
|
||||
setActionBarOpenState(true);
|
||||
return <ActionBar />;
|
||||
};
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
import { atom } from 'recoil';
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
|
||||
import { ActionBarEntry } from '../types/ActionBarEntry';
|
||||
|
||||
export const actionBarEntriesState = atom<ActionBarEntry[]>({
|
||||
export const actionBarEntriesState = createState<ActionBarEntry[]>({
|
||||
key: 'actionBarEntriesState',
|
||||
default: [],
|
||||
defaultValue: [],
|
||||
});
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
import { atom } from 'recoil';
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
|
||||
export const actionBarOpenState = atom<boolean>({
|
||||
export const actionBarOpenState = createState<boolean>({
|
||||
key: 'actionBarOpenState',
|
||||
default: false,
|
||||
defaultValue: false,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user