MCPcopy Create free account
hub / github.com/Milkdown/website / sidePanelDataReducer

Function sidePanelDataReducer

src/providers/SidePanelStateProvider.tsx:20–47  ·  view source on GitHub ↗
(
  state,
  action
)

Source from the content-addressed store, hash-verified

18}
19
20const sidePanelDataReducer: Reducer<SidePanelState, SidePanelAction> = (
21 state,
22 action
23) => {
24 switch (action.type) {
25 case 'ShowRoot': {
26 return {
27 visible: true,
28 mode: 'mobile',
29 activeId: ROOT,
30 }
31 }
32 case 'ShowSection': {
33 return {
34 visible: true,
35 mode: action.mode,
36 activeId: action.id,
37 }
38 }
39 case 'Hide':
40 default: {
41 return {
42 ...state,
43 visible: false,
44 }
45 }
46 }
47}
48
49const defaultState: SidePanelState = {
50 visible: false,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected