Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ScrollSync Button to Preview UI #693

Merged
merged 3 commits into from
Oct 26, 2017
Merged

Add ScrollSync Button to Preview UI #693

merged 3 commits into from
Oct 26, 2017

Conversation

Jinksi
Copy link
Contributor

@Jinksi Jinksi commented Oct 14, 2017

Closes #532

- Summary

  • A new button allows the user to toggle preview auto-scroll behaviour.
  • This button is only rendered when preview is enabled
  • Button state is stored and read via localStorage (same as preview button)
  • Uses sync and sync-disabled icon

- Test plan

Manually tested UI (see screen capture). If I should be adding formal tests, please let me know.

scroll

- Description for the changelog

Added button to toggle preview scroll-sync.

- A picture of a cute animal (not mandatory but encouraged)

wallaby

@Jinksi
Copy link
Contributor Author

Jinksi commented Oct 14, 2017

Sorry, should have waited until #659 was merged.

@erquhart
Copy link
Contributor

Thanks @Jinksi! I want to improve the arch on this, mostly just creating a single toggle component and reusing that, and avoiding the universal selector in CSS. If you have time to handle that and that rebase we can get this in sooner, otherwise I or another contributor will get to it.

@Jinksi
Copy link
Contributor Author

Jinksi commented Oct 20, 2017

@erquhart No problem, I'll get onto it

@Jinksi
Copy link
Contributor Author

Jinksi commented Oct 23, 2017

Sorry, looks like I messed up the rebase

@erquhart
Copy link
Contributor

Rebase fixed.

Copy link
Contributor

@erquhart erquhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Just a few changes and this is good to go. This improvement did get our control panel buttons to a place where they merit a separate component, that's worth doing in the future.

I'll also note for any other reviewers that this is only necessary because our scroll syncing is very simplistic. The real fix is to make it more robust, but that'll take some doing, and no one is working on it at the moment. Just know that we're not throwing in the towel on that.

@@ -51,6 +52,7 @@ export default class ScrollSync extends Component {
};

handlePaneScroll = (node) => {
if (!this.props.enabled) return false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add semi-colon at line end.

@@ -6,6 +6,7 @@ export default class ScrollSync extends Component {

static propTypes = {
children: PropTypes.element.isRequired,
enabled: PropTypes.bool.isRequired
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add trailing comma to last item in a collection.

<div className="nc-entryEditor-controlPaneButtons">
{ previewVisible && (
<ToggleButton
icon={scrollSyncEnabled ? 'sync_disabled' : 'sync'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These need to be swapped, currently shows the disabled icon when scrolling is enabled.

Copy link
Contributor

@Benaiah Benaiah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The icon used here looks like a refresh button to me, but that's fine for now if we change it before the UI refresh. Other than that LGTM.

@Benaiah Benaiah merged commit b2d93ef into decaporg:master Oct 26, 2017
talves pushed a commit that referenced this pull request Oct 26, 2017
* Add ScrollSync Button

* Create <ToggleButton /> component && update CSS

* Swap Icons && fix formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants