Only show left sidebar toggle if there is a sidebar
Summary: ^ Not all selections have a left sidebar. If the current selection doesn't have one, it doesn't make sense to have the toggle sidebar button, so hide it. Reviewed By: LukeDefeo Differential Revision: D47593545 fbshipit-source-id: 940d59536e26bd1ab341d2038df431c67e0a5442
This commit is contained in:
committed by
Facebook GitHub Bot
parent
459f16022e
commit
f566fed761
@@ -37,6 +37,7 @@ export type ShareType = {
|
||||
} & SubShareType;
|
||||
|
||||
export type State = {
|
||||
hasLeftSidebar: boolean;
|
||||
leftSidebarVisible: boolean;
|
||||
rightSidebarVisible: boolean;
|
||||
rightSidebarAvailable: boolean;
|
||||
@@ -48,6 +49,7 @@ export type State = {
|
||||
};
|
||||
|
||||
type BooleanActionType =
|
||||
| 'hasLeftSidebar'
|
||||
| 'leftSidebarVisible'
|
||||
| 'rightSidebarVisible'
|
||||
| 'rightSidebarAvailable';
|
||||
@@ -78,6 +80,7 @@ export type Action =
|
||||
};
|
||||
|
||||
export const initialState: () => State = () => ({
|
||||
hasLeftSidebar: true,
|
||||
leftSidebarVisible: true,
|
||||
rightSidebarVisible: true,
|
||||
rightSidebarAvailable: false,
|
||||
@@ -110,6 +113,7 @@ export default function reducer(
|
||||
): State {
|
||||
state = state || initialState();
|
||||
if (
|
||||
action.type === 'hasLeftSidebar' ||
|
||||
action.type === 'leftSidebarVisible' ||
|
||||
action.type === 'rightSidebarVisible' ||
|
||||
action.type === 'rightSidebarAvailable'
|
||||
@@ -175,6 +179,11 @@ export const toggleLeftSidebarVisible = (payload?: boolean): Action => ({
|
||||
payload,
|
||||
});
|
||||
|
||||
export const toggleHasLeftSidebar = (payload?: boolean): Action => ({
|
||||
type: 'hasLeftSidebar',
|
||||
payload,
|
||||
});
|
||||
|
||||
export const toggleRightSidebarVisible = (payload?: boolean): Action => ({
|
||||
type: 'rightSidebarVisible',
|
||||
payload,
|
||||
|
||||
Reference in New Issue
Block a user