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

docs(ComponentSidebar): add sidebar navigation #2070

Merged
merged 17 commits into from
Nov 25, 2017
Merged

Conversation

layershifter
Copy link
Member

@layershifter layershifter commented Sep 12, 2017

This PR is part of work (#1981, #2012) that improves docs usability and performance.

sidebar

This PR will also add the navigation sidebar like on SUI website.

_999 024


TODO

  • grab title from section, not path
  • fix order of sections
  • cleanup new parsers
  • review components
  • refactor doc utils
  • fix rounding in scrollToAnchor()
  • finish sidebar component

@codecov-io
Copy link

codecov-io commented Sep 12, 2017

Codecov Report

Merging #2070 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2070   +/-   ##
=======================================
  Coverage   99.73%   99.73%           
=======================================
  Files         152      152           
  Lines        2656     2656           
=======================================
  Hits         2649     2649           
  Misses          7        7

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6ef5af5...206b54c. Read the comment docs.

@layershifter layershifter force-pushed the docs/sidebar branch 4 times, most recently from 4adc6fa to 6de75d0 Compare September 15, 2017 14:53
@levithomason
Copy link
Member

This is great, been on my list for a long :)

I think this can be done by using the already existent exampleContext in docs/app/utils.js. We may not need menuInfo.json.

Note, in the future, I've been considering the use of dynamic imports for each component route. This way, we only load the docs people need. It will make the docs much lighter and faster to load. Along with this change, I'd like to split up docInfo.json and output a json file to each component directory.

…React into docs/sidebar

# Conflicts:
#	.gitignore
#	docs/app/Components/ComponentDoc/ComponentProp/ComponentPropEnum.js
#	gulp/plugins/util/index.js
@@ -70,6 +75,10 @@ class ComponentExample extends Component {
})
}

shouldComponentUpdate(nextProps, nextState) {
Copy link
Member Author

@layershifter layershifter Sep 25, 2017

Choose a reason for hiding this comment

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

Small optimization. Without it, all examples will be rerendered

@layershifter
Copy link
Member Author

layershifter commented Sep 25, 2017

Naming

Moved to #2123.

menuInfo.json

I really want to avoid it, but I do not know another way to collect information for the sidebar. @levithomason do you have any better ideas?

@levithomason
Copy link
Member

I will try to take a look and comment. I've marked this PR for review to remind me.

@layershifter
Copy link
Member Author

@levithomason Don't pay attention to the refactoring, I moved it into #2123. However, question about menuInfo.json is still open.

@layershifter layershifter changed the title docs(ComponentDoc): refactor, add sidebar navigation docs(ComponentSidebar): add sidebar navigation Sep 28, 2017
…React into docs/sidebar

# Conflicts:
#	docs/app/Components/ComponentDoc/ComponentDoc.js
#	docs/app/Components/ComponentDoc/ComponentDocHeader.js
#	docs/app/Components/ComponentDoc/ComponentDocLinks.js
#	docs/app/Components/ComponentDoc/ComponentDocSee.js
#	docs/app/Components/ComponentDoc/ComponentProps/ComponentProps.js
#	docs/app/Components/ComponentDoc/ComponentProps/ComponentPropsComponents.js
#	docs/app/Components/ComponentDoc/ComponentProps/ComponentPropsDescription.js
#	docs/app/Components/ComponentDoc/ComponentTable/ComponentTable.js
#	docs/app/utils/index.js
#	yarn.lock
Copy link
Member Author

@layershifter layershifter left a comment

Choose a reason for hiding this comment

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

@levithomason I merged this PR with and made the cleanup there. it's ready for review ✌️

However, I can't fix the problem with scrollToAnchor(). It's easy to reproduce, just pull this branch and try to click on different sidebar items on the Header page. The scroll sometime will not reach the matching position and the wrong sidebar item will be active. There is a rounding problem, but I don't have any idea how to fix it 🤔

@levithomason
Copy link
Member

I've pushed some usability fixes and would like to do more.

The issue you stated still persists. It seems to me the cause is that Visibility expects the element to be passed, while scrollToAnchor does not pass the element but scrolls directly to the element. This could be due to Visibility's use of getBoundingClientRect, which returns fractional values for top/bottom/left/right.

I will come back to this again. I am out of time for today. 👋

…React into docs/sidebar

# Conflicts:
#	docs/app/Components/ComponentDoc/ComponentDoc.js
@layershifter
Copy link
Member Author

Solved merge conflict there 👍

@levithomason
Copy link
Member

I'm going to merge this and we can iterate on it. Maybe someone will feel motivated and submit a PR as well.

@levithomason levithomason merged commit c2cf18d into master Nov 25, 2017
@levithomason levithomason deleted the docs/sidebar branch November 25, 2017 16:38
@levithomason
Copy link
Member

Released in semantic-ui-react@0.77.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants