diff --git a/src/__tests__/util-test.js b/src/__tests__/util-test.js index 23f1e971d..ffd0d6549 100644 --- a/src/__tests__/util-test.js +++ b/src/__tests__/util-test.js @@ -2,10 +2,10 @@ import * as util from '../util'; import { TYPES, - SELECTOR_ANNOTATION_DIALOG, + SELECTOR_ANNOTATION_POPOVER, CLASS_ANNOTATION_CARET, SELECTOR_ANNOTATION_POINT_MARKER, - CLASS_ANNOTATION_DIALOG, + CLASS_ANNOTATION_POPOVER, CLASS_ANNOTATION_POINT_MARKER } from '../constants'; @@ -22,7 +22,7 @@ const html = `
-
+
@@ -167,7 +167,7 @@ describe('util', () => { describe('isInAnnotationOrMarker()', () => { it('should return false if no dialog element exists', () => { - const dialogEl = rootElement.querySelector(SELECTOR_ANNOTATION_DIALOG); + const dialogEl = rootElement.querySelector(SELECTOR_ANNOTATION_POPOVER); const markerEl = rootElement.querySelector(SELECTOR_ANNOTATION_POINT_MARKER); expect(util.isInAnnotationOrMarker({ target: dialogEl })).toBeTruthy(); expect(util.isInAnnotationOrMarker({ target: markerEl })).toBeTruthy(); diff --git a/src/components/ActionControls/ActionControls.js b/src/components/ActionControls/ActionControls.js index 2141c275e..e2fc569bf 100644 --- a/src/components/ActionControls/ActionControls.js +++ b/src/components/ActionControls/ActionControls.js @@ -10,6 +10,9 @@ import DrawingControls from './DrawingControls'; import './ActionControls.scss'; +const CLASS_ACTION_CONTROLS = 'ba-action-controls'; +const CLASS_INPUT_CONTAINER = 'ba-annotation-input-container'; + type Props = { id?: string, type: AnnotationType, @@ -107,7 +110,7 @@ class ActionControls extends React.Component { if (isPending || hasComments) { return ( { // irrespective of whether or not they can create new point annotations return ( { render() { const { type } = this.props; - return
{this.determineControls(type)}
; + return
{this.determineControls(type)}
; } } diff --git a/src/components/ActionControls/DrawingControls.js b/src/components/ActionControls/DrawingControls.js index c6a2ad61e..0941c068f 100644 --- a/src/components/ActionControls/DrawingControls.js +++ b/src/components/ActionControls/DrawingControls.js @@ -7,6 +7,10 @@ import IconTrash from 'box-react-ui/lib/icons/general/IconTrash'; import './DrawingControls.scss'; +const CLASS_DRAW_CONTROLS = 'ba-action-controls-draw'; +const CLASS_DRAWING_SAVE_BTN = 'ba-drawing-save-btn'; +const CLASS_DRAWING_DELETE_BTN = 'ba-drawing-delete-btn'; + type Props = { canDelete: boolean, isPending: boolean, @@ -15,14 +19,14 @@ type Props = { }; const DrawingControls = ({ isPending, canDelete, onCreate, onDelete }: Props) => ( -
+
{isPending && ( - + )} {canDelete && ( - + )} diff --git a/src/components/ActionControls/DrawingControls.scss b/src/components/ActionControls/DrawingControls.scss index 4dd8575a2..7701bd478 100644 --- a/src/components/ActionControls/DrawingControls.scss +++ b/src/components/ActionControls/DrawingControls.scss @@ -30,7 +30,7 @@ // MOBILE & TABLET CSS @media #{$mobile}, #{$tablet} { - .ba-inline .ba-action-controls-draw { + .ba-inline-popover .ba-action-controls-draw { background: white; border-top: 1px solid $seesee; bottom: 0; diff --git a/src/components/ActionControls/HighlightControls.js b/src/components/ActionControls/HighlightControls.js index 1acbe6b37..2d6890840 100644 --- a/src/components/ActionControls/HighlightControls.js +++ b/src/components/ActionControls/HighlightControls.js @@ -8,6 +8,11 @@ import IconHighlightCommentAnnotation from 'box-react-ui/lib/icons/annotations/I import './HighlightControls.scss'; +const CLASS_HIGHLIGHT_CONTROLS = 'ba-action-controls-highlight'; +const CLASS_HIGHLIGHT_BTN = 'ba-highlight-btn'; +const CLASS_HIGHLIGHT_COMMENT_BTN = 'ba-highlight-comment-btn'; +const CLASS_SAVED_HIGHLIGHT = 'ba-saved-highlight'; + type Props = { canAnnotateAndDelete: boolean, canComment: boolean, @@ -25,18 +30,18 @@ const HighlightControls = ({ onCommentClick, isPending }: Props) => ( -
+
{canAnnotateAndDelete && ( - + )} {canComment && ( - + )} diff --git a/src/components/ActionControls/HighlightControls.scss b/src/components/ActionControls/HighlightControls.scss index 2c1f0fb15..28cd420be 100644 --- a/src/components/ActionControls/HighlightControls.scss +++ b/src/components/ActionControls/HighlightControls.scss @@ -36,7 +36,7 @@ // MOBILE & TABLET CSS @media #{$mobile}, #{$tablet} { - .ba-inline .ba-action-controls-highlight { + .ba-inline-popover .ba-action-controls-highlight { background: white; border-top: 1px solid $seesee; bottom: 0; diff --git a/src/components/AnnotationPopover/AnnotationPopover.js b/src/components/AnnotationPopover/AnnotationPopover.js index 1383f68f8..d1e641af9 100644 --- a/src/components/AnnotationPopover/AnnotationPopover.js +++ b/src/components/AnnotationPopover/AnnotationPopover.js @@ -8,12 +8,18 @@ import IconClose from 'box-react-ui/lib/icons/general/IconClose'; import Internationalize from '../Internationalize'; import Overlay from './Overlay'; import CommentList from '../CommentList'; -import { TYPES, CLASS_ANNOTATION_POPOVER } from '../../constants'; +import { TYPES, CLASS_ANNOTATION_POPOVER, CLASS_ANNOTATION_CARET } from '../../constants'; import './AnnotationPopover.scss'; import ActionControls from '../ActionControls'; import AnnotatorLabel from './AnnotatorLabel'; +const CLASS_INLINE_POPOVER = 'ba-inline-popover'; +const CLASS_ANIMATE_POPOVER = 'ba-animate-popover'; +const CLASS_CREATE_POPOVER = 'ba-create-popover'; +const CLASS_MOBILE_HEADER = 'ba-mobile-header'; +const CLASS_MOBILE_CLOSE_BTN = 'ba-mobile-close-btn'; + type Props = { isMobile: boolean, canComment: boolean, @@ -79,19 +85,19 @@ class AnnotationPopover extends React.PureComponent {
{isMobile ? ( - - + + ) : ( - + )} {hasComments ? ( diff --git a/src/components/AnnotationPopover/AnnotationPopover.scss b/src/components/AnnotationPopover/AnnotationPopover.scss index 7e569efbf..53ba5ed51 100644 --- a/src/components/AnnotationPopover/AnnotationPopover.scss +++ b/src/components/AnnotationPopover/AnnotationPopover.scss @@ -50,7 +50,7 @@ white-space: normal; } - .ba-inline .overlay { + .ba-inline-popover .overlay { display: inline-flex; } @@ -126,11 +126,11 @@ } // INLINE ANNOTATION POPOVER CSS - .ba-popover.ba-inline { + .ba-popover.ba-inline-popover { height: auto; } - .ba-inline .ba-popover-overlay { + .ba-inline-popover .ba-popover-overlay { background: transparent; border-bottom: 1px solid $seesee; box-shadow: 0 2px 6px 0 rgba(0, 0, 0, .1); @@ -139,20 +139,20 @@ text-align: center; } - .ba-inline.ba-create-popover .ba-popover-overlay { + .ba-inline-popover.ba-create-popover .ba-popover-overlay { border: none; box-shadow: none; display: flex; flex-direction: column; } - .ba-inline .ba-mobile-header, + .ba-inline-popover .ba-mobile-header, .ba-create-popover .ba-mobile-header { display: none; } .ba-create-popover .ba-popover-overlay, - .ba-inline .ba-popover-overlay { + .ba-inline-popover .ba-popover-overlay { background: transparent; height: auto; } @@ -186,12 +186,12 @@ display: flex; } - .ba-popover.ba-inline { + .ba-popover.ba-inline-popover { border: none; width: 100%; } - .ba-inline .ba-mobile-header { + .ba-inline-popover .ba-mobile-header { display: none; } @@ -201,8 +201,8 @@ height: 100%; } - .ba-inline.ba-create-popover, - .ba-inline.ba-create-popover .ba-popover-overlay { + .ba-inline-popover.ba-create-popover, + .ba-inline-popover.ba-create-popover .ba-popover-overlay { background: transparent; height: auto; } diff --git a/src/components/AnnotationPopover/AnnotatorLabel.js b/src/components/AnnotationPopover/AnnotatorLabel.js index 8c2805c54..7c29f7dc0 100644 --- a/src/components/AnnotationPopover/AnnotatorLabel.js +++ b/src/components/AnnotationPopover/AnnotatorLabel.js @@ -10,6 +10,8 @@ import messages from './messages'; import './AnnotatorLabel.scss'; +const CLASS_ANNOTATOR_LABEL = 'ba-annotator-label'; + type Props = { id?: string, type: AnnotationType, @@ -42,7 +44,7 @@ class AnnotatorLabel extends React.PureComponent { const { id, isPending } = this.props; return ( !isPending && ( - + ) diff --git a/src/components/AnnotationPopover/Overlay.js b/src/components/AnnotationPopover/Overlay.js index 121ca6924..0bea9a533 100644 --- a/src/components/AnnotationPopover/Overlay.js +++ b/src/components/AnnotationPopover/Overlay.js @@ -3,6 +3,8 @@ import * as React from 'react'; import OverlayComponent from 'box-react-ui/lib/components/flyout/Overlay'; +const CLASS_POPOVER_OVERLAY = 'ba-popover-overlay'; + type Props = { shouldDefaultFocus: boolean, children: React.Node @@ -11,13 +13,13 @@ type Props = { const Overlay = ({ shouldDefaultFocus, children }: Props) => { if (shouldDefaultFocus) { return ( - + {children} ); } - return
{children}
; + return
{children}
; }; export default Overlay; diff --git a/src/components/AnnotationPopover/__tests__/AnnotationPopover-test.js b/src/components/AnnotationPopover/__tests__/AnnotationPopover-test.js index b12c0ffa0..5b6aa52ff 100644 --- a/src/components/AnnotationPopover/__tests__/AnnotationPopover-test.js +++ b/src/components/AnnotationPopover/__tests__/AnnotationPopover-test.js @@ -51,7 +51,7 @@ describe('components/AnnotationPopover', () => { comments }); expect(wrapper).toMatchSnapshot(); - expect(wrapper.find('.ba-inline').length).toEqual(0); + expect(wrapper.find('.ba-inline-popover').length).toEqual(0); }); test('should render a view-only annotation with a annotator label and no comments', () => { @@ -60,7 +60,7 @@ describe('components/AnnotationPopover', () => { type: TYPES.highlight }); expect(wrapper).toMatchSnapshot(); - expect(wrapper.find('.ba-inline').length).toEqual(1); + expect(wrapper.find('.ba-inline-popover').length).toEqual(1); }); test('should correctly render an annotation with a annotator label and no comments', () => { @@ -70,7 +70,7 @@ describe('components/AnnotationPopover', () => { type: TYPES.highlight }); expect(wrapper).toMatchSnapshot(); - expect(wrapper.find('.ba-inline').length).toEqual(1); + expect(wrapper.find('.ba-inline-popover').length).toEqual(1); }); test('should correctly render a BRUI Overlay if not on mobile', () => { @@ -99,7 +99,7 @@ describe('components/AnnotationPopover', () => { comments }); expect(wrapper).toMatchSnapshot(); - expect(wrapper.find('.ba-inline').length).toEqual(0); + expect(wrapper.find('.ba-inline-popover').length).toEqual(0); }); test('should correctly render a pending annotation', () => { @@ -108,6 +108,6 @@ describe('components/AnnotationPopover', () => { canAnnotate: true }); expect(wrapper).toMatchSnapshot(); - expect(wrapper.find('.ba-inline').length).toEqual(0); + expect(wrapper.find('.ba-inline-popover').length).toEqual(0); }); }); diff --git a/src/components/AnnotationPopover/__tests__/__snapshots__/AnnotationPopover-test.js.snap b/src/components/AnnotationPopover/__tests__/__snapshots__/AnnotationPopover-test.js.snap index e6761bc9b..4b18d9e32 100644 --- a/src/components/AnnotationPopover/__tests__/__snapshots__/AnnotationPopover-test.js.snap +++ b/src/components/AnnotationPopover/__tests__/__snapshots__/AnnotationPopover-test.js.snap @@ -469,7 +469,7 @@ exports[`components/AnnotationPopover should correctly render a view-only popove exports[`components/AnnotationPopover should correctly render an annotation with a annotator label and no comments 1`] = `
( -
    +
      {comments.map(({ id, ...rest }) => ( -
    • +
    • ))} diff --git a/src/components/withFocus.js b/src/components/withFocus.js index c0641bf48..8c3e43af9 100644 --- a/src/components/withFocus.js +++ b/src/components/withFocus.js @@ -6,6 +6,8 @@ import * as React from 'react'; +import { CLASS_FOCUSED } from '../constants'; + type Props = {}; type State = { isFocused: boolean @@ -34,7 +36,7 @@ const withFocus = (WrappedComponent: React.ComponentType) => { const { isFocused } = this.state; return (