Skip to content

Commit 8e83999

Browse files
committed
Use transient props for Alert component
1 parent eaf3a1c commit 8e83999

File tree

1 file changed

+12
-12
lines changed
  • extensions/ql-vscode/src/view/common

1 file changed

+12
-12
lines changed

extensions/ql-vscode/src/view/common/Alert.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,46 @@ import { ReactNode } from "react";
33
import { styled } from "styled-components";
44

55
type ContainerProps = {
6-
type: "warning" | "error";
7-
inverse?: boolean;
6+
$type: "warning" | "error";
7+
$inverse?: boolean;
88
};
99

10-
const getBackgroundColor = ({ type, inverse }: ContainerProps): string => {
11-
if (!inverse) {
10+
const getBackgroundColor = ({ $type, $inverse }: ContainerProps): string => {
11+
if (!$inverse) {
1212
return "var(--vscode-notifications-background)";
1313
}
1414

15-
switch (type) {
15+
switch ($type) {
1616
case "warning":
1717
return "var(--vscode-editorWarning-foreground)";
1818
case "error":
1919
return "var(--vscode-debugExceptionWidget-border)";
2020
}
2121
};
2222

23-
const getTextColor = ({ type, inverse }: ContainerProps): string => {
24-
if (!inverse) {
23+
const getTextColor = ({ $type, $inverse }: ContainerProps): string => {
24+
if (!$inverse) {
2525
return "var(--vscode-editor-foreground)";
2626
}
2727

28-
switch (type) {
28+
switch ($type) {
2929
case "warning":
3030
return "var(--vscode-editor-background)";
3131
case "error":
3232
return "var(--vscode-list-activeSelectionForeground)";
3333
}
3434
};
3535

36-
const getBorderColor = ({ type }: ContainerProps): string => {
37-
switch (type) {
36+
const getBorderColor = ({ $type }: ContainerProps): string => {
37+
switch ($type) {
3838
case "warning":
3939
return "var(--vscode-editorWarning-foreground)";
4040
case "error":
4141
return "var(--vscode-editorError-foreground)";
4242
}
4343
};
4444

45-
const getTypeText = (type: ContainerProps["type"]): string => {
45+
const getTypeText = (type: ContainerProps["$type"]): string => {
4646
switch (type) {
4747
case "warning":
4848
return "Warning";
@@ -108,7 +108,7 @@ export const Alert = ({
108108
role,
109109
}: Props) => {
110110
return (
111-
<Container type={type} inverse={inverse} role={role}>
111+
<Container $type={type} $inverse={inverse} role={role}>
112112
<Title>
113113
{getTypeText(type)}: {title}
114114
</Title>

0 commit comments

Comments
 (0)