-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
balajisoundar
committed
Dec 1, 2023
1 parent
a722329
commit 1d522c3
Showing
22 changed files
with
545 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Layouts/TabsLayout/styles.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 0 additions & 47 deletions
47
app/client/src/pages/Editor/CustomWidgetBuilder/Preview.tsx
This file was deleted.
Oops, something went wrong.
76 changes: 76 additions & 0 deletions
76
app/client/src/pages/Editor/CustomWidgetBuilder/Preview/Debugger/consoleItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React from "react"; | ||
import { Icon } from "design-system"; | ||
import styles from "./styles.module.css"; | ||
import HelpDropdown from "./helpDropdown"; | ||
|
||
export interface ConsoleItemProps { | ||
type: string; | ||
args: unknown[]; | ||
} | ||
|
||
const getIcon = (type: ConsoleItemProps["type"]) => { | ||
switch (type) { | ||
case "error": | ||
return ( | ||
<Icon | ||
name="close-circle" | ||
size="md" | ||
style={{ | ||
color: "var(--ads-v2-color-red-600)", | ||
}} | ||
/> | ||
); | ||
case "warn": | ||
return ( | ||
<Icon | ||
name="alert-fill" | ||
size="md" | ||
style={{ | ||
color: "var(--ads-v2-color-yellow-600)", | ||
}} | ||
/> | ||
); | ||
case "log": | ||
return <Icon name="snippet" size="md" />; | ||
default: | ||
return <Icon name="snippet" size="md" />; | ||
} | ||
}; | ||
|
||
const getContent = (type: string, args: unknown[]) => { | ||
return args.reduce((prev: string, cur) => { | ||
return prev + " " + cur?.toString?.(); | ||
}, ""); | ||
}; | ||
|
||
const getBackgroundColor = (type: ConsoleItemProps["type"]) => { | ||
switch (type) { | ||
case "error": | ||
return "var(--ads-v2-color-red-50)"; | ||
case "warn": | ||
return "var(--ads-v2-color-yellow-100)"; | ||
default: | ||
return "#fff"; | ||
} | ||
}; | ||
|
||
export default function ConsoleItem(props: ConsoleItemProps) { | ||
const { args, type } = props; | ||
|
||
return ( | ||
<div | ||
className={styles.consoleItem} | ||
style={{ | ||
background: getBackgroundColor(props.type), | ||
}} | ||
> | ||
<div className={styles.consoleItemIcon}>{getIcon(props.type)}</div> | ||
<div className={styles.consoleItemMessage}>{getContent(type, args)}</div> | ||
{type === "error" && args.length === 1 && ( | ||
<div className={styles.consoleItemHelp}> | ||
<HelpDropdown args={args} type={type} /> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.