mirror of
https://github.com/ritz078/transform.git
synced 2026-11-22 00:54:01 +03:00
* feat(ts-to-flow): add server side converter for typescript to flow * fixes
31 lines
752 B
TypeScript
31 lines
752 B
TypeScript
import ConversionPanel from "@components/ConversionPanel";
|
|
import * as React from "react";
|
|
import { useCallback } from "react";
|
|
import request from "@utils/request";
|
|
import { Alert } from "evergreen-ui";
|
|
|
|
export default function() {
|
|
const transformer = useCallback(
|
|
({ value }) => request("/api/typescript-to-flow", value),
|
|
[]
|
|
);
|
|
|
|
return (
|
|
<ConversionPanel
|
|
transformer={transformer}
|
|
editorTitle="TypeScript"
|
|
editorLanguage="typescript"
|
|
resultTitle="Flow"
|
|
resultLanguage={"plaintext"}
|
|
resultEditorProps={{
|
|
topNotifications: () => (
|
|
<Alert
|
|
backgroundColor="#e7f7ff"
|
|
title="This code is converted on the server."
|
|
/>
|
|
)
|
|
}}
|
|
/>
|
|
);
|
|
}
|