Update MethodName component to receive specific props (#3491)
This commit is contained in:
@@ -1,33 +1,48 @@
|
||||
import { styled } from "styled-components";
|
||||
import type { Method } from "../../model-editor/method";
|
||||
|
||||
const Name = styled.span`
|
||||
font-family: var(--vscode-editor-font-family);
|
||||
word-break: break-all;
|
||||
`;
|
||||
|
||||
const TypeMethodName = (method: Method) => {
|
||||
if (!method.typeName) {
|
||||
return <>{method.methodName}</>;
|
||||
const TypeMethodName = ({
|
||||
typeName,
|
||||
methodName,
|
||||
}: {
|
||||
typeName?: string;
|
||||
methodName?: string;
|
||||
}) => {
|
||||
if (!typeName) {
|
||||
return <>{methodName}</>;
|
||||
}
|
||||
|
||||
if (!method.methodName) {
|
||||
return <>{method.typeName}</>;
|
||||
if (!methodName) {
|
||||
return <>{typeName}</>;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{method.typeName}.{method.methodName}
|
||||
{typeName}.{methodName}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export const MethodName = (method: Method): React.JSX.Element => {
|
||||
export const MethodName = ({
|
||||
packageName,
|
||||
typeName,
|
||||
methodName,
|
||||
methodParameters,
|
||||
}: {
|
||||
packageName: string;
|
||||
typeName?: string;
|
||||
methodName?: string;
|
||||
methodParameters?: string;
|
||||
}): React.JSX.Element => {
|
||||
return (
|
||||
<Name>
|
||||
{method.packageName && <>{method.packageName}.</>}
|
||||
<TypeMethodName {...method} />
|
||||
{method.methodParameters}
|
||||
{packageName && <>{packageName}.</>}
|
||||
<TypeMethodName typeName={typeName} methodName={methodName} />
|
||||
{methodParameters}
|
||||
</Name>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user