Skip to content

Commit 097f2ca

Browse files
committed
[Cell][s]: fix cell width height and also customise action buttons
1 parent 010a7ae commit 097f2ca

File tree

1 file changed

+51
-42
lines changed

1 file changed

+51
-42
lines changed

src/Cell.js

Lines changed: 51 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export default function Cell({
5555
refCode.current.style.display = cell.input ? "none" : "block";
5656
} else {
5757
refCode.current.getCodeMirror().setValue(cell.input);
58+
refCode.current.getCodeMirror().setSize("100%", "auto");
5859
refOutput.current.innerHTML = cell.output;
5960
}
6061
setId();
@@ -109,48 +110,55 @@ export default function Cell({
109110
};
110111
return (
111112
<>
112-
<button
113-
onClick={() => {
114-
getCode();
115-
}}
116-
>
117-
Run
118-
</button>
119-
<button
120-
onClick={() => {
121-
upCell("code");
122-
}}
123-
>
124-
Up cell
125-
</button>
126-
<button
127-
onClick={() => {
128-
downCell("code");
129-
}}
130-
>
131-
down cell
132-
</button>
133-
<button
134-
onClick={() => {
135-
upCell("text");
136-
}}
137-
>
138-
Text up
139-
</button>
140-
<button
141-
onClick={() => {
142-
downCell("text");
143-
}}
144-
>
145-
Text down
146-
</button>
147-
<button
148-
onClick={() => {
149-
deleteCell();
150-
}}
151-
>
152-
Delete Cell
153-
</button>
113+
<div className="max-w-2xl mx-auto mt-20">
114+
<button
115+
className="bg-green-600 rounded-sm p-2 text-white mr-2 fas fa-play"
116+
onClick={() => {
117+
getCode();
118+
}}
119+
>
120+
Run
121+
</button>
122+
123+
<button
124+
className="bg-blue-400 rounded-sm p-2 text-white fas fa-sort-up"
125+
onClick={() => {
126+
upCell("code");
127+
}}
128+
>
129+
Code
130+
</button>
131+
<button
132+
className="bg-blue-400 rounded-sm p-2 text-white mr-2 fas fa-sort-down"
133+
onClick={() => {
134+
downCell("code");
135+
}}
136+
>
137+
Code
138+
</button>
139+
<button
140+
className="bg-blue-400 rounded-sm p-2 text-white fas fa-sort-up"
141+
onClick={() => {
142+
upCell("text");
143+
}}
144+
>
145+
Text
146+
</button>
147+
<button
148+
className="bg-blue-400 rounded-sm p-2 text-white mr-2 fas fa-sort-down"
149+
onClick={() => {
150+
downCell("text");
151+
}}
152+
>
153+
Text
154+
</button>
155+
<button
156+
className="bg-red-800 rounded-sm p-2 text-white mr-2 fas fa-trash-alt"
157+
onClick={() => {
158+
deleteCell();
159+
}}
160+
></button>
161+
</div>
154162
{cell.type === "code" ? (
155163
<CodeMirror
156164
value={cell.input}
@@ -171,6 +179,7 @@ export default function Cell({
171179
disableOutput();
172180
}}
173181
></div>
182+
<br />
174183
</>
175184
);
176185
}

0 commit comments

Comments
 (0)