diff --git a/app/client/src/constants/ActionConstants.tsx b/app/client/src/constants/ActionConstants.tsx index 4fb455989b..dd09ea7190 100644 --- a/app/client/src/constants/ActionConstants.tsx +++ b/app/client/src/constants/ActionConstants.tsx @@ -9,6 +9,11 @@ export type ActionType = | "REMOVE_WIDGET_CANVAS" | "LOAD_WIDGET_PANE" | "FETCH_PAGE" + | "ZOOM_IN_CANVAS" + | "ZOOM_OUT_CANVAS" + | "PUBLISH" + | "UNDO_CANVAS_ACTION" + | "REDO_CANVAS_ACTION" export const ActionTypes: { [id: string]: ActionType } = { UPDATE_CANVAS: "UPDATE_CANVAS", @@ -17,7 +22,12 @@ export const ActionTypes: { [id: string]: ActionType } = { FETCH_PAGE: "FETCH_PAGE", DROP_WIDGET_CANVAS: "DROP_WIDGET_CANVAS", REMOVE_WIDGET_CANVAS: "REMOVE_WIDGET_CANVAS", - LOAD_WIDGET_PANE: "LOAD_WIDGET_PANE" + LOAD_WIDGET_PANE: "LOAD_WIDGET_PANE", + ZOOM_IN_CANVAS: "ZOOM_IN_CANVAS", + ZOOM_OUT_CANVAS: "ZOOM_OUT_CANVAS", + UNDO_CANVAS_ACTION: "UNDO_CANVAS_ACTION", + REDO_CANVAS_ACTION: "REDO_CANVAS_ACTION", + PUBLISH: "PUBLISH" } export interface ReduxAction { @@ -33,3 +43,5 @@ export interface LoadCanvasPayload { export interface LoadWidgetPanePayload { widgets: IWidgetProps[] } + + diff --git a/app/client/src/editorComponents/ContainerComponent.tsx b/app/client/src/editorComponents/ContainerComponent.tsx index 027b35c87f..f79d4892f6 100644 --- a/app/client/src/editorComponents/ContainerComponent.tsx +++ b/app/client/src/editorComponents/ContainerComponent.tsx @@ -4,8 +4,8 @@ import styled from "../constants/DefaultTheme" import React from "react" export const Container = styled("div")` - display: "flex" - flexDirection: ${props => { + display: flex; + flex-direction: ${props => { return props.orientation === "HORIZONTAL" ? "row" : "column" }}; background: ${props => props.style.backgroundColor}; diff --git a/app/client/src/index.css b/app/client/src/index.css index cee5f348fb..0773dc6c88 100755 --- a/app/client/src/index.css +++ b/app/client/src/index.css @@ -6,6 +6,7 @@ body { sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; + background: #efefef; } code { diff --git a/app/client/src/mockResponses/CanvasResponse.tsx b/app/client/src/mockResponses/CanvasResponse.tsx index d8f7b20a5a..658259a0e6 100644 --- a/app/client/src/mockResponses/CanvasResponse.tsx +++ b/app/client/src/mockResponses/CanvasResponse.tsx @@ -6,9 +6,9 @@ const CanvasResponse: IContainerWidgetProps = { widgetType: "CONTAINER_WIDGET", snapColumns: 10, snapRows: 10, - topRow: 100, + topRow: 60, bottomRow: 700, - leftColumn: 100, + leftColumn: 300, rightColumn: 1000, parentColumnSpace: 1, parentRowSpace: 1, diff --git a/app/client/src/pages/Editor/Canvas.tsx b/app/client/src/pages/Editor/Canvas.tsx index ebfdc010df..1e9d55ddc3 100644 --- a/app/client/src/pages/Editor/Canvas.tsx +++ b/app/client/src/pages/Editor/Canvas.tsx @@ -19,11 +19,7 @@ class Canvas extends Component<{ render() { const pageWidget = this.props.pageWidget - return ( -
- {pageWidget ? WidgetFactory.createWidget(pageWidget) : undefined} -
- ) + return pageWidget ? WidgetFactory.createWidget(pageWidget) : null } } diff --git a/app/client/src/pages/Editor/EditorHeader.tsx b/app/client/src/pages/Editor/EditorHeader.tsx new file mode 100644 index 0000000000..01f6ee5f02 --- /dev/null +++ b/app/client/src/pages/Editor/EditorHeader.tsx @@ -0,0 +1,36 @@ +import React, { Component } from "react" +import styled from "styled-components" +import { connect } from "react-redux" +import { AppState } from "../../reducers" +import WidgetFactory from "../../utils/WidgetFactory" +import { EditorHeaderReduxState } from "../../reducers/uiReducers/editorHeaderReducer"; +import { IWidgetProps } from "../../widgets/BaseWidget"; + +const Header = styled.header` + height: 50px; + box-shadow: 0px 0px 3px #ccc; + background: #fff; +`; + + +class EditorHeader extends Component { + render() { + return ( +
+
+ ) + } +} + +const mapStateToProps = (state: AppState, props: any): EditorHeaderReduxState => { + return {} +} + +const mapDispatchToProps = (dispatch: any) => { + return {} +} + +export default connect( + mapStateToProps, + mapDispatchToProps +)(EditorHeader) diff --git a/app/client/src/pages/Editor/WidgetPane.tsx b/app/client/src/pages/Editor/WidgetPane.tsx index c2b2e5697d..b2430eda12 100644 --- a/app/client/src/pages/Editor/WidgetPane.tsx +++ b/app/client/src/pages/Editor/WidgetPane.tsx @@ -7,9 +7,9 @@ import { IWidgetProps } from "../../widgets/BaseWidget"; class WidgetPane extends Component { render() { - return (
+ return (
{this.props.widgets.map((widget: IWidgetProps) => { - return WidgetFactory.createWidget(widget) + })}
) } diff --git a/app/client/src/pages/Editor/index.tsx b/app/client/src/pages/Editor/index.tsx index 7d5ae1c9d1..16d1f92d29 100644 --- a/app/client/src/pages/Editor/index.tsx +++ b/app/client/src/pages/Editor/index.tsx @@ -1,13 +1,40 @@ import React, { Component } from "react" +import styled from "styled-components" import Canvas from "./Canvas" import WidgetPane from "./WidgetPane" +import EditorHeader from "./EditorHeader" +import { CALCULATOR } from "@blueprintjs/icons/lib/esm/generated/iconContents"; + +const ArtBoard = styled.section` + height: 100%; + width: 100%; + position: relative; + overflow-x: hidden; + overflow-y: auto; + margin: 0px 10px; +`; class Editor extends Component { render() { return ( -
- +
+ +
+ + + +
) } diff --git a/app/client/src/reducers/index.tsx b/app/client/src/reducers/index.tsx index 2386a3311a..a143d944cb 100644 --- a/app/client/src/reducers/index.tsx +++ b/app/client/src/reducers/index.tsx @@ -4,6 +4,7 @@ import uiReducer from "./uiReducers" import { CanvasReduxState } from "./uiReducers/canvasReducer" import { CanvasWidgetsReduxState } from "./entityReducers/canvasWidgetsReducers" import { WidgetPaneReduxState } from "./uiReducers/widgetPaneReducer" +import { EditorHeaderReduxState } from "./uiReducers/editorHeaderReducer" const appReducer = combineReducers({ entities: entityReducer, @@ -16,6 +17,7 @@ export interface AppState { ui: { canvas: CanvasReduxState widgetPane: WidgetPaneReduxState + editorHeader: EditorHeaderReduxState } entities: { canvasWidgets: CanvasWidgetsReduxState diff --git a/app/client/src/reducers/uiReducers/editorHeaderReducer.tsx b/app/client/src/reducers/uiReducers/editorHeaderReducer.tsx new file mode 100644 index 0000000000..077ffbb277 --- /dev/null +++ b/app/client/src/reducers/uiReducers/editorHeaderReducer.tsx @@ -0,0 +1,13 @@ +import { createReducer } from "../../utils/PicassoUtils" +import { + ActionTypes, + ReduxAction +} from "../../constants/ActionConstants" + +const initialState: EditorHeaderReduxState = {} + +const editorHeaderReducer = createReducer(initialState, {}) + +export interface EditorHeaderReduxState {} + +export default editorHeaderReducer diff --git a/app/client/src/reducers/uiReducers/index.tsx b/app/client/src/reducers/uiReducers/index.tsx index e2c410602d..38ed00db59 100644 --- a/app/client/src/reducers/uiReducers/index.tsx +++ b/app/client/src/reducers/uiReducers/index.tsx @@ -1,6 +1,7 @@ import { combineReducers } from "redux" import canvasReducer from "./canvasReducer" -import widgetPaneReducer from "./widgetPaneReducer"; +import widgetPaneReducer from "./widgetPaneReducer" +import editorHeaderReducer from "./editorHeaderReducer" -const uiReducer = combineReducers({ canvas: canvasReducer, widgetPane: widgetPaneReducer }) +const uiReducer = combineReducers({ canvas: canvasReducer, widgetPane: widgetPaneReducer, editorHeader: editorHeaderReducer }) export default uiReducer diff --git a/app/client/yarn.lock b/app/client/yarn.lock index 67b9b79ca5..d950239b51 100755 --- a/app/client/yarn.lock +++ b/app/client/yarn.lock @@ -2962,6 +2962,15 @@ dnd-core@^7.4.0: lodash "^4.17.11" redux "^4.0.1" +dnd-core@^7.7.0: + version "7.7.0" + resolved "https://registry.yarnpkg.com/dnd-core/-/dnd-core-7.7.0.tgz#3166aefc8c5b85ca4ade4ae836712a3108975fab" + integrity sha512-+YqwflWEY1MEAEl2QiEiRaglYkCwIZryyQwximQGuTOm/ns7fS6Lg/i7OCkrtjM10D5FhArf/VUHIL4ZaRBK0g== + dependencies: + asap "^2.0.6" + invariant "^2.2.4" + redux "^4.0.1" + dns-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/dns-equal/-/dns-equal-1.0.0.tgz#b39e7f1da6eb0a75ba9c17324b34753c47e0654d" @@ -7695,12 +7704,12 @@ react-dev-utils@^7.0.1: strip-ansi "4.0.0" text-table "0.2.0" -react-dnd-html5-backend@^7.4.3: - version "7.4.0" - resolved "https://registry.yarnpkg.com/react-dnd-html5-backend/-/react-dnd-html5-backend-7.4.0.tgz#d9c328a0c2a3ec0b73ae805c038f09827a7490ce" +react-dnd-html5-backend@^7.4.0: + version "7.7.0" + resolved "https://registry.yarnpkg.com/react-dnd-html5-backend/-/react-dnd-html5-backend-7.7.0.tgz#e2b8ea61a1bc34ba743b89cafcda6213b006c06a" + integrity sha512-JgKmWOxqorFyfGPeWV+SAPhVGFe6+LrOR24jETE9rrYZU5hCppzwK9ujjS508kWibeDvbfEgi9j5qC2wB1/MoQ== dependencies: - dnd-core "^7.4.0" - lodash "^4.17.11" + dnd-core "^7.7.0" react-dnd@^7.4.3: version "7.4.3"