Skip to content

Commit 1688c1f

Browse files
authored
Merge pull request #19 from jzuniga206/feature
Added Better Visuals to Component Cards
2 parents 8d0f024 + 3b9860a commit 1688c1f

File tree

6 files changed

+77
-59
lines changed

6 files changed

+77
-59
lines changed

package-lock.json

Lines changed: 2 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/actions/components.ts

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import {
2-
ComponentInt, ComponentsInt, PropInt, ChildInt, Action
2+
ComponentInt,
3+
ComponentsInt,
4+
PropInt,
5+
ChildInt,
6+
Action
37
} from '../utils/Interfaces';
48

59
import {
@@ -26,7 +30,7 @@ import {
2630
ADD_PROP,
2731
DELETE_ALL_DATA,
2832
UPDATE_HTML_ATTR,
29-
// UPDATE_CHILDREN_SORT, --The reason why this is commented out is because of the unused reducer of the same name, for the component that is unfinished with the same name. Check out the Sort Children component to see what it does.
33+
// UPDATE_CHILDREN_SORT, --The reason why this is commented out is because of the unused reducer of the same name, for the component that is unfinished with the same name. Check out the Sort Children component to see what it does.
3034
CHANGE_IMAGE_SOURCE,
3135
DELETE_IMAGE
3236
} from '../actionTypes/index';
@@ -51,7 +55,9 @@ export const loadInitData = () => (dispatch: (arg: Action) => void) => {
5155
});
5256
};
5357

