-
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.
docs(Example): add ShorthandExample and ability to version docs
- Loading branch information
1 parent
2b906ed
commit 27d745f
Showing
4 changed files
with
96 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import PropTypes from 'prop-types' | ||
import React, { PureComponent } from 'react' | ||
|
||
import { Label } from 'src' | ||
|
||
export default class ComponentVersion extends PureComponent { | ||
static propTypes = { | ||
version: PropTypes.oneOfType([ | ||
PropTypes.arrayOf(PropTypes.string), | ||
PropTypes.string, | ||
]), | ||
} | ||
|
||
computeVersions = () => { | ||
const { version } = this.props | ||
|
||
if (typeof version === 'string') return [version, null] | ||
return version | ||
} | ||
|
||
render() { | ||
const [SUIR, SUI] = this.computeVersions() | ||
|
||
return ( | ||
<div> | ||
{<Label as='a' color='teal' content={SUIR} size='tiny' title={`Available from Semantic UI React ${SUIR}`} />} | ||
{SUI && <Label as='a' color='teal' content={SUI} size='tiny' title={`Available from Semantic UI ${SUI}`} />} | ||
</div> | ||
) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
|
||
import ComponentExample from './ComponentExample' | ||
|
||
const ShorthandExample = ({ description, ...rest }) => <ComponentExample {...rest} description={description} /> | ||
|
||
ShorthandExample.propTypes = { | ||
description: PropTypes.node, | ||
} | ||
|
||
ShorthandExample.defaultProps = { | ||
description: 'You can do the same using shorthands.', | ||
} | ||
|
||
export default ShorthandExample |
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