Skip to content

Commit ef552e4

Browse files
authored
Big fat New Years refactor (#151)
* renamed Frameworks (cherry picked from commit 533bbd8e6202ad903f2783683cf82fc860c26f0e) * removed unused. fixed typo (cherry picked from commit 79d76a358a05b0544af1859ad2eb55888e077c8a) * extracted components from plugin-ui * added warning icon to components * updated tsconfig * removing unused code * Add code type automatically when posting code message * Moved convert to code to its own file. also made htmlpreview a single step. * renamed some things and removed exports from some local functions * removed unused code in alt conversion * altnode conversion WIP * continuing refactor of alt node conversion. WIP * finished refactoring alt nodes * removed AltNode type
1 parent 9e224a5 commit ef552e4

File tree

26 files changed

+743
-1210
lines changed

26 files changed

+743
-1210
lines changed

apps/debug/pages/index.tsx

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { FrameworkTypes } from "types";
1+
import { Framework } from "types";
22
import * as React from "react";
33
import { PluginUI } from "plugin-ui";
44

55
export default function Web() {
66
const [selectedFramework, setSelectedFramework] =
7-
React.useState<FrameworkTypes>("HTML");
7+
React.useState<Framework>("HTML");
88

99
const testWarnings = ["This is an example of a conversion warning message."];
1010

@@ -18,9 +18,7 @@ export default function Web() {
1818
<div className="bg-white w-96 shadow-md rounded-md">
1919
<PluginFigmaToolbar variant="(Light)" />
2020
<PluginUI
21-
code={
22-
"backend:dev: CJS dist/index.js 105.74 KB backend:dev: CJS ⚡️ Build success in 419ms plugin:dev: warn - Port 3000 is in use, trying 3001 instead. plugin:dev: warn - Port 3001 is in use, trying 3002 instead."
23-
}
21+
code={"code goes hereeeee"}
2422
selectedFramework={selectedFramework}
2523
setSelectedFramework={setSelectedFramework}
2624
htmlPreview={null}
@@ -50,26 +48,6 @@ export default function Web() {
5048
</div>
5149
</div>
5250
</div>
53-
{/* <div>Templates for debugging</div>
54-
<div className="flex space-x-4">
55-
{[1, 2, 3, 4, 5].map((d) => (
56-
<div
57-
key={`row ${d}`}
58-
className={`bg-gray-400 w-28 h-28 rounded ${
59-
d == 1 ? "ring-2 ring-green-500" : ""
60-
}`}
61-
>
62-
<Image
63-
src="https://images.unsplash.com/photo-1678653300204-75de70535454?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=120&q=0"
64-
alt="A random image"
65-
width={112}
66-
height={112}
67-
style={{ objectFit: "cover" }}
68-
className="rounded"
69-
/>
70-
</div>
71-
))}
72-
</div> */}
7351

7452
<div>Plugin dropdown selection (each frame a different breakpoint)</div>
7553
<div className="flex space-x-4">
@@ -97,7 +75,6 @@ export default function Web() {
9775

9876
const PluginFigmaToolbar = (props: { variant: string }) => (
9977
<div className="bg-gray-800 w-full h-8 flex items-center text-white space-x-4 px-4">
100-
{/* <div className="bg-white w-4 h-4 rounded" /> */}
10178
<span>Figma to Code {props.variant}</span>
10279
</div>
10380
);

apps/plugin/plugin-src/code.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { PluginSettings, SettingWillChangeMessage } from "types";
1616

1717
let userPluginSettings: PluginSettings;
1818

19-
const defaultPluginSettings: PluginSettings = {
19+
export const defaultPluginSettings: PluginSettings = {
2020
framework: "HTML",
2121
jsx: false,
2222
optimizeLayout: true,

apps/plugin/ui-src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useEffect, useState } from "react";
22
import { PluginUI } from "plugin-ui";
33
import {
4-
FrameworkTypes,
4+
Framework,
55
PluginSettings,
66
ConversionMessage,
77
Message,
@@ -16,7 +16,7 @@ import { postUISettingsChangingMessage } from "./messaging";
1616

1717
interface AppState {
1818
code: string;
19-
selectedFramework: FrameworkTypes;
19+
selectedFramework: Framework;
2020
isLoading: boolean;
2121
htmlPreview: HTMLPreview;
2222
settings: PluginSettings | null;
@@ -119,7 +119,7 @@ export default function App() {
119119
) : null;
120120
}
121121

122-
const handleFrameworkChange = (updatedFramework: FrameworkTypes) => {
122+
const handleFrameworkChange = (updatedFramework: Framework) => {
123123
setState((prevState) => ({
124124
...prevState,
125125
// code: "// Loading...",

0 commit comments

Comments
 (0)