-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
884 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
|
||
interface EditableTextProps { | ||
editing: boolean | ||
onEditingChange?: (value: boolean) => void | ||
renderInput: () => React.ReactElement | ||
renderText: () => React.ReactElement | ||
} | ||
|
||
export const EditableText: React.FC<EditableTextProps> = (props: EditableTextProps) => { | ||
const { | ||
editing, | ||
renderInput, | ||
renderText, | ||
} = props; | ||
if (editing) { | ||
return renderInput(); | ||
} else { | ||
return renderText(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import styled from 'styled-components'; | ||
import ColorId from '../../styles/ColorId'; | ||
import React from 'react'; | ||
|
||
const MainMenu = styled.ul` | ||
height: 100%; | ||
background-color: ${props => props.theme[ColorId.tab_inactiveBackground]}; | ||
color: ${props => props.theme[ColorId.tab_inactiveForeground]}; | ||
margin: 0; | ||
padding: 0; | ||
`; | ||
|
||
interface MenuItemProps { | ||
className?: string | ||
active?: boolean | ||
onClick?: () => void | ||
} | ||
|
||
const defaultMenuItemProps: MenuItemProps = { | ||
active: true, | ||
onClick: () => { | ||
}, | ||
}; | ||
|
||
const MenuItem: React.FC<MenuItemProps> = (props) => { | ||
let { className, children, active, onClick } = props; | ||
className += active ? ' active' : ''; | ||
return ( | ||
<li className={className} onClick={onClick}>{children}</li> | ||
); | ||
}; | ||
|
||
MenuItem.defaultProps = defaultMenuItemProps; | ||
|
||
const MainMenuItem = styled(MenuItem)` | ||
padding: 10px; | ||
cursor: pointer; | ||
color:${props => props.theme[ColorId.tab_inactiveForeground]}; | ||
background-color: ${props => props.theme[ColorId.tab_inactiveBackground]}; | ||
border-left: 2px solid ${props => props.theme[ColorId.tab_inactiveBackground]}; | ||
&.active { | ||
color:${props => props.theme[ColorId.tab_activeForeground]}; | ||
border-left: 2px solid ${props => props.theme[ColorId.tab_activeForeground]}; | ||
} | ||
&:hover { | ||
color:${props => props.theme[ColorId.tab_activeForeground]}; | ||
} | ||
`; | ||
|
||
export { | ||
MainMenu, | ||
MainMenuItem, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import React from 'react'; | ||
import { Route, Switch, useLocation, useRouteMatch } from 'react-router-dom'; | ||
import SearchPage from '../search/search-page'; | ||
import App from '../app/App'; | ||
import styled from 'styled-components'; | ||
import { MainMenu, MainMenuItem } from './main-menu'; | ||
import { Icon } from 'antd'; | ||
import { useDispatch } from 'react-redux'; | ||
import { push } from 'connected-react-router'; | ||
import { TablePage } from '../table/table'; | ||
|
||
const Container = styled.div` | ||
width: 100%; | ||
display: flex; | ||
flex-direction: row; | ||
`; | ||
|
||
const SideBar = styled.div` | ||
height: 100vh; | ||
`; | ||
|
||
const Content = styled.div` | ||
flex: 1; | ||
`; | ||
|
||
const StyledIcon = styled(Icon)` | ||
font-size: 2em; | ||
`; | ||
|
||
const MainPage: React.FC = () => { | ||
// @ts-ignore | ||
const { path, url } = useRouteMatch(); | ||
const location = useLocation(); | ||
const dispatch = useDispatch(); | ||
|
||
function goto(routeName: string) { | ||
dispatch(push(`${url}/${routeName}`)); | ||
} | ||
|
||
return ( | ||
<> | ||
<Container> | ||
<SideBar> | ||
<MainMenu> | ||
<MainMenuItem | ||
key={'search'} | ||
active={location.pathname.includes('search')} | ||
onClick={() => goto('search')} | ||
> | ||
{/*<Link to={`${url}/search`}>search</Link>*/} | ||
<StyledIcon type={'search'}/> | ||
</MainMenuItem> | ||
<MainMenuItem | ||
key={'table'} | ||
active={location.pathname.includes('table')} | ||
onClick={() => goto('table')} | ||
> | ||
{/*<Link to={`${url}/table`}>table</Link>*/} | ||
<StyledIcon type={'table'}/> | ||
</MainMenuItem> | ||
{/*<MainMenuItem*/} | ||
{/* key={'chart'}*/} | ||
{/* active={location.pathname.includes('chart')}*/} | ||
{/* onClick={() => goto('chart')}*/} | ||
{/*>*/} | ||
{/* /!*<Link to={`${url}/chart`}>chart</Link>*!/*/} | ||
{/* <StyledIcon type={'pie-chart'}/>*/} | ||
{/*</MainMenuItem>*/} | ||
</MainMenu> | ||
</SideBar> | ||
<Content> | ||
<Switch> | ||
<Route path={`${path}/search`} component={SearchPage}/> | ||
<Route path={`${path}/table`} component={TablePage}/> | ||
<Route path={`${path}/chart`} component={App}/> | ||
<Route component={SearchPage}/> | ||
</Switch> | ||
</Content> | ||
</Container> | ||
</> | ||
); | ||
}; | ||
|
||
export { MainPage }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
import React from 'react'; | ||
import App from './app/App'; | ||
import { Route, Switch } from 'react-router-dom'; | ||
import SearchPage from './search/search-page'; | ||
import SettingPage from './setting/setting-page'; | ||
import PopupPage from './popup/popup-page'; | ||
import LoginPage from './login/login-page'; | ||
import DeveloperPage from './developer/developer-page'; | ||
import { MainPage } from './main/main'; | ||
|
||
const PageRouter = () => { | ||
return ( | ||
<> | ||
<Switch> | ||
<Route path="/app" component={App}/> | ||
<Route path="/search" component={SearchPage}/> | ||
<Route path="/main" component={MainPage}/> | ||
<Route path="/setting" component={SettingPage}/> | ||
<Route path="/popup" component={PopupPage}/> | ||
<Route path="/login" component={LoginPage}/> | ||
<Route path="/developer" component={DeveloperPage}/> | ||
<Route component={SearchPage}/> | ||
<Route component={MainPage}/> | ||
</Switch> | ||
</> | ||
); | ||
}; | ||
|
||
export default PageRouter; | ||
export default PageRouter; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.