Skip to content

Commit 6be51fd

Browse files
committed
refactor: Add some simple workspace sections
1 parent 8958b64 commit 6be51fd

File tree

3 files changed

+113
-8
lines changed

3 files changed

+113
-8
lines changed

site/components/Workspace/Workspace.tsx

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,14 @@ import { makeStyles } from "@material-ui/core/styles"
55
import CloudCircleIcon from "@material-ui/icons/CloudCircle"
66
import Link from "next/link"
77
import React from "react"
8-
8+
import * as Constants from "./constants"
99
import * as API from "../../api"
10+
import { WorkspaceSection } from "./WorkspaceSection"
1011

1112
export interface WorkspaceProps {
1213
workspace: API.Workspace
1314
}
1415

15-
namespace Constants {
16-
export const TitleIconSize = 48
17-
export const CardRadius = 8
18-
export const CardPadding = 20
19-
}
20-
2116
/**
2217
* Workspace is the top-level component for viewing an individual workspace
2318
*/
@@ -26,7 +21,32 @@ export const Workspace: React.FC<WorkspaceProps> = ({ workspace }) => {
2621

2722
return (
2823
<div className={styles.root}>
29-
<WorkspaceHeader workspace={workspace} />
24+
<div className={styles.vertical}>
25+
<WorkspaceHeader workspace={workspace} />
26+
<div className={styles.horizontal}>
27+
<div className={styles.sidebarContainer}>
28+
<WorkspaceSection title="Applications">
29+
<Placeholder />
30+
</WorkspaceSection>
31+
<WorkspaceSection title="Dev URLs">
32+
<Placeholder />
33+
</WorkspaceSection>
34+
<WorkspaceSection title="Resources">
35+
<Placeholder />
36+
</WorkspaceSection>
37+
</div>
38+
<div className={styles.timelineContainer}>
39+
<WorkspaceSection title="Timeline">
40+
<div
41+
className={styles.vertical}
42+
style={{ justifyContent: "center", alignItems: "center", height: "300px" }}
43+
>
44+
<Placeholder />
45+
</div>
46+
</WorkspaceSection>
47+
</div>
48+
</div>
49+
</div>
3050
</div>
3151
)
3252
}
@@ -63,6 +83,18 @@ export const WorkspaceHeroIcon: React.FC = () => {
6383
)
6484
}
6585

86+
/**
87+
* Temporary placeholder component until we have the sections implemented
88+
* Can be removed once the Workspace page has all the necessary sections
89+
*/
90+
const Placeholder: React.FC = () => {
91+
return (
92+
<div style={{ textAlign: "center", opacity: "0.5" }}>
93+
<Typography variant="caption">Not yet implemented</Typography>
94+
</div>
95+
)
96+
}
97+
6698
export const useStyles = makeStyles((theme) => {
6799
return {
68100
root: {
@@ -81,6 +113,15 @@ export const useStyles = makeStyles((theme) => {
81113
border: `1px solid ${theme.palette.divider}`,
82114
borderRadius: Constants.CardRadius,
83115
padding: Constants.CardPadding,
116+
margin: theme.spacing(1),
117+
},
118+
sidebarContainer: {
119+
display: "flex",
120+
flexDirection: "column",
121+
flex: "0 0 350px",
122+
},
123+
timelineContainer: {
124+
flex: 1,
84125
},
85126
icon: {
86127
width: Constants.TitleIconSize,
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import Paper from "@material-ui/core/Paper"
2+
import { makeStyles } from "@material-ui/core/styles"
3+
import Typography from "@material-ui/core/Typography"
4+
import React from "react"
5+
import { QuestionHelp } from "./QuestionHelp"
6+
import { CardPadding, CardRadius } from "./constants"
7+
8+
export interface WorkspaceSectionProps {
9+
title: string
10+
helpUrl?: string
11+
}
12+
13+
export const WorkspaceSection: React.FC<WorkspaceSectionProps> = ({ title, helpUrl, children }) => {
14+
const styles = useStyles()
15+
16+
let questionHelp = null
17+
18+
if (helpUrl) {
19+
questionHelp = (
20+
<div style={{ margin: "0em 1em" }}>
21+
<QuestionHelp />
22+
</div>
23+
)
24+
}
25+
26+
return (
27+
<Paper elevation={0} className={styles.root}>
28+
<div className={styles.headerContainer}>
29+
<div className={styles.header}>
30+
<Typography variant="h6">{title}</Typography>
31+
{questionHelp}
32+
</div>
33+
</div>
34+
35+
<div className={styles.contents}>{children}</div>
36+
</Paper>
37+
)
38+
}
39+
40+
const useStyles = makeStyles((theme) => ({
41+
root: {
42+
border: `1px solid ${theme.palette.divider}`,
43+
borderRadius: CardRadius,
44+
margin: theme.spacing(1),
45+
},
46+
headerContainer: {
47+
borderBottom: `1px solid ${theme.palette.divider}`,
48+
},
49+
contents: {
50+
margin: theme.spacing(2),
51+
},
52+
header: {
53+
alignItems: "center",
54+
display: "flex",
55+
flexDirection: "row",
56+
marginBottom: theme.spacing(1),
57+
marginTop: theme.spacing(1),
58+
paddingLeft: CardPadding + theme.spacing(1),
59+
paddingRight: CardPadding / 2,
60+
},
61+
}))
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const TitleIconSize = 48
2+
export const CardRadius = 8
3+
export const CardPadding = 20

0 commit comments

Comments
 (0)