mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
feat: add TypeScript support
This commit is contained in:
8
frontend/ts/package.json
Normal file
8
frontend/ts/package.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "@penpot/ts",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"type": "module",
|
||||
"packageManager": "yarn@4.3.1"
|
||||
}
|
||||
3
frontend/ts/src/components/test-tsx.module.css
Normal file
3
frontend/ts/src/components/test-tsx.module.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.title {
|
||||
color: green;
|
||||
}
|
||||
16
frontend/ts/src/components/test-tsx.stories.tsx
Normal file
16
frontend/ts/src/components/test-tsx.stories.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
//
|
||||
// Copyright (c) KALEIDOS INC
|
||||
|
||||
import {TestTsxComponent } from "./test-tsx";
|
||||
|
||||
export default {
|
||||
title: "TestTSX",
|
||||
component: TestTsxComponent,
|
||||
argTypes: {},
|
||||
parameters: {},
|
||||
};
|
||||
|
||||
export const Default = {};
|
||||
11
frontend/ts/src/components/test-tsx.tsx
Normal file
11
frontend/ts/src/components/test-tsx.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import styles from './test-tsx.module.css';
|
||||
|
||||
import { translate } from '../penpot-bridge';
|
||||
|
||||
export const TestTsxComponent = () => {
|
||||
return (
|
||||
<div>
|
||||
<h2 className={styles.title}>{translate("labels.delete")} xx</h2>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
4
frontend/ts/src/index.tsx
Normal file
4
frontend/ts/src/index.tsx
Normal file
@@ -0,0 +1,4 @@
|
||||
/* eslint-disable */
|
||||
|
||||
export { TestTsxComponent } from "./components/test-tsx";
|
||||
export { setTranslation } from "./penpot-bridge";
|
||||
7
frontend/ts/src/penpot-bridge.ts
Normal file
7
frontend/ts/src/penpot-bridge.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export let translate = (key: string) => {
|
||||
return key;
|
||||
};
|
||||
|
||||
export function setTranslation(translations: (key: string) => string) {
|
||||
translate = translations;
|
||||
}
|
||||
Reference in New Issue
Block a user