-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/Semantic-Org/Semantic-UI-…
…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
- Loading branch information
Showing
340 changed files
with
3,744 additions
and
2,041 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,57 @@ | ||
import _ from 'lodash' | ||
import PropTypes from 'prop-types' | ||
import React, { Component } from 'react' | ||
import React from 'react' | ||
import DocumentTitle from 'react-document-title' | ||
import { withRouter } from 'react-router' | ||
import { Grid } from 'semantic-ui-react' | ||
|
||
import { scrollToAnchor } from 'docs/app/utils' | ||
import { withDocInfo } from 'docs/app/HOC' | ||
import ComponentDocHeader from './ComponentDocHeader' | ||
import ComponentDocLinks from './ComponentDocLinks' | ||
import ComponentDocSee from './ComponentDocSee' | ||
import ComponentExamples from './ComponentExamples' | ||
import ComponentProps from './ComponentProps' | ||
import ComponentSidebar from './ComponentSidebar' | ||
|
||
const topRowStyle = { margin: '1em' } | ||
|
||
class ComponentDoc extends Component { | ||
static childContextTypes = { | ||
onPassed: PropTypes.func, | ||
} | ||
|
||
static propTypes = { | ||
_meta: PropTypes.object, | ||
history: PropTypes.object.isRequired, | ||
} | ||
|
||
state = {} | ||
|
||
getChildContext() { | ||
return { | ||
onPassed: this.handleExamplePassed, | ||
} | ||
} | ||
|
||
componentWillReceiveProps() { | ||
this.setState({ activePath: undefined }) | ||
} | ||
|
||
handleExamplePassed = (e, { examplePath }) => this.setState({ activePath: examplePath }) | ||
|
||
handleExamplesRef = examplesRef => this.setState({ examplesRef }) | ||
|
||
handleSidebarItemClick = (e, { path }) => { | ||
const { history } = this.props | ||
const aPath = _.kebabCase(_.last(path.split('/'))) | ||
|
||
history.replace(`${location.pathname}#${aPath}`) | ||
scrollToAnchor() | ||
} | ||
|
||
render() { | ||
const { _meta } = this.props | ||
const { activePath, examplesRef } = this.state | ||
|
||
return ( | ||
<DocumentTitle title={`${_meta.name} | Semantic UI React`}> | ||
<Grid> | ||
<Grid.Row columns='equal' style={topRowStyle}> | ||
<Grid.Column> | ||
<ComponentDocHeader componentName={_meta.name} /> | ||
<ComponentDocSee componentName={_meta.name} /> | ||
<ComponentDocLinks componentName={_meta.parent || _meta.name} type={_meta.type} /> | ||
<ComponentProps componentName={_meta.name} /> | ||
</Grid.Column> | ||
<Grid.Column computer={5} largeScreen={4} widescreen={4} /> | ||
</Grid.Row> | ||
|
||
<Grid.Row columns='equal'> | ||
<Grid.Column> | ||
<div ref={this.handleExamplesRef}> | ||
<ComponentExamples componentName={_meta.name} /> | ||
</div> | ||
</Grid.Column> | ||
<Grid.Column computer={5} largeScreen={4} widescreen={4}> | ||
<ComponentSidebar | ||
activePath={activePath} | ||
componentName={_meta.parent || _meta.name} | ||
examplesRef={examplesRef} | ||
onItemClick={this.handleSidebarItemClick} | ||
/> | ||
</Grid.Column> | ||
</Grid.Row> | ||
</Grid> | ||
</DocumentTitle> | ||
) | ||
} | ||
const ComponentDoc = ({ componentGroup, componentName, description, ghLink, path, seeItems, suiLink }) => ( | ||
<DocumentTitle title={`${componentName} | Semantic UI React`}> | ||
<div> | ||
<Grid padded columns='1'> | ||
<Grid.Column> | ||
<ComponentDocHeader componentName={componentName} description={description} /> | ||
<ComponentDocSee items={seeItems} /> | ||
<ComponentDocLinks | ||
componentName={componentName} | ||
ghLink={ghLink} | ||
path={path} | ||
suiLink={suiLink} | ||
/> | ||
<ComponentProps componentGroup={componentGroup} componentName={componentName} /> | ||
</Grid.Column> | ||
</Grid> | ||
|
||
<ComponentExamples componentName={componentName} /> | ||
</div> | ||
</DocumentTitle> | ||
) | ||
|
||
ComponentDoc.propTypes = { | ||
componentGroup: PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
description: PropTypes.string, | ||
props: PropTypes.object, | ||
}), | ||
), | ||
componentName: PropTypes.string.isRequired, | ||
description: PropTypes.string, | ||
ghLink: PropTypes.string.isRequired, | ||
path: PropTypes.string.isRequired, | ||
seeItems: PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
description: PropTypes.string, | ||
name: PropTypes.string, | ||
type: PropTypes.string, | ||
}), | ||
).isRequired, | ||
suiLink: PropTypes.string, | ||
} | ||
|
||
export default withRouter(ComponentDoc) | ||
export default withDocInfo(ComponentDoc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.