Skip to content

Commit 12f4468

Browse files
committed
Add more modal components
1 parent a540db2 commit 12f4468

File tree

17 files changed

+297
-33
lines changed

17 files changed

+297
-33
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jderobot-ide-interface",
3-
"version": "0.1.34",
3+
"version": "0.1.35",
44
"main": "dist/main.js",
55
"typings": "dist/index.d.ts",
66
"files": [

src/components/Button/Button.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const Button = ({
3535
title={title}
3636
id={id}
3737
active={active}
38-
onClick={(e:any) => onClick(e)}
38+
onClick={(e: any) => onClick(e)}
3939
>
4040
{children}
4141
</StyledButton>
@@ -63,7 +63,7 @@ export const MenuButton = ({
6363
isLabel={false}
6464
title={title}
6565
id={id}
66-
onClick={(e:any) => onClick(e)}
66+
onClick={(e: any) => onClick(e)}
6767
>
6868
{children}
6969
</Button>
@@ -89,7 +89,7 @@ export const MenuButtonStroke = ({
8989
isLabel={false}
9090
title={title}
9191
id={id}
92-
onClick={(e:any) => onClick(e)}
92+
onClick={(e: any) => onClick(e)}
9393
>
9494
{children}
9595
</Button>
@@ -115,9 +115,9 @@ export const MenuButtonLabel = ({
115115
isLabel={true}
116116
title={title}
117117
id={id}
118-
onClick={(e:any) => onClick(e)}
118+
onClick={(e: any) => onClick(e)}
119119
>
120120
{children}
121121
</Button>
122122
);
123-
};
123+
};

src/components/Button/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
export { default as Button, MenuButton, MenuButtonStroke, MenuButtonLabel } from "./Button";
1+
export {
2+
default as Button,
3+
MenuButton,
4+
MenuButtonStroke,
5+
MenuButtonLabel,
6+
} from "./Button";

src/components/Explorer/Explorer.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const Explorer = ({
5555
const [deleteEntry, setDeleteEntry] = useState<Entry | undefined>(undefined);
5656
const [renameEntry, setRenameEntry] = useState<Entry | undefined>(undefined);
5757
const [selectedEntry, setSelectedEntry] = useState<Entry | undefined>(
58-
undefined
58+
undefined,
5959
);
6060
const [selectedLocation, setSelectedLocation] = useState("");
6161

@@ -107,7 +107,7 @@ const Explorer = ({
107107

108108
const inFileList = (list: Entry[], file?: Entry) => {
109109
if (file === undefined) {
110-
return false
110+
return false;
111111
}
112112

113113
for (const entry of list) {
@@ -206,7 +206,7 @@ const Explorer = ({
206206
//currentFile === Absolute File path
207207
if (currentFile) {
208208
if (inFileList(fileList, currentFile)) {
209-
handleDeleteModal(currentFile, false);
209+
handleDeleteModal(currentFile, false);
210210
}
211211
} else {
212212
warning("No file is currently selected.");
@@ -231,7 +231,7 @@ const Explorer = ({
231231

232232
const handleCreateFolderSubmit = async (
233233
location: string,
234-
folder_name: string
234+
folder_name: string,
235235
) => {
236236
if (folder_name !== "") {
237237
try {
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import type { Meta, StoryObj } from "@storybook/react";
2+
import NewFileModal from "./NewFileModal";
3+
import Modal, { ModalEditableList, ModalRow, ModalTitlebar } from "./Modal";
4+
5+
type Story = StoryObj<typeof ModalEditableList>;
6+
7+
const meta: Meta<typeof ModalEditableList> = {
8+
component: ModalEditableList,
9+
};
10+
11+
export default meta;
12+
13+
export const Main: Story = {
14+
render: (args) => (
15+
<div
16+
style={{
17+
width: "100vw",
18+
height: "100vh",
19+
}}
20+
>
21+
<Modal
22+
id="universes-modal"
23+
isOpen={true}
24+
onClose={() => {}}
25+
onSubmit={() => {}}
26+
onReset={() => {}}
27+
>
28+
<ModalTitlebar
29+
title="Manage your Universes"
30+
htmlFor="actionName"
31+
hasClose
32+
handleClose={() => {}}
33+
/>
34+
<ModalRow>
35+
<ModalEditableList
36+
list={[
37+
"a",
38+
"sfayguh",
39+
"stavyjb",
40+
"ycavybun",
41+
"cavshbjn",
42+
"acvsbhnj",
43+
"acvsbhnj",
44+
"acvsbhnj",
45+
"acvsbhnj",
46+
"acvsbhnj",
47+
"acvsbhnj",
48+
"acvsbhnj",
49+
"acvsbhnj",
50+
"acvsbhnj",
51+
]}
52+
onSelect={() => {}}
53+
onDelete={() => {}}
54+
/>
55+
</ModalRow>
56+
<ModalRow type="buttons">
57+
<button type="button" onClick={() => {}}>
58+
New custom universe
59+
</button>
60+
<button type="button" onClick={() => {}}>
61+
Import from zip
62+
</button>
63+
<button type="button" onClick={() => {}}>
64+
Import from
65+
</button>
66+
</ModalRow>
67+
</Modal>
68+
</div>
69+
),
70+
};

src/components/Modals/Modal.styles.ts

Lines changed: 90 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ interface StyledModalRowProps {
108108

109109
export const StyledModalRow = styled.div<StyledModalRowProps>`
110110
display: flex;
111-
flex-direction: column;
111+
flex-direction: column;
112112
align-items: center;
113113
114114
& select,
@@ -208,6 +208,7 @@ const handleValid = (p: StyledModalInputProps) => {
208208

209209
export const StyledModalInput = styled.div<StyledModalInputProps>`
210210
position: relative;
211+
width: 80%;
211212
212213
& label {
213214
position: absolute;
@@ -276,8 +277,94 @@ export const StyledModalInput = styled.div<StyledModalInputProps>`
276277
${handleValid}
277278
}
278279
279-
.bt-modal-complex-input-indications {
280-
color: var(--input-placeholder-text);
280+
& div {
281+
color: ${(p) => p.placeholderColor ?? primaryColor};
281282
font-size: 0.7rem;
283+
margin: 5px;
284+
}
285+
`;
286+
287+
interface StyledModalEditableListProps {
288+
color?: string;
289+
scrollBarColor?: string;
290+
bgColor?: string;
291+
entryColor?: string;
292+
hoverColor?: string;
293+
deleteColor?: string;
294+
roundness?: number;
295+
}
296+
297+
export const StyledModalEditableList = styled.ul<StyledModalEditableListProps>`
298+
display: flex;
299+
flex-direction: column;
300+
align-items: center;
301+
padding: 0px;
302+
overflow-y: auto;
303+
max-height: 60vh;
304+
width: 100%;
305+
306+
::-webkit-scrollbar {
307+
width: 5px;
308+
}
309+
310+
::-webkit-scrollbar-track {
311+
box-shadow: inset 0 0 5px ${(p) => p.scrollBarColor ?? primaryColor};
312+
border-radius: ${(p) => p.roundness ?? 1}px;
313+
}
314+
315+
::-webkit-scrollbar-thumb {
316+
background: ${(p) => p.scrollBarColor ?? primaryColor};
317+
border-radius: ${(p) => p.roundness ?? 1}px;
318+
}
319+
320+
& div {
321+
width: 90%;
322+
height: 3rem;
323+
min-height: 3rem;
324+
background-color: ${(p) => p.entryColor ?? primaryColor};
325+
padding: 5px;
326+
align-content: center;
327+
color: ${(p) => p.color ?? primaryColor};
328+
display: grid;
329+
grid-gap: 5px;
330+
grid-template-columns: auto 20px;
331+
332+
&:hover {
333+
background-color: ${(p) => p.hoverColor ?? primaryColor};
334+
335+
& svg {
336+
visibility: visible;
337+
}
338+
}
339+
340+
& label {
341+
background-color: transparent !important;
342+
margin-bottom: 0px !important;
343+
}
344+
345+
& svg {
346+
height: 100%;
347+
opacity: 0.4;
348+
width: 16px;
349+
height: 16px;
350+
padding: 2px;
351+
border-radius: ${(p) => p.roundness ?? 1}px;
352+
background-color: ${(p) => p.deleteColor ?? primaryColor};
353+
visibility: hidden;
354+
355+
&:hover {
356+
opacity: 0.8;
357+
}
358+
}
359+
}
360+
361+
& div:first-of-type {
362+
border-top-right-radius: 5px;
363+
border-top-left-radius: 5px;
364+
}
365+
366+
& div:last-of-type {
367+
border-bottom-right-radius: 5px;
368+
border-bottom-left-radius: 5px;
282369
}
283370
`;

0 commit comments

Comments
 (0)