54-
export const addComponent = ({ title }: { title: string }) => (dispatch: (arg: Action) => void) => {
58+
export const addComponent = ({ title }: { title: string }) => (
59+
dispatch: (arg: Action) => void
60+
) => {
5561
dispatch({ type: ADD_COMPONENT, payload: { title } });
5662
};
5763

@@ -81,7 +87,7 @@ export const deleteComponent = ({
8187
}) => (dispatch: (arg: Action) => void) => {
8288
// find all places where the "to be deleted" is a child and do what u gotta do
8389
stateComponents.forEach((parent: ComponentInt) => {
84-
parent.childrenArrayChildInt
90+
parent.childrenArray
8591
.filter((child: ChildInt) => child.childComponentId === componentId)
8692
.forEach((child: ChildInt) => {
8793
dispatch({
@@ -169,7 +175,12 @@ export const handleClose = () => ({
169175
export const handleTransform = (
170176
componentId: number,
171177
childId: number,
172-
{ x, y, width, height }: { x: number; y: number; width: number; height: number }
178+
{
179+
x,
180+
y,
181+
width,
182+
height
183+
}: { x: number; y: number; width: number; height: number }
173184
) => ({
174185
type: HANDLE_TRANSFORM,
175186
payload: {
@@ -246,15 +257,21 @@ export const deleteAllData = () => ({
246257
type: DELETE_ALL_DATA
247258
});
248259

249-
export const deleteProp = (propId: number) => (dispatch: (arg: Action) => void) => {
260+
export const deleteProp = (propId: number) => (
261+
dispatch: (arg: Action) => void
262+
) => {
250263
dispatch({ type: DELETE_PROP, payload: propId });
251264
};
252265

253-
export const toggleComponentState = (id: string) => (dispatch: (arg: Action) => void) => {
266+
export const toggleComponentState = (id: string) => (
267+
dispatch: (arg: Action) => void
268+
) => {
254269
dispatch({ type: TOGGLE_STATE, payload: id });
255270
};
256271

257-
export const toggleComponentClass = (id: string) => (dispatch: (arg: Action) => void) => {
272+
export const toggleComponentClass = (id: string) => (
273+
dispatch: (arg: Action) => void
274+
) => {
258275
dispatch({ type: TOGGLE_CLASS, payload: id });
259276
};
260277

@@ -263,9 +280,13 @@ export const addProp = (prop: PropInt) => ({
263280
payload: { ...prop }
264281
});
265282

266-
export const updateHtmlAttr = ({ attr, value }: { attr: string; value: string }) => (
267-
dispatch: (arg: Action) => void
268-
) => {
283+
export const updateHtmlAttr = ({
284+
attr,
285+
value
286+
}: {
287+
attr: string;
288+
value: string;
289+
}) => (dispatch: (arg: Action) => void) => {
269290
dispatch({
270291
type: UPDATE_HTML_ATTR,
271292
payload: { attr, value }

src/components/LeftColExpansionPanel.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const LeftColExpansionPanel = (props: any) => {
5151
!isFocused() ? {} : { boxShadow: '0 10px 10px rgba(0,0,0,0.25)' }
5252
}
5353
>
54-
<Grid item xs={12} style={{ color: 'red' }}>
54+
<Grid item xs={12} style={{ color: 'red', backgroundColor: color }}>
5555
<List style={{ color: 'red' }}>
5656
<ListItem
5757
button
@@ -65,7 +65,14 @@ const LeftColExpansionPanel = (props: any) => {
6565
className={classes.light}
6666
primary={
6767
<div>
68-
<Typography type='body2' style={{ color }}>
68+
<Typography
69+
type='body2'
70+
style={{
71+
color: '#fff',
72+
textShadow: '1px 1px 2px rgba(0, 0, 0, 0.2)',
73+
fontSize: '1.40rem'
74+
}}
75+
>
6976
{title}
7077
</Typography>
7178
{/* TOGGLE FOR STATEFULNESS */}
@@ -93,8 +100,8 @@ const LeftColExpansionPanel = (props: any) => {
93100
toggleComponentState(id);
94101
changeFocusComponent(title);
95102
}}
96-
value="stateful"
97-
color="primary"
103+
value='stateful'
104+
color='primary'
98105
id={props.id.toString()}
99106
// id={props.index.toString()}
100107
/>
@@ -119,8 +126,8 @@ const LeftColExpansionPanel = (props: any) => {
119126
toggleComponentClass(id);
120127
changeFocusComponent(title);
121128
}}
122-
value="classBased"
123-
color="primary"
129+
value='classBased'
130+
color='primary'
124131
/>
125132
</div>
126133
</div>
@@ -149,7 +156,7 @@ const LeftColExpansionPanel = (props: any) => {
149156
style={{
150157
color: '#D3D3D3',
151158
marginBottom: '10px',
152-
marginTop: '0px',
159+
marginTop: '4px',
153160
marginLeft: '11px',
154161
padding: '0px'
155162
}}

src/public/styles/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ LEFT COLUMN
102102
display: flex;
103103
/* max-height: 80%; */
104104
height: 60%;
105-
overflow-y: scroll;
105+
overflow-y: auto;
106106
overflow-x: hidden;
107107
padding: 1%;
108108
}

src/reducers/componentReducer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ import {
5555
updateChildrenSort,
5656
toggleComponentState,
5757
toggleComponentClass
58-
} from '../utils/componentReducer.util.ts';
59-
import cloneDeep from '../utils/cloneDeep.ts';
58+
} from '../utils/componentReducer.util';
59+
import cloneDeep from '../utils/cloneDeep';
6060

6161
const appComponent: ComponentInt = {
6262
id: 1,

src/utils/colors.util.ts

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
1-
const colors: Array<string> = [
2-
'#E27D60',
3-
'#E3AFBC',
4-
'#E8A87C',
5-
'#C38D9E',
6-
'#41B3A3',
7-
'#D12FA2',
8-
'#F64C72',
9-
'#DAAD86',
10-
'#8EE4AF',
11-
'#5CDB95',
12-
'#7395AE', // light grey
13-
'#b90061',
14-
'#AFD275',
15-
'#45A29E',
16-
'#D79922',
17-
'#C5CBE3', // lightish grey
18-
'#FFCB9A',
19-
'#E98074',
20-
'#8860D0',
21-
'#5AB9EA',
22-
'#5860E9',
23-
'#84CEEB',
24-
'#61892F',
1+
const colors: string[] = [
2+
'#e27d60',
3+
'#575757',
4+
'#e8a87c',
5+
'#c38d9e',
6+
'#41b3a3',
7+
'#d12fa2',
8+
'#f64c72',
9+
'#c99261',
10+
'#355586',
11+
'#5cdb95',
12+
'#7395ae',
13+
'#981d5c',
14+
'#556738',
15+
'#45a29e',
16+
'#d79922',
17+
'#0a2aa9',
18+
'#9f2b17',
19+
'#e98074',
20+
'#8860d0',
21+
'#5ab9ea',
22+
'#5860e9',
23+
'#84ceeb',
24+
'#61892f'
2525
];
2626

27-
const getColor = (): string => colors[Math.floor(Math.random() * colors.length)];
27+
const getColor = (): string =>
28+
colors[Math.floor(Math.random() * colors.length)];
2829

2930
export default getColor;

0 commit comments

Comments
 (0)