Skip to content

Commit

Permalink
doc: roll back special landing page, use new Home sidebar section, and
Browse files Browse the repository at this point in the history
improve its contents
  • Loading branch information
jorgeorpinel committed Mar 16, 2020
1 parent e969e63 commit d07fb8a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
4 changes: 4 additions & 0 deletions public/static/docs/sidebar.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[
{
"slug": "Home",
"source": "index.md"
},
{
"slug": "install",
"source": "install/index.md",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Documentation/SidebarMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default function SidebarMenu({ id, sidebar, currentPath, onClick }) {

const timeout = setTimeout(() => {
psRef.current.update()
if (node) scrollIntoView(node, parent, { onlyScrollIfNeeded: true })
scrollIntoView(node, parent, { onlyScrollIfNeeded: true })
setIsScrollHidden(false)
}, 400)

Expand Down
8 changes: 1 addition & 7 deletions src/utils/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,7 @@ function getItemByPath(path) {
const normalizedPath = path.replace(/\/$/, '')
const isRoot = normalizedPath === PATH_ROOT.slice(0, -1)
const item = isRoot
? {
label: '',
path: '/doc',
source: '/static/docs/index.md',
prev: undefined,
next: '/doc/install'
}
? normalizedSidebar[0]
: findItem(normalizedSidebar, normalizedPath)

if (!item) return false
Expand Down
9 changes: 5 additions & 4 deletions src/utils/sidebar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,12 @@ describe('SidebarMenu/helper', () => {
it('Returns first child for the /doc path', () => {
const rawData = ['item-name']
const result = {
label: '',
path: '/doc',
source: '/static/docs/index.md',
label: 'Item Name',
path: '/doc/item-name',
source: '/static/docs/item-name.md',
tutorials: {},
prev: undefined,
next: '/doc/install'
next: undefined
}

jest.doMock('../../public/static/docs/sidebar.json', () => rawData)
Expand Down

0 comments on commit d07fb8a

Please sign in to comment.