This repository was archived by the owner on Nov 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Add UI Skeleton #2
Open
siamx
wants to merge
7
commits into
master
Choose a base branch
from
add-material-ui
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9fe7517
Add material ui.
siamx 94a56ab
Create main folder.
siamx 1a9d501
Fix ts configs.
siamx 9d6b094
Add Layout component.
siamx bb7ec86
Add MainTabs.
siamx 8699262
Fix imports, and add MainTabs to the home page.
siamx 125db7d
Add maintabs.
siamx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -100,5 +100,4 @@ public | |
# TernJS port file | ||
.tern-port | ||
|
||
|
||
dist | ||
dist/ |
File renamed without changes.
This file contains hidden or 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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"name": "rair-ui", | ||
"version": "1.0.0", | ||
"description": "Rair UI", | ||
"main": "electron.tsx", | ||
"main": "main/electron.tsx", | ||
"repository": "[email protected]:Rair-Project/rair-ui.git", | ||
"author": "oddcoder <[email protected]>", | ||
"license": "LGPL-3.0", | ||
|
@@ -16,6 +16,8 @@ | |
"package-win": "yarn prod-pack; electron-packager . electron-tutorial-app --overwrite --asar --platform=win32 --arch=ia32 --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"Rair\"" | ||
}, | ||
"dependencies": { | ||
"@material-ui/core": "^4.5.1", | ||
"@material-ui/icons": "^4.5.1", | ||
"react": "^16.10.2", | ||
"react-dom": "^16.10.2" | ||
}, | ||
|
This file contains hidden or 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,40 @@ | ||
import React from 'react' | ||
import Layout from './components/Layout' | ||
import MainTabs from './components/MainTabs' | ||
|
||
const tabsData = [ | ||
{ | ||
label: 'Ok 1', | ||
children: 'Content 1' | ||
}, | ||
{ | ||
label: 'Ok 2', | ||
children: 'Content 2' | ||
}, | ||
{ | ||
label: 'Ok 3', | ||
children: ( | ||
<div> | ||
<h1>Welcome to React</h1> | ||
<h4> Also, you <i>shoudl</i> know that kinda hot patching works! <= fix should and hit refresh</h4> | ||
Advantages: | ||
<ul> | ||
<li>BS Free.. 2 dependencies which are react and react-dom. </li> | ||
<li>BS Free (continued).. 10 Dev dependencies.</li> | ||
<li>Completely written in typescript.</li> | ||
<li>Supporting JSX without Babel.. (continuation of being BS Free).</li> | ||
<li> Hot warm reloading :P. Edit then go to react and do ctrl + R </li> | ||
</ul> | ||
</div> | ||
) | ||
} | ||
] | ||
|
||
function App() { | ||
return ( | ||
<Layout> | ||
<MainTabs data={tabsData}></MainTabs> | ||
</Layout> | ||
) | ||
} | ||
export default App |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,243 @@ | ||
import React from 'react' | ||
import clsx from 'clsx' | ||
import { makeStyles } from '@material-ui/core/styles' | ||
import CssBaseline from '@material-ui/core/CssBaseline' | ||
import Drawer from '@material-ui/core/Drawer' | ||
import AppBar from '@material-ui/core/AppBar' | ||
import Toolbar from '@material-ui/core/Toolbar' | ||
import List from '@material-ui/core/List' | ||
import Typography from '@material-ui/core/Typography' | ||
import Divider from '@material-ui/core/Divider' | ||
import IconButton from '@material-ui/core/IconButton' | ||
import Badge from '@material-ui/core/Badge' | ||
import Container from '@material-ui/core/Container' | ||
import Grid from '@material-ui/core/Grid' | ||
import Paper from '@material-ui/core/Paper' | ||
import Link from '@material-ui/core/Link' | ||
import MenuIcon from '@material-ui/icons/Menu' | ||
import ChevronLeftIcon from '@material-ui/icons/ChevronLeft' | ||
import NotificationsIcon from '@material-ui/icons/Notifications' | ||
import ListItem from '@material-ui/core/ListItem' | ||
import ListItemIcon from '@material-ui/core/ListItemIcon' | ||
import ListItemText from '@material-ui/core/ListItemText' | ||
import ListSubheader from '@material-ui/core/ListSubheader' | ||
import DashboardIcon from '@material-ui/icons/Dashboard' | ||
import ShoppingCartIcon from '@material-ui/icons/ShoppingCart' | ||
import PeopleIcon from '@material-ui/icons/People' | ||
import BarChartIcon from '@material-ui/icons/BarChart' | ||
import LayersIcon from '@material-ui/icons/Layers' | ||
import AssignmentIcon from '@material-ui/icons/Assignment' | ||
|
||
|
||
const mainListItems = ( | ||
<div> | ||
<ListItem button> | ||
<ListItemIcon> | ||
<DashboardIcon /> | ||
</ListItemIcon> | ||
<ListItemText primary="Dashboard" /> | ||
</ListItem> | ||
<ListItem button> | ||
<ListItemIcon> | ||
<ShoppingCartIcon /> | ||
</ListItemIcon> | ||
<ListItemText primary="Orders" /> | ||
</ListItem> | ||
<ListItem button> | ||
<ListItemIcon> | ||
<PeopleIcon /> | ||
</ListItemIcon> | ||
<ListItemText primary="Customers" /> | ||
</ListItem> | ||
<ListItem button> | ||
<ListItemIcon> | ||
<BarChartIcon /> | ||
</ListItemIcon> | ||
<ListItemText primary="Reports" /> | ||
</ListItem> | ||
<ListItem button> | ||
<ListItemIcon> | ||
<LayersIcon /> | ||
</ListItemIcon> | ||
<ListItemText primary="Integrations" /> | ||
</ListItem> | ||
</div> | ||
) | ||
|
||
const secondaryListItems = ( | ||
<div> | ||
<ListSubheader inset>Saved reports</ListSubheader> | ||
<ListItem button> | ||
<ListItemIcon> | ||
<AssignmentIcon /> | ||
</ListItemIcon> | ||
<ListItemText primary="Current month" /> | ||
</ListItem> | ||
<ListItem button> | ||
<ListItemIcon> | ||
<AssignmentIcon /> | ||
</ListItemIcon> | ||
<ListItemText primary="Last quarter" /> | ||
</ListItem> | ||
<ListItem button> | ||
<ListItemIcon> | ||
<AssignmentIcon /> | ||
</ListItemIcon> | ||
<ListItemText primary="Year-end sale" /> | ||
</ListItem> | ||
</div> | ||
) | ||
|
||
const drawerWidth = 240 | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
oddcoder marked this conversation as resolved.
Show resolved
Hide resolved
|
||
root: { | ||
display: 'flex', | ||
}, | ||
toolbar: { | ||
paddingRight: 24, // keep right padding when drawer closed | ||
}, | ||
toolbarIcon: { | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'flex-end', | ||
padding: '0 8px', | ||
...theme.mixins.toolbar, | ||
}, | ||
appBar: { | ||
zIndex: theme.zIndex.drawer + 1, | ||
transition: theme.transitions.create(['width', 'margin'], { | ||
easing: theme.transitions.easing.sharp, | ||
duration: theme.transitions.duration.leavingScreen, | ||
}), | ||
}, | ||
appBarShift: { | ||
marginLeft: drawerWidth, | ||
width: `calc(100% - ${drawerWidth}px)`, | ||
transition: theme.transitions.create(['width', 'margin'], { | ||
easing: theme.transitions.easing.sharp, | ||
duration: theme.transitions.duration.enteringScreen, | ||
}), | ||
}, | ||
menuButton: { | ||
marginRight: 36, | ||
}, | ||
menuButtonHidden: { | ||
display: 'none', | ||
}, | ||
title: { | ||
flexGrow: 1, | ||
}, | ||
drawerPaper: { | ||
position: 'relative', | ||
whiteSpace: 'nowrap', | ||
width: drawerWidth, | ||
transition: theme.transitions.create('width', { | ||
easing: theme.transitions.easing.sharp, | ||
duration: theme.transitions.duration.enteringScreen, | ||
}), | ||
}, | ||
drawerPaperClose: { | ||
overflowX: 'hidden', | ||
transition: theme.transitions.create('width', { | ||
easing: theme.transitions.easing.sharp, | ||
duration: theme.transitions.duration.leavingScreen, | ||
}), | ||
width: theme.spacing(7), | ||
[theme.breakpoints.up('sm')]: { | ||
width: theme.spacing(9), | ||
}, | ||
}, | ||
appBarSpacer: theme.mixins.toolbar, | ||
content: { | ||
flexGrow: 1, | ||
height: '100vh', | ||
overflow: 'auto', | ||
}, | ||
container: { | ||
paddingTop: theme.spacing(4), | ||
paddingBottom: theme.spacing(4), | ||
}, | ||
paper: { | ||
padding: theme.spacing(2), | ||
display: 'flex', | ||
overflow: 'auto', | ||
flexDirection: 'column', | ||
}, | ||
fixedHeight: { | ||
height: 240, | ||
}, | ||
})) | ||
|
||
const Layout: React.FC<{}> = (props) => { | ||
const classes = useStyles() | ||
const [open, setOpen] = React.useState(true) | ||
|
||
const handleDrawerOpen = () => { | ||
setOpen(true) | ||
} | ||
|
||
const handleDrawerClose = () => { | ||
setOpen(false) | ||
} | ||
|
||
const fixedHeightPaper = clsx(classes.paper, classes.fixedHeight) | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<CssBaseline /> | ||
<AppBar position="absolute" className={clsx(classes.appBar, open && classes.appBarShift)}> | ||
<Toolbar className={classes.toolbar}> | ||
<IconButton | ||
edge="start" | ||
color="inherit" | ||
aria-label="open drawer" | ||
onClick={handleDrawerOpen} | ||
className={clsx(classes.menuButton, open && classes.menuButtonHidden)} | ||
> | ||
<MenuIcon /> | ||
</IconButton> | ||
<Typography component="h1" variant="h6" color="inherit" noWrap className={classes.title}> | ||
Dashboard | ||
</Typography> | ||
<IconButton color="inherit"> | ||
<Badge badgeContent={4} color="secondary"> | ||
<NotificationsIcon /> | ||
</Badge> | ||
</IconButton> | ||
</Toolbar> | ||
</AppBar> | ||
<Drawer | ||
variant="permanent" | ||
classes={{ | ||
paper: clsx(classes.drawerPaper, !open && classes.drawerPaperClose), | ||
}} | ||
open={open} | ||
> | ||
<div className={classes.toolbarIcon}> | ||
<IconButton onClick={handleDrawerClose}> | ||
<ChevronLeftIcon /> | ||
</IconButton> | ||
</div> | ||
<Divider /> | ||
<List>{mainListItems}</List> | ||
<Divider /> | ||
<List>{secondaryListItems}</List> | ||
</Drawer> | ||
<main className={classes.content}> | ||
<div className={classes.appBarSpacer} /> | ||
<Container maxWidth="lg" className={classes.container}> | ||
<Grid container spacing={3}> | ||
<Grid item xs={12}> | ||
<Paper className={classes.paper}> | ||
{props.children} | ||
</Paper> | ||
</Grid> | ||
</Grid> | ||
</Container> | ||
</main> | ||
</div> | ||
) | ||
} | ||
|
||
export default Layout |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused import