From 836131aa9dc3d4dd584d5293e6c51e05592ea15b Mon Sep 17 00:00:00 2001 From: xnkevinnguyen Date: Thu, 20 Feb 2020 08:20:36 -0800 Subject: [PATCH 1/5] Add tooltip for sensors --- .../components/toolbar/SensorModalUtils.tsx | 2 +- src/view/components/toolbar/ToolBar.tsx | 43 ++++++++++++------- src/view/translations/en.json | 2 +- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/src/view/components/toolbar/SensorModalUtils.tsx b/src/view/components/toolbar/SensorModalUtils.tsx index 51c274b8c..052f6bee6 100644 --- a/src/view/components/toolbar/SensorModalUtils.tsx +++ b/src/view/components/toolbar/SensorModalUtils.tsx @@ -53,7 +53,7 @@ export const CPX_TOOLBAR_ICON_ID = { export const MICROBIT_TOOLBAR_ID = { TEMPERATURE: "toolbar-temperature-sensor", LIGHT: "toolbar-light-sensor", - ACCELEROMETER: "toolbar-accelerometer", + ACCELEROMETER: "toolbar-accelerometer-sensor", LEDS: "toolbar-microbit-led", PUSH_BUTTON: "toolbar-microbit-button", }; diff --git a/src/view/components/toolbar/ToolBar.tsx b/src/view/components/toolbar/ToolBar.tsx index 88b064261..ec0799d39 100644 --- a/src/view/components/toolbar/ToolBar.tsx +++ b/src/view/components/toolbar/ToolBar.tsx @@ -13,6 +13,8 @@ import { IModalContent, LABEL_TO_MODAL_CONTENT, } from "./SensorModalUtils"; +import { TooltipHost } from 'office-ui-fabric-react/lib/Tooltip'; + interface IToolbarState { currentOpenedId: string; @@ -26,6 +28,7 @@ interface IProps extends WrappedComponentProps { }>; } + class ToolBar extends React.Component { private readonly TOOLBAR_BUTTON_WIDTH: number = 32; @@ -46,22 +49,30 @@ class ToolBar extends React.Component { {buttonList.map( (currrentButton: any, index: number) => { return ( - - - + +
- - - Red LED - - - Created with Sketch. - - + + + Push Button + + + Created with Sketch. + - - + + + + - - - - +
+
- - - Sound Sensor - - - Created with Sketch. - - + + + Red LED + + + Created with Sketch. + - - - - - +
+
- - - Temperature Sensor - - + + + Sound Sensor + + + Created with Sketch. + - - - + + + + + + + + - - - - +
+
- - - Light sensor - - + + + Temperature Sensor + - - - - - - +
+
- - - neon_pixel - - - Created with Sketch. - - + + + Light sensor + - - - - - - - - + + + + + - - - - +
+
- - - Speaker - - - Created with Sketch. - - + + + neon_pixel + + + Created with Sketch. + - + + + + + + + + + + - - - - +
+
+ + +
+
- - - - - + + + + + - - - - +
+
- - - IR - - - Created with Sketch. - - + + + IR + + + Created with Sketch. + - + + + - - - - +
+
- - - GPIO - - - Created with Sketch. - - + + + GPIO + + + Created with Sketch. + - + + + - - - + + +
diff --git a/src/view/components/cpx/__snapshots__/Cpx.spec.tsx.snap b/src/view/components/cpx/__snapshots__/Cpx.spec.tsx.snap index 43bd8b49d..8d80bdd4b 100644 --- a/src/view/components/cpx/__snapshots__/Cpx.spec.tsx.snap +++ b/src/view/components/cpx/__snapshots__/Cpx.spec.tsx.snap @@ -3953,657 +3953,767 @@ Array [
- - - +
+
- - - Red LED - - - Created with Sketch. - - + + + Push Button + + + Created with Sketch. + - - + + + + - - - - +
+
- - - Sound Sensor - - - Created with Sketch. - - + + + Red LED + + + Created with Sketch. + - - - - - +
+
- - - Temperature Sensor - - + + + Sound Sensor + + + Created with Sketch. + - - - + + + + + + + + - - - - +
+
- - - Light sensor - - + + + Temperature Sensor + - - - - - - +
+
- - - neon_pixel - - - Created with Sketch. - - + + + Light sensor + - - - - - - - - + + + + + - - - - +
+
- - - Speaker - - - Created with Sketch. - - + + + neon_pixel + + + Created with Sketch. + - + + + + + + + + + + - - - - +
+
+ + +
+
- - - - - + + + + + - - - - +
+
- - - IR - - - Created with Sketch. - - + + + IR + + + Created with Sketch. + - + + + - - - - +
+
- - - GPIO - - - Created with Sketch. - - + + + GPIO + + + Created with Sketch. + - + + + - - - + + +
, diff --git a/src/view/components/toolbar/ToolBar.tsx b/src/view/components/toolbar/ToolBar.tsx index d08bb3a24..d78ca44c5 100644 --- a/src/view/components/toolbar/ToolBar.tsx +++ b/src/view/components/toolbar/ToolBar.tsx @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { TooltipHost } from 'office-ui-fabric-react/lib/Tooltip'; +import { TooltipHost } from "office-ui-fabric-react"; import * as React from "react"; import { FormattedMessage, @@ -15,7 +15,6 @@ import { LABEL_TO_MODAL_CONTENT, } from "./SensorModalUtils"; - interface IToolbarState { currentOpenedId: string; showModal: boolean; @@ -28,7 +27,6 @@ interface IProps extends WrappedComponentProps { }>; } - class ToolBar extends React.Component { private readonly TOOLBAR_BUTTON_WIDTH: number = 32; @@ -49,14 +47,18 @@ class ToolBar extends React.Component { {buttonList.map( (currrentButton: any, index: number) => { return ( - ( - - - ) - } - } key={index}> - + +
- - - Red LED - - - Created with Sketch. - - + + Red LED + + + Created with Sketch. + - - + + + + - - - - +
+
- - - Temperature Sensor - - - - - - - - - - - - +
+
+ + +
+
- - - - - + + + + + - - - + + +
From e4136cd1c5dc413ac333a97e3b70b6ec7238f2c6 Mon Sep 17 00:00:00 2001 From: xnkevinnguyen Date: Thu, 20 Feb 2020 09:27:27 -0800 Subject: [PATCH 4/5] Remove unecessary space --- src/view/components/toolbar/ToolBar.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/view/components/toolbar/ToolBar.tsx b/src/view/components/toolbar/ToolBar.tsx index d78ca44c5..d529e57c9 100644 --- a/src/view/components/toolbar/ToolBar.tsx +++ b/src/view/components/toolbar/ToolBar.tsx @@ -57,7 +57,6 @@ class ToolBar extends React.Component { }} key={index} > - {" "}