Joel Woodfield commited on
Commit
bb56561
·
1 Parent(s): 0eee87a

Improve layout

Browse files
Files changed (1) hide show
  1. src/ConvolutionVisualizer.tsx +34 -33
src/ConvolutionVisualizer.tsx CHANGED
@@ -93,36 +93,38 @@ function Sidebar({
93
 
94
  return (
95
  <div className="flex flex-col items-center border-l border-gray-200 p-4 gap-4">
96
- <input
97
- ref={imageFileInputRef}
98
- type="file"
99
- accept="image/*"
100
- onChange={(e) => {
101
- const file = e.target.files?.[0];
102
- if (!file) return;
103
-
104
- const reader = new FileReader();
105
- reader.onload = () => {
106
- const result = reader.result;
107
- if (typeof result !== "string") {
108
- return;
109
- }
110
- setImage(result);
111
- };
112
- reader.readAsDataURL(file);
113
- }}
114
- style={{ display: "none" }}
115
- />
116
- <Button
117
- label="Upload Image"
118
- onClick={() => imageFileInputRef.current?.click()}
119
- />
120
- <Radio
121
- label="Color option"
122
- options={["Grayscale", "Color"] as const}
123
- activeOption={useColor ? "Color" : "Grayscale"}
124
- onChange={(option) => setUseColor(option === "Color")}
125
- />
 
 
126
  <KernelEditor
127
  useColor={useColor}
128
  colorKernel={colorKernel}
@@ -302,11 +304,10 @@ function KernelEditor({
302
  const loadedPresetLabel = useColor ? loadedColorPreset : loadedGrayPreset;
303
 
304
  return (
305
- <div className="w-full max-w-sm border border-gray-300 rounded p-3">
306
- <h3 className="text-sm font-semibold mb-2">Kernel</h3>
307
  <div className="flex items-end gap-2 mb-3">
308
  <Dropdown
309
- label="Preset"
310
  options={useColor ? colorPresetNames : grayPresetNames}
311
  activeOption={useColor ? selectedColorPreset : selectedGrayPreset}
312
  onChange={(option) => {
 
93
 
94
  return (
95
  <div className="flex flex-col items-center border-l border-gray-200 p-4 gap-4">
96
+ <div className="flex border-b border-gray-200 p-4 gap-4 pb-10">
97
+ <input
98
+ ref={imageFileInputRef}
99
+ type="file"
100
+ accept="image/*"
101
+ onChange={(e) => {
102
+ const file = e.target.files?.[0];
103
+ if (!file) return;
104
+
105
+ const reader = new FileReader();
106
+ reader.onload = () => {
107
+ const result = reader.result;
108
+ if (typeof result !== "string") {
109
+ return;
110
+ }
111
+ setImage(result);
112
+ };
113
+ reader.readAsDataURL(file);
114
+ }}
115
+ style={{ display: "none" }}
116
+ />
117
+ <Button
118
+ label="Upload Image"
119
+ onClick={() => imageFileInputRef.current?.click()}
120
+ />
121
+ <Radio
122
+ label="Color option"
123
+ options={["Grayscale", "Color"] as const}
124
+ activeOption={useColor ? "Color" : "Grayscale"}
125
+ onChange={(option) => setUseColor(option === "Color")}
126
+ />
127
+ </div>
128
  <KernelEditor
129
  useColor={useColor}
130
  colorKernel={colorKernel}
 
304
  const loadedPresetLabel = useColor ? loadedColorPreset : loadedGrayPreset;
305
 
306
  return (
307
+ <div className="flex flex-col items-center w-full max-w-sm rounded p-3">
 
308
  <div className="flex items-end gap-2 mb-3">
309
  <Dropdown
310
+ label="Kernel Preset"
311
  options={useColor ? colorPresetNames : grayPresetNames}
312
  activeOption={useColor ? selectedColorPreset : selectedGrayPreset}
313
  onChange={(option) => {