-
-
Live CSS Editor
+
+
-
- {
- setCss(e.target.value);
- }}
- />
-
-
-
+
);
};
export default LiveCssEditor;
diff --git a/desktop-app/app/components/LiveCssEditor/useStyles.js b/desktop-app/app/components/LiveCssEditor/useStyles.js
index ede6a187..ceabd916 100644
--- a/desktop-app/app/components/LiveCssEditor/useStyles.js
+++ b/desktop-app/app/components/LiveCssEditor/useStyles.js
@@ -1,45 +1,23 @@
import {makeStyles} from '@material-ui/core/styles';
const useStyles = makeStyles(theme => ({
- preferenceName: {
- fontSize: '14px',
+ container: {
+ background: theme.palette.background.l2,
+ margin: 5,
+ padding: 10,
+ borderRadius: 2,
+ boxShadow: `0 ${theme.palette.mode({
+ light: '0px',
+ dark: '3px',
+ })} 5px rgba(0, 0, 0, 0.35)`,
},
- preferenceColor: {
- width: '24px',
- height: '20px',
- margin: '0 10px',
- border: 'transparent',
- '& input': {
- width: '26px',
- height: '40px',
- border: 'transparent',
- },
+ titleBar: {
+ cursor: 'move',
+ padding: '5px 0',
},
- sectionTitle: {
- margin: '5px 0',
- },
- sectionHeader: {
- '&:after': {
- content: '""',
- flex: 1,
- marginLeft: 5,
- height: 1,
- backgroundColor: theme.palette.text.primary,
- },
- },
- marginTop: {
- marginTop: '10px',
- },
- permissionsSelectorSmallNote: {
- color: theme.palette.text.primary,
- margin: 0,
- fontSize: '0.75rem',
- marginTop: '10px',
- textAlign: 'left',
- fontFamily: "'Roboto', 'Helvetica', 'Arial', sans-serif",
- fontWeight: 400,
- lineHeight: 1.66,
- letterSpacing: '0.03333em',
+ editor: {
+ minHeight: 200,
+ height: 'auto',
},
}));
diff --git a/desktop-app/app/components/ScrollControls/index.js b/desktop-app/app/components/ScrollControls/index.js
index 0fb43e29..c7a5c218 100644
--- a/desktop-app/app/components/ScrollControls/index.js
+++ b/desktop-app/app/components/ScrollControls/index.js
@@ -1,5 +1,5 @@
// @flow
-import React, {Component} from 'react';
+import React, {Component, useState} from 'react';
import cx from 'classnames';
import Grid from '@material-ui/core/Grid';
import Tooltip from '@material-ui/core/Tooltip';
@@ -16,6 +16,7 @@ import ZoomContainer from '../../containers/ZoomContainer';
import PrefersColorSchemeSwitch from '../PrefersColorSchemeSwitch';
import ToggleTouch from '../ToggleTouch';
import Muted from '../icons/Muted';
+import LiveCssEditor from '../LiveCssEditor';
const useStyles = makeStyles({
container: {
@@ -41,75 +42,71 @@ const ScrollControls = ({
width: 25,
};
+ const [cssEditorOpen, setCssEditorOpen] = useState(true);
+
return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ setCssEditorOpen(!cssEditorOpen)}>CSS
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {browser.allDevicesMuted ? (
+
+ ) : (
+
+ )}
+
+
+
+
-
- {browser.allDevicesMuted ? (
-
- ) : (
-
- )}
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+ {cssEditorOpen &&
}
+ >
);
};
diff --git a/desktop-app/app/constants/DrawerContents.js b/desktop-app/app/constants/DrawerContents.js
index c6092497..75341c39 100644
--- a/desktop-app/app/constants/DrawerContents.js
+++ b/desktop-app/app/constants/DrawerContents.js
@@ -1,4 +1,3 @@
-export const LIVE_CSS_EDITOR = 'LIVE_CSS_EDITOR';
export const DEVICE_MANAGER = 'DEVICE_MANAGER';
export const SCREENSHOT_MANAGER = 'SCREENSHOT_MANAGER';
export const USER_PREFERENCES = 'USER_PREFERENCES';
diff --git a/desktop-app/app/reducers/browser.js b/desktop-app/app/reducers/browser.js
index 22459521..6661a150 100644
--- a/desktop-app/app/reducers/browser.js
+++ b/desktop-app/app/reducers/browser.js
@@ -38,7 +38,7 @@ import {
INDIVIDUAL_LAYOUT,
DEVTOOLS_MODES,
} from '../constants/previewerLayouts';
-import {DEVICE_MANAGER, LIVE_CSS_EDITOR} from '../constants/DrawerContents';
+import {DEVICE_MANAGER} from '../constants/DrawerContents';
import {
ACTIVE_DEVICES,
USER_PREFERENCES,
@@ -306,7 +306,7 @@ export default function browser(
_getUserPreferences().drawerState === null
? true
: _getUserPreferences().drawerState,
- content: LIVE_CSS_EDITOR,
+ content: DEVICE_MANAGER,
},
previewer: {layout: FLEXIGRID_LAYOUT},
filters: {[FILTER_FIELDS.OS]: [], [FILTER_FIELDS.DEVICE_TYPE]: []},
diff --git a/desktop-app/package.json b/desktop-app/package.json
index e3baa376..0856088e 100644
--- a/desktop-app/package.json
+++ b/desktop-app/package.json
@@ -277,8 +277,7 @@
"webpack-bundle-analyzer": "^3.4.1",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.8.0",
- "webpack-merge": "^4.1.4",
- "yarn": "^1.12.3"
+ "webpack-merge": "^4.1.4"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^5.5.0",
@@ -286,6 +285,7 @@
"@material-ui/icons": "^4.2.1",
"@material-ui/lab": "^4.0.0-alpha.26",
"@sentry/electron": "^1.5.2",
+ "ace-builds": "^1.4.12",
"bluebird": "^3.7.2",
"browser-sync": "^2.26.7",
"classnames": "^2.2.6",
@@ -309,12 +309,14 @@
"pubsub.js": "^1.5.2",
"re-resizable": "^6.4.0",
"react": "^16.13.1",
+ "react-ace": "^9.1.3",
"react-beautiful-dnd": "^11.0.5",
"react-dom": "^16.13.1",
"react-hot-loader": "^4.8",
"react-number-format": "^4.4.1",
"react-redux": "^7.1.0",
"react-resizable": "^1.10.1",
+ "react-rnd": "^10.2.2",
"react-router": "^5.0.1",
"react-router-dom": "^5.0.1",
"react-select": "^3.1.0",
diff --git a/desktop-app/yarn.lock b/desktop-app/yarn.lock
index 409d8939..e9ac6bff 100644
--- a/desktop-app/yarn.lock
+++ b/desktop-app/yarn.lock
@@ -2372,6 +2372,11 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7:
mime-types "~2.1.24"
negotiator "0.6.2"
+ace-builds@^1.4.12, ace-builds@^1.4.6:
+ version "1.4.12"
+ resolved "https://registry.yarnpkg.com/ace-builds/-/ace-builds-1.4.12.tgz#888efa386e36f4345f40b5233fcc4fe4c588fae7"
+ integrity sha512-G+chJctFPiiLGvs3+/Mly3apXTcfgE45dT5yp12BcWZ1kUs+gm0qd3/fv4gsz6fVag4mM0moHVpjHDIgph6Psg==
+
acorn-globals@^4.1.0:
version "4.3.4"
resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.4.tgz#9fa1926addc11c97308c4e66d7add0d40c3272e7"
@@ -5967,6 +5972,11 @@ device-specs@^1.0.0:
resolved "https://registry.yarnpkg.com/device-specs/-/device-specs-1.0.0.tgz#47b54577b9b159118bbb0a175177d0aa9c50a9c9"
integrity sha512-fYXbFSeilT7bnKWFi4OERSPHdtaEoDGn4aUhV5Nly6/I+Tp6JZ/6Icmd7LVIF5euyodGpxz2e/bfUmDnIdSIDw==
+diff-match-patch@^1.0.4:
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/diff-match-patch/-/diff-match-patch-1.0.5.tgz#abb584d5f10cd1196dfc55aa03701592ae3f7b37"
+ integrity sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==
+
diff@^3.2.0, diff@^3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12"
@@ -13064,6 +13074,13 @@ rc@^1.2.7, rc@^1.2.8:
minimist "^1.2.0"
strip-json-comments "~2.0.1"
+re-resizable@6.3.2:
+ version "6.3.2"
+ resolved "https://registry.yarnpkg.com/re-resizable/-/re-resizable-6.3.2.tgz#27cc984af6ea5dbafd2b79f64c5224a6e1722fbe"
+ integrity sha512-ngxe4XBSb46vfwXjAwpURacVDig/pPt1kHRhcKlRRIoGICmo4aQHr725jurezepp1pm5jSC6iQhyLYfx3zOC3w==
+ dependencies:
+ fast-memoize "^2.5.1"
+
re-resizable@^6.4.0:
version "6.5.4"
resolved "https://registry.yarnpkg.com/re-resizable/-/re-resizable-6.5.4.tgz#909a1e37f9d1a3afd356893a5779a030167be641"
@@ -13071,6 +13088,17 @@ re-resizable@^6.4.0:
dependencies:
fast-memoize "^2.5.1"
+react-ace@^9.1.3:
+ version "9.1.3"
+ resolved "https://registry.yarnpkg.com/react-ace/-/react-ace-9.1.3.tgz#848dc3741d5460f3ac73468b6c39879aab9238bc"
+ integrity sha512-1TZBs/9hFGgPuzu6DUiBogyhRA5Z1Po2wzPfZslbrTFGQtbNe+JXHuPoJNlUu/uerElzOLLsuJEDTO9FfLnZJA==
+ dependencies:
+ ace-builds "^1.4.6"
+ diff-match-patch "^1.0.4"
+ lodash.get "^4.4.2"
+ lodash.isequal "^4.5.0"
+ prop-types "^15.7.2"
+
react-beautiful-dnd@^11.0.5:
version "11.0.5"
resolved "https://registry.yarnpkg.com/react-beautiful-dnd/-/react-beautiful-dnd-11.0.5.tgz#16b1dbd4d6493de0cb3f842cad57c7e9e1ff5fe7"
@@ -13095,7 +13123,7 @@ react-dom@^16.13.1:
prop-types "^15.6.2"
scheduler "^0.19.1"
-react-draggable@^4.0.3:
+react-draggable@4.4.3, react-draggable@^4.0.3:
version "4.4.3"
resolved "https://registry.yarnpkg.com/react-draggable/-/react-draggable-4.4.3.tgz#0727f2cae5813e36b0e4962bf11b2f9ef2b406f3"
integrity sha512-jV4TE59MBuWm7gb6Ns3Q1mxX8Azffb7oTtDtBgFkxRvhDp38YAARmRplrj0+XGkhOJB5XziArX+4HUUABtyZ0w==
@@ -13160,6 +13188,15 @@ react-resizable@^1.10.1:
prop-types "15.x"
react-draggable "^4.0.3"
+react-rnd@^10.2.2:
+ version "10.2.2"
+ resolved "https://registry.yarnpkg.com/react-rnd/-/react-rnd-10.2.2.tgz#378017178179c9e6cdca57280dee22cf48925b5a"
+ integrity sha512-UoQnNehseKEspimfPFaO0gN0vSVJ8uCZeG39nCibUVyGTjZ5d+bnY/zHEp9SObHQ9tKW4vFSa9+8Mf7QZrQrUw==
+ dependencies:
+ re-resizable "6.3.2"
+ react-draggable "4.4.3"
+ tslib "2.0.0"
+
react-router-dom@^5.0.1:
version "5.2.0"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.2.0.tgz#9e65a4d0c45e13289e66c7b17c7e175d0ea15662"
@@ -15779,6 +15816,11 @@ tsconfig-paths@^3.9.0:
minimist "^1.2.0"
strip-bom "^3.0.0"
+tslib@2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.0.tgz#18d13fc2dce04051e20f074cc8387fd8089ce4f3"
+ integrity sha512-lTqkx847PI7xEDYJntxZH89L2/aXInsyF2luSafe/+0fHOMjlBNXdH6th7f70qxLDhul7KZK0zC8V5ZIyHl0/g==
+
tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
version "1.13.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043"
@@ -16898,11 +16940,6 @@ yargs@^15.1.0, yargs@^15.3.1, yargs@^15.4.1:
y18n "^4.0.0"
yargs-parser "^18.1.2"
-yarn@^1.12.3:
- version "1.22.4"
- resolved "https://registry.yarnpkg.com/yarn/-/yarn-1.22.4.tgz#01c1197ca5b27f21edc8bc472cd4c8ce0e5a470e"
- integrity sha512-oYM7hi/lIWm9bCoDMEWgffW8aiNZXCWeZ1/tGy0DWrN6vmzjCXIKu2Y21o8DYVBUtiktwKcNoxyGl/2iKLUNGA==
-
yauzl@^2.10.0:
version "2.10.0"
resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9"
From 552383b9c5137e6a866c86ab173aceded4918584 Mon Sep 17 00:00:00 2001
From: Manoj Vivek
Date: Wed, 30 Sep 2020 09:49:40 +0530
Subject: [PATCH 03/12] Live CSS Reducer and style changes
---
desktop-app/app/actions/browser.js | 19 +++++++++++++++++++
.../app/components/LiveCssEditor/index.js | 15 +++++++++++----
.../app/components/LiveCssEditor/useStyles.js | 1 +
.../app/components/PermissionPopup/index.js | 13 +++++++++----
.../PermissionPopup/styles.module.css | 4 ----
.../app/components/ScrollControls/index.js | 14 +++++++++-----
desktop-app/app/reducers/browser.js | 5 +++++
7 files changed, 54 insertions(+), 17 deletions(-)
diff --git a/desktop-app/app/actions/browser.js b/desktop-app/app/actions/browser.js
index 38e5228f..dd3f3ff2 100644
--- a/desktop-app/app/actions/browser.js
+++ b/desktop-app/app/actions/browser.js
@@ -27,6 +27,7 @@ export const NEW_ZOOM_LEVEL = 'NEW_ZOOM_LEVEL';
export const NEW_SCROLL_POSITION = 'NEW_SCROLL_POSITION';
export const NEW_NAVIGATOR_STATUS = 'NEW_NAVIGATOR_STATUS';
export const NEW_INSPECTOR_STATUS = 'NEW_INSPECTOR_STATUS';
+export const NEW_CSS_EDITOR_STATUS = 'NEW_CSS_EDITOR_STATUS';
export const NEW_DRAWER_CONTENT = 'NEW_DRAWER_CONTENT';
export const NEW_PREVIEWER_CONFIG = 'NEW_PREVIEWER_CONFIG';
export const NEW_ACTIVE_DEVICES = 'NEW_ACTIVE_DEVICES';
@@ -85,6 +86,13 @@ export function newInspectorState(status) {
};
}
+export function newCSSEditorState(status) {
+ return {
+ type: NEW_CSS_EDITOR_STATUS,
+ status,
+ };
+}
+
export function newUserPreferences(userPreferences) {
return {
type: NEW_USER_PREFERENCES,
@@ -706,6 +714,17 @@ export function toggleInspector() {
};
}
+export function toggleCSSEditor() {
+ console.log('toggleCSSEditor');
+ return (dispatch: Dispatch, getState: RootStateType) => {
+ const {
+ browser: {isCSSEditorOpen},
+ } = getState();
+
+ dispatch(newCSSEditorState(!isCSSEditorOpen));
+ };
+}
+
export function deviceLoadingChange(deviceInfo) {
return (dispatch: Dispatch, getState: RootStateType) => {
dispatch(newDeviceLoading(deviceInfo));
diff --git a/desktop-app/app/components/LiveCssEditor/index.js b/desktop-app/app/components/LiveCssEditor/index.js
index a4f68f0b..b8175fbb 100644
--- a/desktop-app/app/components/LiveCssEditor/index.js
+++ b/desktop-app/app/components/LiveCssEditor/index.js
@@ -15,7 +15,7 @@ import 'ace-builds/src-noconflict/theme-github';
import useCommonStyles from '../useCommonStyles';
import useStyles from './useStyles';
import TextAreaWithCopyButton from '../../utils/TextAreaWithCopyButton';
-import {Button} from '@material-ui/core';
+import Button from '@material-ui/core/Button';
import {APPLY_CSS} from '../../constants/pubsubEvents';
const LiveCssEditor = ({
@@ -55,8 +55,8 @@ const LiveCssEditor = ({
className={classes.editor}
placeholder="Enter CSS to apply"
mode="css"
- theme="monokai"
- name="blah2"
+ theme="twilight"
+ name="css"
onChange={setCss}
fontSize={14}
showPrintMargin={true}
@@ -74,7 +74,14 @@ const LiveCssEditor = ({
}}
/>
-
+
diff --git a/desktop-app/app/components/LiveCssEditor/useStyles.js b/desktop-app/app/components/LiveCssEditor/useStyles.js
index ceabd916..195ea452 100644
--- a/desktop-app/app/components/LiveCssEditor/useStyles.js
+++ b/desktop-app/app/components/LiveCssEditor/useStyles.js
@@ -18,6 +18,7 @@ const useStyles = makeStyles(theme => ({
editor: {
minHeight: 200,
height: 'auto',
+ marginBottom: 10,
},
}));
diff --git a/desktop-app/app/components/PermissionPopup/index.js b/desktop-app/app/components/PermissionPopup/index.js
index 1f2cf00e..cfbbc576 100644
--- a/desktop-app/app/components/PermissionPopup/index.js
+++ b/desktop-app/app/components/PermissionPopup/index.js
@@ -29,6 +29,12 @@ const useStyles = makeStyles(theme => ({
top: theme.spacing(1),
color: theme.palette.grey[500],
},
+ header: {
+ display: 'flex',
+ justifyContent: 'space-between',
+ margin: '10px',
+ fontWeight: '500',
+ },
themeBackground: {
backgroundColor: theme.palette.mode({
light: theme.palette.grey[100],
@@ -125,19 +131,18 @@ export default function PermissionPopup() {
[styles.permissionPopupActive]: permissionInfos.length !== 0,
})}
>
-