Browse Source

Explicitly order Main Concepts (#957)

main
Dan Abramov 7 years ago
committed by GitHub
parent
commit
17c50df9d9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      content/docs/nav.yml
  2. 9
      src/templates/components/Sidebar/Section.js

1
content/docs/nav.yml

@ -9,6 +9,7 @@
- id: cdn-links - id: cdn-links
title: CDN Links title: CDN Links
- title: Main Concepts - title: Main Concepts
isOrdered: true
items: items:
- id: hello-world - id: hello-world
title: Hello World title: Hello World

9
src/templates/components/Sidebar/Section.js

@ -69,7 +69,7 @@ class Section extends React.Component {
display: isActive ? 'block' : 'none', display: isActive ? 'block' : 'none',
}, },
}}> }}>
{section.items.map(item => ( {section.items.map((item, index) => (
<li <li
key={item.id} key={item.id}
css={{ css={{
@ -79,7 +79,12 @@ class Section extends React.Component {
isActive: isScrollSync isActive: isScrollSync
? activeItemId === item.id ? activeItemId === item.id
: isItemActive(location, item), : isItemActive(location, item),
item, item: section.isOrdered
? {
...item,
title: `${index + 1}. ${item.title}`,
}
: item,
location, location,
onLinkClick, onLinkClick,
section, section,

Loading…
Cancel
Save