Skip to content

Commit

Permalink
feat: Setup routing and layout templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Healy committed Jan 24, 2020
1 parent 31b69a8 commit 19236cd
Show file tree
Hide file tree
Showing 20 changed files with 3,361 additions and 154 deletions.
6 changes: 6 additions & 0 deletions examples/react-graphql/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@
"@types/node": "^12.0.0",
"@types/react": "^16.9.0",
"@types/react-dom": "^16.9.0",
"@types/react-table": "^7.0.3",
"@types/styled-components": "^4.4.2",
"apollo-boost": "^0.4.7",
"graphql": "^14.5.8",
"react": "^16.12.0",
"react-apollo": "^3.1.3",
"react-dom": "^16.12.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.3.0",
"react-table": "^7.0.0-rc.15",
"rimble-ui": "^0.11.1",
"styled-components": "^5.0.0",
"typescript": "~3.7.2"
Expand All @@ -42,5 +45,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/react-router-dom": "^5.1.3"
}
}
2 changes: 1 addition & 1 deletion examples/react-graphql/client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Daf Dashboard</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
35 changes: 35 additions & 0 deletions examples/react-graphql/client/src/components/Panel/Panel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React, { useState } from 'react'
import { Box, Text, Heading } from 'rimble-ui'

interface PanelProps {
heading: string
description?: string
headerRight?: React.ReactNode
headerBorder?: number
}

const Panel: React.FC<PanelProps> = props => {
return (
<Box borderRadius={1} bg="#222222" flex={1} mb={32}>
<Box
p={3}
borderBottom={props.headerBorder !== undefined ? props.headerBorder : 1}
borderColor={'#4B4B4B'}
flexDirection={'row'}
display={'flex'}
alignItems={'center'}
justifyContent={'space-between'}
height={60}
>
<Box>
<Heading as={'h5'}>{props.heading}</Heading>
{props.description && <Text small>{props.description}</Text>}
</Box>
{props.headerRight && props.headerRight}
</Box>
<Box>{props.children}</Box>
</Box>
)
}

export default Panel
4 changes: 2 additions & 2 deletions examples/react-graphql/client/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import ReactDOM from 'react-dom'
import Dashboard from './views/Dashboard/Dashboard'
import Layout from './layout/Layout'
import ApolloClient from 'apollo-boost'
import { ApolloProvider } from 'react-apollo'
import * as serviceWorker from './serviceWorker'
Expand Down Expand Up @@ -39,7 +39,7 @@ ReactDOM.render(
})}
>
<BaseStyles id="base_styles_container">
<Dashboard />
<Layout />
</BaseStyles>
</ThemeProvider>
</ApolloProvider>,
Expand Down
61 changes: 61 additions & 0 deletions examples/react-graphql/client/src/layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React, { useState } from 'react'
import { useQuery, useMutation } from '@apollo/react-hooks'

import { Flex, Box, Text, Heading, Button, Icon, Table, Field, Input } from 'rimble-ui'
import { Switch, Route, BrowserRouter as Router } from 'react-router-dom'

import Activity from '../views/Activity/Activity'
import Explore from '../views/Explore/Explore'
import IdentityManager from '../views/Identity/IdentitiyManager'
import IdentityDetail from '../views/Identity/IdentityDetail'
import Request from '../views/Request/Request'
import Connections from '../views/Connections/Connections'
import Issue from '../views/Issue/Issue'

import Sidebar from './Sidebar'
import NavigationLeft from './NavigationLeft'

interface DashboardProps {}

const Dashboard: React.FC<DashboardProps> = () => {
const [sidePanelOpen, toggleSidePanel] = useState(true)

return (
<Router>
<Flex flexDirection={'row'} flex={1}>
<Sidebar />
<NavigationLeft />
<Box flex={1} bg="#1C1C1C">
<Switch>
<Route exact path="/">
<Activity />
</Route>
<Route path="/explore">
<Explore />
</Route>
<Route path="/issue">
<Issue />
</Route>
<Route path="/request">
<Request />
</Route>
<Route path="/identities">
<IdentityManager />
</Route>
<Route path="/connections">
<Connections />
</Route>
</Switch>
</Box>

<Switch>
<Route path="/identities/:id">
<IdentityDetail />
</Route>
</Switch>
</Flex>
</Router>
)
}

