Skip to content

Commit 3519139

Browse files
authored
Update MethodName component to receive specific props (#3491)
1 parent 724370f commit 3519139

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed
Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,48 @@
11
import { styled } from "styled-components";
2-
import type { Method } from "../../model-editor/method";
32

43
const Name = styled.span`
54
font-family: var(--vscode-editor-font-family);
65
word-break: break-all;
76
`;
87

9-
const TypeMethodName = (method: Method) => {
10-
if (!method.typeName) {
11-
return <>{method.methodName}</>;
8+
const TypeMethodName = ({
9+
typeName,
10+
methodName,
11+
}: {
12+
typeName?: string;
13+
methodName?: string;
14+
}) => {
15+
if (!typeName) {
16+
return <>{methodName}</>;
1217
}
1318

14-
if (!method.methodName) {
15-
return <>{method.typeName}</>;
19+
if (!methodName) {
20+
return <>{typeName}</>;
1621
}
1722

1823
return (
1924
<>
20-
{method.typeName}.{method.methodName}
25+
{typeName}.{methodName}
2126
</>
2227
);
2328
};
2429

25-
export const MethodName = (method: Method): React.JSX.Element => {
30+
export const MethodName = ({
31+
packageName,
32+
typeName,
33+
methodName,
34+
methodParameters,
35+
}: {
36+
packageName: string;
37+
typeName?: string;
38+
methodName?: string;
39+
methodParameters?: string;
40+
}): React.JSX.Element => {
2641
return (
2742
<Name>
28-
{method.packageName && <>{method.packageName}.</>}
29-
<TypeMethodName {...method} />
30-
{method.methodParameters}
43+
{packageName && <>{packageName}.</>}
44+
<TypeMethodName typeName={typeName} methodName={methodName} />
45+
{methodParameters}
3146
</Name>
3247
);
3348
};

0 commit comments

Comments
 (0)