Skip to content

Commit

Permalink
add deprecation notice to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
layershifter committed Jul 30, 2020
1 parent abed783 commit 10c10db
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
16 changes: 13 additions & 3 deletions docs/src/components/ComponentDoc/ComponentDoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _ from 'lodash'
import PropTypes from 'prop-types'
import React, { Component, createRef } from 'react'
import { withRouter, withRouteData } from 'react-static'
import { Grid, Header, Icon } from 'semantic-ui-react'
import { Grid, Header, Icon, Label, Popup } from 'semantic-ui-react'

import DocsLayout from 'docs/src/components/DocsLayout'
import { docTypes, examplePathToHash } from 'docs/src/utils'
Expand Down Expand Up @@ -47,7 +47,7 @@ class ComponentDoc extends Component {
}

render() {
const { componentsInfo, displayName, seeTags, sidebarSections } = this.props
const { componentsInfo, displayName, deprecated, seeTags, sidebarSections } = this.props
const activePath = _.findKey(this.state.exampleStates)
const componentInfo = componentsInfo[displayName]
const contextValue = { ...this.props, onVisibilityChange: this.handleExampleVisibility }
Expand All @@ -60,7 +60,16 @@ class ComponentDoc extends Component {
<Grid.Column>
<Header
as='h1'
content={displayName}
content={
<>
<span>{displayName}</span>
{deprecated && (
<Popup trigger={<Label color='black'>Deprecated</Label>}>
This component is deprecated and will be removed in the next major release.
</Popup>
)}
</>
}
subheader={_.join(componentInfo.docblock.description, ' ')}
/>
<ComponentDocSee seeTags={seeTags} />
Expand Down Expand Up @@ -107,6 +116,7 @@ class ComponentDoc extends Component {
ComponentDoc.propTypes = {
componentsInfo: PropTypes.objectOf(docTypes.componentInfoShape).isRequired,
displayName: PropTypes.string.isRequired,
deprecated: PropTypes.bool.isRequired,
history: PropTypes.object.isRequired,
location: PropTypes.object.isRequired,
seeTags: docTypes.seeTags.isRequired,
Expand Down
7 changes: 5 additions & 2 deletions docs/src/examples/addons/Responsive/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ const ResponsiveExamples = () => (
<Icon name='warning sign' />

<Message.Content>
<Message.Header>Deprecation notice!</Message.Header>
<Message.Header>Deprecation notice</Message.Header>
<p>
<code>Responsive</code> component is deprecated and will be removed in
the next major release. Please follow our <a href=''>upgrade guide</a>
the next major release. Please follow our{' '}
<a href='https://github.com/Semantic-Org/Semantic-UI-React/pull/4008'>
upgrade guide
</a>
.
</p>
</Message.Content>
Expand Down
2 changes: 2 additions & 0 deletions src/addons/Responsive/Responsive.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import isVisible from './lib/isVisible'

/**
* Responsive can control visibility of content.
*
* @deprecated This component is deprecated and will be removed in next major release.
*/
export default class Responsive extends Component {
state = {
Expand Down
4 changes: 4 additions & 0 deletions static.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export default async () => {
exampleSources,
sidebarSections,
displayName: baseInfo.displayName,
deprecated: !!_.find(
_.get(componentsInfo[baseInfo.displayName], 'docblock.tags'),
(tag) => tag.title === 'deprecated',
),
seeTags: getInfoForSeeTags(componentsInfo[baseInfo.displayName]),
}
},
Expand Down

0 comments on commit 10c10db

Please sign in to comment.