From e2f0e9b727ce42149079a8ba66c1fd7afc8095e7 Mon Sep 17 00:00:00 2001 From: Blake Stephens Date: Thu, 20 Feb 2020 14:10:17 -0800 Subject: [PATCH] Added docs and fix linting issues Enact-DCO-1.0-Signed-off-by: Blake Stephens --- packages/ui/Marquee/MarqueeController.js | 15 +++++++++++++++ packages/ui/Marquee/MarqueeDecorator.js | 7 ++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/packages/ui/Marquee/MarqueeController.js b/packages/ui/Marquee/MarqueeController.js index 6f611e7af5..9d4ee4ae18 100644 --- a/packages/ui/Marquee/MarqueeController.js +++ b/packages/ui/Marquee/MarqueeController.js @@ -1,6 +1,7 @@ import {forward} from '@enact/core/handle'; import hoc from '@enact/core/hoc'; import {Job} from '@enact/core/util'; +import PropTypes from 'prop-types'; import React from 'react'; const STATE = { @@ -46,6 +47,20 @@ const MarqueeController = hoc(defaultConfig, (config, Wrapped) => { return class extends React.Component { static displayName = 'MarqueeController' + static propTypes = /** @lends ui/Marquee.MarqueeController.prototype */ { + /** + * Determines what triggers the marquee to start its animation. + * + * This property is passed down to any chirdren Marquee components, and is used there, + * unless `marqueeOn` is specified for them as well. + * + * @type {('focus'|'hover'|'render')} + * @default 'focus' + * @public + */ + marqueeOn: PropTypes.oneOf(['focus', 'hover', 'render']) + } + constructor (props) { super(props); diff --git a/packages/ui/Marquee/MarqueeDecorator.js b/packages/ui/Marquee/MarqueeDecorator.js index d33a894fd6..4b33b3881d 100644 --- a/packages/ui/Marquee/MarqueeDecorator.js +++ b/packages/ui/Marquee/MarqueeDecorator.js @@ -308,13 +308,14 @@ const MarqueeDecorator = hoc(defaultConfig, (config, Wrapped) => { static defaultProps = { marqueeDelay: 1000, - // marqueeOn: 'focus', marqueeOnRenderDelay: 1000, marqueeResetDelay: 1000, marqueeSpacing: '50%', marqueeSpeed: 60 } + static contextType = MarqueeControllerContext + constructor (props) { super(props); this.state = { @@ -405,8 +406,6 @@ const MarqueeDecorator = hoc(defaultConfig, (config, Wrapped) => { off('keydown', this.handlePointerHide); } - static contextType = MarqueeControllerContext - promoteJob = new Job(() => { this.setState(state => state.promoted ? null : {promoted: true}); }) @@ -812,8 +811,6 @@ const MarqueeDecorator = hoc(defaultConfig, (config, Wrapped) => { ...rest } = this.props; - console.log('marqueeOn:', marqueeOn, this.context && this.context.marqueeOn, children); - const marqueeOnFocus = marqueeOn === 'focus'; const marqueeOnHover = marqueeOn === 'hover'; const marqueeOnRender = marqueeOn === 'render';