Skip to content

Commit 1e427d1

Browse files
committed
feat(ui): add sidebar (wip)
1 parent 323f12a commit 1e427d1

File tree

2 files changed

+81
-68
lines changed

2 files changed

+81
-68
lines changed

resources/styles/main.css

+43-31
Original file line numberDiff line numberDiff line change
@@ -35,43 +35,55 @@
3535
--noise: 0;
3636
}
3737

38-
.system-view {
39-
.node {
40-
display: flex;
41-
height: 100px;
42-
width: 100px;
43-
background-repeat: no-repeat;
44-
background-size: 100% 100%;
45-
background-position: center center;
46-
padding: 1rem;
47-
justify-content: center;
48-
align-items: center;
49-
font-size: 14px;
50-
background-image: url("/images/nodes/unknown.svg");
38+
.system-container {
39+
display: flex;
5140

52-
&.manager {
53-
height: 108px;
41+
.system-view {
42+
height: 100vh;
43+
flex: 1;
44+
.node {
45+
display: flex;
46+
height: 100px;
5447
width: 100px;
55-
background-image: url("/images/nodes/manager.svg");
56-
}
57-
&.exile {
58-
background-image: url("/images/nodes/exile.svg");
48+
background-repeat: no-repeat;
49+
background-size: 100% 100%;
50+
background-position: center center;
51+
padding: 1rem;
52+
justify-content: center;
53+
align-items: center;
54+
font-size: 14px;
55+
background-image: url("/images/nodes/unknown.svg");
56+
57+
&.manager {
58+
height: 108px;
59+
width: 100px;
60+
background-image: url("/images/nodes/manager.svg");
61+
}
62+
&.exile {
63+
background-image: url("/images/nodes/exile.svg");
64+
}
65+
&.firefighter {
66+
height: 120px;
67+
width: 120px;
68+
background-image: url("/images/nodes/firefighter.svg");
69+
}
5970
}
60-
&.firefighter {
61-
height: 120px;
62-
width: 120px;
63-
background-image: url("/images/nodes/firefighter.svg");
71+
72+
.logo {
73+
margin-top: 1em;
6474
}
65-
}
6675

67-
.logo {
68-
margin-top: 1em;
76+
.parts-toolbar {
77+
background-color: var(--color-base-100);
78+
border-radius: var(--radius-box);
79+
padding: 0.2rem 0.5rem;
80+
border: 1px solid #cccccc;
81+
}
6982
}
7083

71-
.parts-toolbar {
72-
background-color: var(--color-base-100);
73-
border-radius: var(--radius-box);
74-
padding: 0.2rem 0.5rem;
75-
border: 1px solid #cccccc;
84+
.sidebar {
85+
width: 200px;
86+
height: 100vh;
87+
border-left: 1px solid var(--color-base-300);
7688
}
7789
}

src/main/parts/frontend/components/system.cljs

+38-37
Original file line numberDiff line numberDiff line change
@@ -81,40 +81,41 @@
8181
on-connect (uix.core/use-callback
8282
#(on-connect-callback setEdges %)
8383
[setEdges])]
84-
85-
($ :div {:style {:width "100vw" :height "100vh"} :class "system-view"}
86-
($ (.-Provider ctx/update-node-context) {:value update-node}
87-
($ ReactFlow {:nodes nodes
88-
:edges edges
89-
:onNodesChange onNodesChange
90-
:onEdgesChange onEdgesChange
91-
:onConnect on-connect
92-
:nodeTypes node-types}
93-
($ MiniMap)
94-
($ Controls)
95-
($ Panel {:position "top-left" :class "logo"}
96-
($ :img {:src "/images/parts-logo-horizontal.svg" :width 150}))
97-
($ Panel {:position "top-right" :class "toolbar"}
98-
($ parts-toolbar
99-
($ auth-status-bar)
100-
($ :span " Add part: ")
101-
($ :div {:class "join"}
102-
($ :button
103-
{:class "btn btn-xs join-item"
104-
:on-click (fn [] (setNodes (add-node "unknown")))}
105-
"Unknown")
106-
($ :button
107-
{:class "btn btn-xs join-item"
108-
:on-click (fn [] (setNodes (add-node "exile")))}
109-
"Exile")
110-
($ :button
111-
{:class "btn btn-xs join-item"
112-
:on-click (fn [] (setNodes (add-node "firefighter")))}
113-
"Firefighter")
114-
($ :button
115-
{:class "btn btn-xs join-item"
116-
:on-click (fn [] (setNodes (add-node "manager")))}
117-
"Manager"))))
118-
($ Background {:variant "dots"
119-
:gap 12
120-
:size 1}))))))
84+
($ :div {:class "system-container"}
85+
($ :div {:class "system-view"}
86+
($ (.-Provider ctx/update-node-context) {:value update-node}
87+
($ ReactFlow {:nodes nodes
88+
:edges edges
89+
:onNodesChange onNodesChange
90+
:onEdgesChange onEdgesChange
91+
:onConnect on-connect
92+
:nodeTypes node-types}
93+
($ MiniMap)
94+
($ Controls)
95+
($ Panel {:position "top-left" :class "logo"}
96+
($ :img {:src "/images/parts-logo-horizontal.svg" :width 150}))
97+
($ Panel {:position "top-right" :class "toolbar"}
98+
($ parts-toolbar
99+
($ :span " Add part: ")
100+
($ :div {:class "join"}
101+
($ :button
102+
{:class "btn btn-xs join-item"
103+
:on-click (fn [] (setNodes (add-node "unknown")))}
104+
"Unknown")
105+
($ :button
106+
{:class "btn btn-xs join-item"
107+
:on-click (fn [] (setNodes (add-node "exile")))}
108+
"Exile")
109+
($ :button
110+
{:class "btn btn-xs join-item"
111+
:on-click (fn [] (setNodes (add-node "firefighter")))}
112+
"Firefighter")
113+
($ :button
114+
{:class "btn btn-xs join-item"
115+
:on-click (fn [] (setNodes (add-node "manager")))}
116+
"Manager"))))
117+
($ Background {:variant "dots"
118+
:gap 12
119+
:size 1}))))
120+
($ :div {:class "sidebar p-4"}
121+
($ auth-status-bar)))))

0 commit comments

Comments
 (0)