export default Dashboard
38 changes: 38 additions & 0 deletions examples/react-graphql/client/src/layout/NavigationLeft.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React from 'react'
import { Box, Text, Heading } from 'rimble-ui'
import { NavLink } from 'react-router-dom'

const Component = () => {
return (
<Box p={3} width={220} bg="#28292B" borderRight={1} borderColor={'#4B4B4B'}>
<Box mb={32}>
<Heading as={'h3'}>Daf Dashboard</Heading>
<Text>Description</Text>
</Box>
<ul className={'left-nav-list'}>
<li className={'left-nav-item'}>
<NavLink exact to="/">
Activity
</NavLink>
</li>
<li className={'left-nav-item'}>
<NavLink to="/explore">Explore</NavLink>
</li>
<li className={'left-nav-item'}>
<NavLink to="/issue">Issue Credential</NavLink>
</li>
<li className={'left-nav-item'}>
<NavLink to="/request">Request</NavLink>
</li>
<li className={'left-nav-item'}>
<NavLink to="/identities">Identities</NavLink>
</li>
<li className={'left-nav-item'}>
<NavLink to="/connections">Connections</NavLink>
</li>
</ul>
</Box>
)
}

export default Component
25 changes: 25 additions & 0 deletions examples/react-graphql/client/src/layout/Page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react'
import { Box, Heading } from 'rimble-ui'

const Component = (props: any) => {
return (
<>
<Box
p={3}
bg="#1C1C1C"
borderBottom={1}
borderColor={'#4B4B4B'}
flexDirection={'row'}
display={'flex'}
justifyContent={'space-between'}
>
<Heading as={'h4'}>{props.title}</Heading>
</Box>
<Box p={3} flex={1} pb={64} className={'scroll-container'}>
{props.children}
</Box>
</>
)
}

export default Component
10 changes: 10 additions & 0 deletions examples/react-graphql/client/src/layout/SidePanel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'
import { Flex, Box, Text, Heading, Button, Icon, Table, Field, Input } from 'rimble-ui'
import { Switch, Route, useParams } from 'react-router-dom'
import IdentityDetail from '../views/Identity/IdentityDetail'

const Component = () => {
return <IdentityDetail />
}

export default Component
20 changes: 20 additions & 0 deletions examples/react-graphql/client/src/layout/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react'
import { Box } from 'rimble-ui'

const Component = () => {
return (
<Box
p={3}
bg="#1C1C1C"
alignItems={'center'}
justifyContent={'space-between'}
display={'flex'}
flexDirection={'column'}
>
<Box borderRadius={25} width={50} height={50} bg="#FFFFFF" p={3}></Box>
<Box borderRadius={5} width={45} height={45} bg="#FFFFFF" p={3}></Box>
</Box>
)
}

export default Component
44 changes: 44 additions & 0 deletions examples/react-graphql/client/src/styles/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,51 @@ body {
flex: 1;
}

.scroll-container {
height: 100%;
overflow: scroll;
}

* {
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
}

tr.interactive_table_row:hover {
background-color: #313131;
cursor: pointer;
}

ul.left-nav-list {
padding: 0;
margin: 0;
list-style-type: none;
}

/* li.left-nav-item {
padding: 8px;
margin-bottom: 10px;
list-style-type: none;
background-color: #222222;
text-decoration: none;
border-radius: 5px;
padding-left: 16px;
} */

li.left-nav-item a {
text-decoration: none;
color: #f5f5f5;
padding: 8px;
margin-bottom: 10px;
list-style-type: none;
background-color: #222222;
text-decoration: none;
border-radius: 5px;
padding-left: 16px;
display: block;
}

li.left-nav-item a.active {
background-color: #a51699;
font-weight: bold;
}
12 changes: 12 additions & 0 deletions examples/react-graphql/client/src/views/Activity/Activity.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react'
import { Flex, Box, Text, Heading, Button, Icon, Table, Field, Input } from 'rimble-ui'
import Panel from '../../components/Panel/Panel'
import Page from '../../layout/Page'

interface Activity {}

const Activity: React.FC<Activity> = () => {
return <Page title={'Activity'}></Page>
}

export default Activity
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'
import { Box, Heading } from 'rimble-ui'
import Page from '../../layout/Page'

const Component = () => {
return <Page title={'Connections'}></Page>
}

export default Component
Loading

0 comments on commit 19236cd

Please sign in to comment.