Skip to content

Commit 9d02bc5

Browse files
committed
Add sidebar styles
1 parent 48a4ea6 commit 9d02bc5

File tree

2 files changed

+30
-18
lines changed

2 files changed

+30
-18
lines changed

site/src/components/TemplateVersionEditor/FileTreeView.tsx

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import MenuItem from "@material-ui/core/MenuItem"
88
import { FC, useState } from "react"
99
import { FileTree } from "util/filetree"
1010
import { DockerIcon } from "components/Icons/DockerIcon"
11+
import { colors } from "theme/colors"
1112

1213
const sortFileTree = (fileTree: FileTree) => (a: string, b: string) => {
1314
const contentA = fileTree[a]
@@ -98,7 +99,6 @@ export const FileTreeView: FC<{
9899
defaultCollapseIcon={<ExpandMoreIcon />}
99100
defaultExpandIcon={<ChevronRightIcon />}
100101
aria-label="Files"
101-
className={styles.fileTree}
102102
>
103103
{Object.keys(fileTree)
104104
.sort(sortFileTree(fileTree))
@@ -156,23 +156,22 @@ export const FileTreeView: FC<{
156156
}
157157

158158
const useStyles = makeStyles((theme) => ({
159-
fileTree: {},
160159
fileTreeItem: {
161160
overflow: "hidden",
162161
userSelect: "none",
163162

164-
"&:focus": {
165-
"& > .MuiTreeItem-content": {
166-
background: "rgba(255, 255, 255, 0.1)",
167-
},
163+
"&:focus:not(.active) > .MuiTreeItem-content": {
164+
background: theme.palette.action.hover,
165+
color: theme.palette.text.primary,
168166
},
169-
"& > .MuiTreeItem-content:hover": {
170-
background: theme.palette.background.paperLight,
167+
168+
"&:not(:focus):not(.active) > .MuiTreeItem-content:hover": {
169+
background: theme.palette.action.hover,
171170
color: theme.palette.text.primary,
172171
},
173172

174173
"& > .MuiTreeItem-content": {
175-
padding: "1px 16px",
174+
padding: theme.spacing(0.25, 2),
176175
color: theme.palette.text.secondary,
177176

178177
"& svg": {
@@ -182,16 +181,25 @@ const useStyles = makeStyles((theme) => ({
182181

183182
"& > .MuiTreeItem-label": {
184183
marginLeft: 4,
185-
fontSize: 14,
184+
fontSize: 13,
186185
color: "inherit",
187186
},
188187
},
189188

190189
"&.active": {
191-
background: theme.palette.background.paper,
192-
193190
"& > .MuiTreeItem-content": {
194191
color: theme.palette.text.primary,
192+
background: colors.gray[13],
193+
pointerEvents: "none",
194+
},
195+
},
196+
197+
"& .MuiTreeItem-group": {
198+
marginLeft: 0,
199+
200+
// We need to find a better way to recursive padding here
201+
"& .MuiTreeItem-content": {
202+
paddingLeft: theme.spacing(5),
195203
},
196204
},
197205
},

site/src/components/TemplateVersionEditor/TemplateVersionEditor.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Button from "@material-ui/core/Button"
22
import IconButton from "@material-ui/core/IconButton"
33
import { makeStyles, Theme } from "@material-ui/core/styles"
44
import Tooltip from "@material-ui/core/Tooltip"
5-
import CreateIcon from "@material-ui/icons/AddBoxOutlined"
5+
import CreateIcon from "@material-ui/icons/AddOutlined"
66
import BuildIcon from "@material-ui/icons/BuildOutlined"
77
import PreviewIcon from "@material-ui/icons/VisibilityOutlined"
88
import {
@@ -200,7 +200,7 @@ export const TemplateVersionEditor: FC<TemplateVersionEditorProps> = ({
200200
<div className={styles.sidebarAndEditor}>
201201
<div className={styles.sidebar}>
202202
<div className={styles.sidebarTitle}>
203-
Template Editor
203+
Template files
204204
<div className={styles.sidebarActions}>
205205
<Tooltip title="Create File" placement="top">
206206
<IconButton
@@ -420,19 +420,23 @@ const useStyles = makeStyles<
420420
},
421421
sidebar: {
422422
minWidth: 256,
423+
backgroundColor: theme.palette.background.paper,
424+
borderRight: `1px solid ${theme.palette.divider}`,
423425
},
424426
sidebarTitle: {
425-
fontSize: 12,
427+
fontSize: 10,
426428
textTransform: "uppercase",
427-
padding: "8px 16px",
428-
color: theme.palette.text.hint,
429+
padding: theme.spacing(1, 2),
430+
color: theme.palette.text.primary,
431+
fontWeight: 500,
432+
letterSpacing: "0.5px",
429433
display: "flex",
430434
alignItems: "center",
431435
},
432436
sidebarActions: {
433437
marginLeft: "auto",
434438
"& svg": {
435-
fill: theme.palette.text.hint,
439+
fill: theme.palette.text.primary,
436440
},
437441
},
438442
editorPane: {

0 commit comments

Comments
 (0)