add redux action to change section of UI
parent
ddf41de3fb
commit
42369cb8f2
@ -0,0 +1,37 @@
|
|||||||
|
import { SectionType } from '../../components/session/ActionsPanel';
|
||||||
|
|
||||||
|
export const FOCUS_SECTION = 'FOCUS_SECTION';
|
||||||
|
|
||||||
|
const focusSection = (section: SectionType) => {
|
||||||
|
return {
|
||||||
|
type: FOCUS_SECTION,
|
||||||
|
payload: section,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const actions = {
|
||||||
|
focusSection,
|
||||||
|
};
|
||||||
|
|
||||||
|
const initialState = { focusedSection: SectionType.Message };
|
||||||
|
export type SectionStateType = {
|
||||||
|
focusedSection: SectionType;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const reducer = (
|
||||||
|
state: any = initialState,
|
||||||
|
{
|
||||||
|
type,
|
||||||
|
payload,
|
||||||
|
}: {
|
||||||
|
type: string;
|
||||||
|
payload: SectionType;
|
||||||
|
}
|
||||||
|
): SectionStateType => {
|
||||||
|
switch (type) {
|
||||||
|
case FOCUS_SECTION:
|
||||||
|
return { focusedSection: payload };
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
};
|
@ -1,26 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import classNames from 'classnames';
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
/**
|
|
||||||
* Corresponds to the theme setting in the app, and the class added to the root element.
|
|
||||||
*/
|
|
||||||
theme: 'light-theme' | 'dark-theme';
|
|
||||||
style: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides the parent elements necessary to allow the main Signal Desktop stylesheet to
|
|
||||||
* apply (with no changes) to messages in the Style Guide.
|
|
||||||
*/
|
|
||||||
export class LeftPaneContext extends React.Component<Props> {
|
|
||||||
public render() {
|
|
||||||
const { style, theme } = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div style={style} className={classNames(theme || 'light-theme')}>
|
|
||||||
<div className="gutter">{this.props.children}</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue