Skip to content

Commit 653149a

Browse files
committed
Made more typing changes -stiill need to fix HTMLAttr
1 parent 106080e commit 653149a

File tree

4 files changed

+18
-23
lines changed

4 files changed

+18
-23
lines changed

src/components/CodePreview.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import { ComponentInt, ComponentsInt } from '../utils/Interfaces';
55
/** ** SortCHildren will be fixed , dont XXX the file *** */
66
// import SortChildren from './SortChildren.tsx';
77
import SyntaxHighlighter from 'react-syntax-highlighter';
8-
import { hybrid } from 'react-syntax-highlighter/dist/styles/hljs/';
8+
import { hybrid } from 'react-syntax-highlighter/dist/cjs/styles/hljs';
99

10-
type Props = {
10+
type CodePreviewProps = {
1111
focusComponent: ComponentInt;
1212
components: ComponentsInt;
1313
};
1414

15-
class CodePreview extends Component<Props> {
15+
class CodePreview extends Component<CodePreviewProps> {
1616
render(): JSX.Element {
1717
const focusComponent: ComponentInt = this.props.focusComponent;
1818
const components: ComponentsInt = this.props.components;
@@ -27,12 +27,12 @@ class CodePreview extends Component<Props> {
2727
>
2828
<SyntaxHighlighter style={hybrid}>
2929
{format(componentRender(focusComponent, components), {
30-
singleQuote: true,
31-
trailingComma: 'es5',
32-
bracketSpacing: true,
33-
jsxBracketSameLine: true,
34-
parser: 'typescript'
35-
})}
30+
singleQuote: true,
31+
trailingComma: 'es5',
32+
bracketSpacing: true,
33+
jsxBracketSameLine: true,
34+
parser: 'typescript'
35+
})}
3636
</SyntaxHighlighter>
3737
</div>
3838
);

src/components/GrandchildRectangle.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ interface GrandChRectPropsInt extends PropsInt {
2222
draggable?: boolean;
2323
blockSnapSize?: number;
2424
childType: string;
25-
handleTransform?(
25+
handleTransform?: (
2626
componentId: number,
2727
childId: number,
2828
dimensions: { x: number; y: number; width: number; height: number }
29-
): void;
29+
) => void;
3030
}
3131

3232
interface StateInt {

src/components/HtmlAttr.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@ import Fab from '@material-ui/core/Fab';
1111
import InputLabel from '@material-ui/core/InputLabel';
1212
import { updateHtmlAttr } from '../actions/components';
1313
import { HTMLelements } from '../utils/htmlElements.util';
14-
import { ComponentInt, ChildInt } from '../utils/Interfaces';
14+
import { ComponentInt, ChildInt, PropsInt, PropInt } from '../utils/Interfaces';
1515

16-
interface PropsInt {
17-
updateHtmlAttr: any;
18-
focusComponent: ComponentInt;
16+
interface HTMLAttrPropsInt extends PropsInt {
17+
updateHtmlAttr(arg: { attr: string; value: string }): void;
1918
classes: any;
20-
deleteProp: any;
21-
addProp: any;
22-
focusChild: ChildInt;
19+
deleteProp(id: number): void;
20+
addProp(prop: PropInt): void;
2321
}
2422

2523
interface StateInt {}
@@ -72,14 +70,12 @@ const buttonTypeOptions = [
7270
];
7371

7472
// this is a variable to save temp state for button types
75-
let buttonTypeTemp;
73+
let buttonTypeTemp: string;
7674

7775
// HtmlAttr is creating attributes grabbed from htmlElement & placing them
7876
// as the new state
79-
class HtmlAttr extends Component<PropsInt, StateInt> {
77+
class HtmlAttr extends Component<HTMLAttrPropsInt, StateInt> {
8078
state = HTMLelements[this.props.focusChild.htmlElement].attributes.reduce((acc, attr) => {
81-
// if ((attr = 'button' || 'submit' || 'reset')) acc[attr] = '';
82-
// else
8379
acc[attr] = '';
8480

8581
return acc;

src/components/Rectangle.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ class Rectangle extends Component<RectanglePorpsInt> {
218218
draggable && ( //this conditional logic binds the transformer to the focused child, and Draggable is checked to make sure grandchildren can't be selected
219219
<TransformerComponent //This is the component that binds the Rect nodes to the Transformer node so they can be resized.
220220
focusChild={focusChild}
221-
{/*rectClass={'childRect'}*/}
222221
anchorSize={8}
223222
color={'grey'}
224223
/>

0 commit comments

Comments
 (0)