From d6b7ba0240c04ca37813fc1b5bde6aad877b7499 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 24 Oct 2018 22:41:15 +0100 Subject: [PATCH] Journal: upgrade material-ui --- src/Journal/index.tsx | 56 +++++++++++++++++++++++++------------------ src/SyncGate.tsx | 3 +-- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/src/Journal/index.tsx b/src/Journal/index.tsx index 73f9cc2..d0aeb1f 100644 --- a/src/Journal/index.tsx +++ b/src/Journal/index.tsx @@ -1,5 +1,7 @@ import * as React from 'react'; -import { Tabs, Tab } from 'material-ui/Tabs'; +import Tab from '@material-ui/core/Tab'; +import Tabs from '@material-ui/core/Tabs'; +import { Theme, withTheme } from '@material-ui/core/styles'; import SearchableAddressBook from '../components/SearchableAddressBook'; import Contact from '../components/Contact'; @@ -27,24 +29,29 @@ interface PropsType { } interface PropsTypeInner extends PropsType { + theme: Theme; } const JournalAddressBook = journalView(SearchableAddressBook, Contact); const PersistCalendar = historyPersistor('Calendar')(Calendar); const JournalCalendar = journalView(PersistCalendar, Event); -class Journal extends React.PureComponent { - static defaultProps = { - prevUid: null, +class Journal extends React.PureComponent { + state: { + tab: number, }; - props: PropsTypeInner; - - constructor(props: any) { + constructor(props: PropsTypeInner) { super(props); + + this.state = { + tab: 0, + }; } render() { + const { theme } = this.props; + const currentTab = this.state.tab; const journalUid = this.props.match.params.journalUid; const syncJournal = this.props.syncInfo.get(journalUid); @@ -74,25 +81,28 @@ class Journal extends React.PureComponent { return ( - - - - {itemsView} - - - - - - - + this.setState({ tab })} + > + + + { currentTab === 0 && + + {itemsView} + + } + { currentTab === 1 && + + + + } ); } } -export default Journal; +export default withTheme()(Journal); diff --git a/src/SyncGate.tsx b/src/SyncGate.tsx index 948aa3c..fc57efb 100644 --- a/src/SyncGate.tsx +++ b/src/SyncGate.tsx @@ -89,7 +89,6 @@ const syncInfoSelector = createSelector( ); const PimRouter = withRouter(Pim); -const JournalRouter = withRouter(Journal); class SyncGate extends React.PureComponent { constructor(props: PropsTypeInner) { @@ -198,7 +197,7 @@ class SyncGate extends React.PureComponent { ( -