Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

feat(docs): make categories collapsible #1611

Merged
merged 32 commits into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2c93342
implement collapsible categories
lucivpav Jul 9, 2019
47e5bbb
fix tree not accessible by keyboard
lucivpav Jul 10, 2019
680401f
rename variables
lucivpav Jul 10, 2019
669c6b9
remove dividers within a Tree
lucivpav Jul 10, 2019
d35dc06
make the clickable tree item area larger
lucivpav Jul 10, 2019
871dc7e
remove unused styles
lucivpav Jul 10, 2019
59492d0
Merge branch 'master' into docs/collapsible-categories
lucivpav Jul 10, 2019
284625a
slighly increase sidebar width so that all items fit
lucivpav Jul 10, 2019
08d6007
another sidebar width increase
lucivpav Jul 10, 2019
52001ca
fix build errors
lucivpav Jul 10, 2019
351b717
Merge branch 'master' into docs/collapsible-categories
lucivpav Jul 10, 2019
61ee9b6
Merge branch 'master' into docs/collapsible-categories
lucivpav Jul 10, 2019
42ce969
use keyDown instead of keyUp
lucivpav Jul 11, 2019
7845baf
fix main content / sidebar padding issue
lucivpav Jul 11, 2019
823ae37
fix not being possible to navigate between menu and tree in sidebar u…
lucivpav Jul 11, 2019
26af319
Merge branch 'master' into docs/collapsible-categories
lucivpav Jul 11, 2019
911ad61
show collapsibility icon
lucivpav Jul 12, 2019
07c0137
fix sidebar width not being set
lucivpav Jul 12, 2019
4bd2a46
small improvements
lucivpav Jul 12, 2019
70742b7
Merge branch 'master' into docs/collapsible-categories
lucivpav Jul 12, 2019
42e1e34
highlight current page
lucivpav Jul 12, 2019
b603e1f
Merge branch 'master' into docs/collapsible-categories
lucivpav Jul 12, 2019
6a03652
add changelog entry
lucivpav Jul 12, 2019
fb92503
Merge branch 'master' into docs/collapsible-categories
lucivpav Jul 12, 2019
70f3734
fix issues with RR & update it
layershifter Jul 15, 2019
37772d0
remove useless config
layershifter Jul 15, 2019
053095d
add todo
layershifter Jul 15, 2019
ce81272
small refactor
layershifter Jul 15, 2019
ac191c8
move styles to provider
lucivpav Jul 15, 2019
b4ba0f5
Update CHANGELOG.md
lucivpav Jul 15, 2019
8b8b909
small improvements
lucivpav Jul 15, 2019
cdb0e50
fix quick start link
lucivpav Jul 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions docs/src/components/DocsLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import * as PropTypes from 'prop-types'
import * as React from 'react'
import { withRouter } from 'react-router'

import { Route } from 'react-router-dom'
import Sidebar from 'docs/src/components/Sidebar/Sidebar'
import { scrollToAnchor } from 'docs/src/utils'
import { getUnhandledProps, mergeThemes } from 'src/lib'
import { mergeThemes } from 'src/lib'

const anchors = new AnchorJS({
class: 'anchor-link',
Expand Down Expand Up @@ -67,8 +66,9 @@ class DocsLayout extends React.Component<any, any> {
})
}

renderChildren = props => {
const { component: Children, render } = this.props
renderChildren() {
const { children, render } = this.props
const sidebarWidth = '270px'

return (
<>
Expand All @@ -86,19 +86,17 @@ class DocsLayout extends React.Component<any, any> {
},
})}
lucivpav marked this conversation as resolved.
Show resolved Hide resolved
>
<Sidebar />
<Sidebar width={sidebarWidth} />
</Provider>
<div role="main" style={{ marginLeft: 250 }}>
{render ? render() : <Children {...props} />}
<div role="main" style={{ marginLeft: sidebarWidth }}>
{render ? render() : children}
</div>
</>
)
}

render() {
const unhandledProps = getUnhandledProps(DocsLayout, this.props)

return <Route {...unhandledProps} render={this.renderChildren} />
return this.renderChildren()
}
}

Expand Down
20 changes: 7 additions & 13 deletions docs/src/components/MarkdownPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Header } from '@stardust-ui/react'
import * as React from 'react'
import { RouteProps } from 'react-router'

import DocsLayout from 'docs/src/components/DocsLayout'
import { link } from 'docs/src/utils/helpers'
import DocPage from 'docs/src/components/DocPage'
import GuidesNavigationFooter, { PageDescriptor } from 'docs/src/components/GuidesNavigationFooter'
Expand Down Expand Up @@ -39,21 +38,16 @@ const components = {
}

const MarkdownPage: React.FunctionComponent<MarkdownPageProps> = props => {
const { page, ...rest } = props
const { page } = props
const { default: Component, meta } = page

return (
<DocsLayout
{...rest}
render={() => (
<DocPage title={meta.title}>
<MDXProvider components={components}>
<Component />
</MDXProvider>
<GuidesNavigationFooter previous={meta.previous} next={meta.next} />
</DocPage>
)}
/>
<DocPage title={meta.title}>
<MDXProvider components={components}>
<Component />
</MDXProvider>
<GuidesNavigationFooter previous={meta.previous} next={meta.next} />
</DocPage>
)
}

Expand Down
Loading