Skip to content

Commit 6ce9544

Browse files
authored
Sidebar with Icons (codesandbox#3997)
1 parent a35c9d7 commit 6ce9544

File tree

1 file changed

+90
-17
lines changed
  • packages/app/src/app/pages/NewDashboard/Sidebar

1 file changed

+90
-17
lines changed

packages/app/src/app/pages/NewDashboard/Sidebar/index.tsx

Lines changed: 90 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ import css from '@styled-system/css';
1616

1717
const SIDEBAR_WIDTH = 240;
1818

19+
// I hate this! but we need this until I refactor how
20+
// components are structured — Sid
21+
// https://linear.app/issue/CSB-118
22+
const linkStyles = {
23+
width: '100%',
24+
height: '100%',
25+
display: 'flex',
26+
alignItems: 'center',
27+
paddingLeft: 8,
28+
paddingRight: 8,
29+
};
30+
1931
export const Sidebar = props => {
2032
const {
2133
state: { dashboard, user },
@@ -54,8 +66,8 @@ export const Sidebar = props => {
5466
display: ['none', 'none', 'block'],
5567
})}
5668
>
57-
<List>
58-
<ListAction gap={2} css={{ padding: 0 }}>
69+
<List css={css({ '> li': { height: 10 } })}>
70+
<ListAction gap={2} css={css({ paddingX: 0 })}>
5971
{user && (
6072
<Menu>
6173
<Stack
@@ -64,11 +76,19 @@ export const Sidebar = props => {
6476
align="center"
6577
css={css({
6678
width: '100%',
67-
height: 8,
79+
height: '100%',
80+
paddingLeft: 2,
6881
})}
6982
>
70-
<Stack gap={2} align="center">
71-
<Avatar user={activeAccount} css={css({ size: 5 })} />
83+
<Stack as="span" align="center">
84+
<Stack
85+
as="span"
86+
css={css({ width: 10 })}
87+
align="center"
88+
justify="center"
89+
>
90+
<Avatar user={activeAccount} css={css({ size: 6 })} />
91+
</Stack>
7292
<Text size={4} weight="normal">
7393
{activeAccount.username}
7494
</Text>
@@ -98,33 +118,86 @@ export const Sidebar = props => {
98118
</Menu>
99119
)}
100120
</ListAction>
101-
<ListAction>
102-
<Link to="/new-dashboard/start" as={RouterLink}>
121+
122+
<ListAction align="center" css={css({ paddingX: 0 })}>
123+
<Link as={RouterLink} to="/new-dashboard/start" style={linkStyles}>
124+
<Stack
125+
as="span"
126+
css={css({ width: 10 })}
127+
align="center"
128+
justify="center"
129+
>
130+
<Icon name="box" />
131+
</Stack>
103132
Start
104133
</Link>
105134
</ListAction>
106-
<ListAction>
107-
<Link to="/new-dashboard/drafts" as={RouterLink}>
135+
<ListAction align="center" css={css({ paddingX: 0 })}>
136+
<Link as={RouterLink} to="/new-dashboard/drafts" style={linkStyles}>
137+
<Stack
138+
as="span"
139+
css={css({ width: 10 })}
140+
align="center"
141+
justify="center"
142+
>
143+
<Icon name="file" />
144+
</Stack>
108145
Drafts
109146
</Link>
110147
</ListAction>
111-
<ListAction>
112-
<Link to="/new-dashboard/recent" as={RouterLink}>
148+
<ListAction align="center" css={css({ paddingX: 0 })}>
149+
<Link as={RouterLink} to="/new-dashboard/recent" style={linkStyles}>
150+
<Stack
151+
as="span"
152+
css={css({ width: 10 })}
153+
align="center"
154+
justify="center"
155+
>
156+
<Icon name="clock" />
157+
</Stack>
113158
Recent
114159
</Link>
115160
</ListAction>
116-
<ListAction>
117-
<Link to="/new-dashboard/all" as={RouterLink}>
161+
<ListAction align="center" css={css({ paddingX: 0 })}>
162+
<Link as={RouterLink} to="/new-dashboard/all" style={linkStyles}>
163+
<Stack
164+
as="span"
165+
css={css({ width: 10 })}
166+
align="center"
167+
justify="center"
168+
>
169+
<Icon name="folder" />
170+
</Stack>
118171
All Sandboxes
119172
</Link>
120173
</ListAction>
121-
<ListAction>
122-
<Link to="/new-dashboard/templates" as={RouterLink}>
174+
<ListAction align="center" css={css({ paddingX: 0 })}>
175+
<Link
176+
as={RouterLink}
177+
to="/new-dashboard/templates"
178+
style={linkStyles}
179+
>
180+
<Stack
181+
as="span"
182+
css={css({ width: 10 })}
183+
align="center"
184+
justify="center"
185+
>
186+
<Icon name="star" />
187+
</Stack>
123188
Templates
124189
</Link>
125190
</ListAction>
126-
<ListAction>
127-
<Link to="/new-dashboard/deleted" as={RouterLink}>
191+
<ListAction align="center" css={css({ paddingX: 0 })}>
192+
<Link as={RouterLink} to="/new-dashboard/deleted" style={linkStyles}>
193+
<Stack
194+
as="span"
195+
css={css({ width: 10 })}
196+
align="center"
197+
justify="center"
198+
>
199+
<Icon name="trash" />
200+
</Stack>
128201
Recently Deleted
129202
</Link>
130203
</ListAction>

0 commit comments

Comments
 (0)