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

docs: cleanup examples #69

Merged
merged 9 commits into from
Aug 9, 2018
Merged

docs: cleanup examples #69

merged 9 commits into from
Aug 9, 2018

Conversation

levithomason
Copy link
Member

@levithomason levithomason commented Aug 9, 2018

This is largely a breakout of #16.

This PR cleans up various doc site issues. Fixes console warnings / errors regarding props, bad imports, missing punctuation, mismatched filename/class name/example titles, etc.

@@ -23,7 +23,7 @@ const ComponentControls: any = props => {
} = props

return (
<Menu color="green" icon="labeled" size="tiny" fitted compact text>
<Menu color="green" icon="labeled" size="tiny" compact text>
Copy link
Member Author

Choose a reason for hiding this comment

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

Not a prop

@@ -4,7 +4,7 @@ import * as React from 'react'
import { withRouter, RouteComponentProps } from 'react-router'
import { renderToStaticMarkup } from 'react-dom/server'
import { html } from 'js-beautify'
import copyToClipboard from 'copy-to-clipboard'
import * as copyToClipboard from 'copy-to-clipboard'
Copy link
Member Author

Choose a reason for hiding this comment

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

Missed import bug fix

@@ -346,7 +346,7 @@ class ComponentExample extends React.PureComponent<IComponentExampleProps, IComp
return Knobs ? <Knobs {...this.getKnobsValue()} onKnobChange={this.handleKnobChange} /> : null
}

private getComponentName = () => this.props.examplePath.split('/')[1]
private getDisplayName = () => this.props.examplePath.split('/')[1]
Copy link
Member Author

Choose a reason for hiding this comment

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

More proper name

@@ -175,7 +175,7 @@ class Sidebar extends React.Component<any, any> {
</small>
</strong>
</Menu.Item>
<Menu.Item as={NavLink} to="/" activeClassName="active">
<Menu.Item as={NavLink} exact to="/" activeClassName="active">
Copy link
Member Author

Choose a reason for hiding this comment

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

Item matches all routes if not exact, making the item highlighted

@codecov
Copy link

codecov bot commented Aug 9, 2018

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #69   +/-   ##
=======================================
  Coverage   85.92%   85.92%           
=======================================
  Files          74       74           
  Lines        1101     1101           
  Branches      216      225    +9     
=======================================
  Hits          946      946           
  Misses        149      149           
  Partials        6        6

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 5afd39b...59a7f59. Read the comment docs.

@@ -1,7 +1,7 @@
import React from 'react'
import { Header } from '@stardust-ui/react'

const HeaderExampleSubheader = () => (
const HeaderExampleDescriptionCustomization = () => (
Copy link
Member Author

Choose a reason for hiding this comment

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

Note, all example names need to match file names, which should match the title of the example. We could use a conformance test around this.

this.setState({ display: 'none' })
hide = () => {
this.setState({ hidden: true })
setTimeout(() => this.setState({ hidden: false }), 2000)
Copy link
Member Author

Choose a reason for hiding this comment

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

There was previously no way to try this example again after "dismissing" the label.

display: 'inline-block',
}
}
class LabelExampleOnIconClickShorthand extends React.Component {
Copy link
Member Author

Choose a reason for hiding this comment

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

Do not use TS in examples, consumers are likely not running TS.

return (
<Label
circular
style={{ display }}
content="Removable label"
Copy link
Member Author

Choose a reason for hiding this comment

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

Do not use inline styles in examples. Our components and examples need to be exemplar, showing users how to accomplish tasks without inline styles. Using inline styles defeats one of the core purposes of Stardust.

examplePath="components/Label/Variations/LabelExampleCircular"
/>
<ComponentExample
title="Icon"
description="The label can contain an icon"
description="The label can contain an icon."
Copy link
Member Author

Choose a reason for hiding this comment

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

Always use complete sentences and periods in example descriptions.

title="The Icon inside Label can be customized"
description="The Icon component inside the Label can be defined with customizing it's prop"
examplePath="components/Label/Variations/LabelExampleIconAsShorthand"
title="Icon props"
Copy link
Member Author

Choose a reason for hiding this comment

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

Do not put sentences in example titles. Titles should be prop names. If no prop name is available then use a very concise title.

@levithomason levithomason merged commit b5e92cf into master Aug 9, 2018
@levithomason levithomason deleted the docs/cleanup branch August 9, 2018 07:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant