Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevDocs: remove Gutenberg components and blocks #32026

Merged
merged 4 commits into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 0 additions & 14 deletions client/devdocs/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,6 @@ const devdocs = {
context.primary = React.createElement( DevWelcome, {} );
next();
},

// Gutenberg Components
gutenbergComponents: function( context, next ) {
context.primary = (
<AsyncLoad component={ context.params.component } require="./gutenberg-components" />
);
next();
},

// Gutenberg Blocks
gutenbergBlocks: function( context, next ) {
context.primary = <AsyncLoad block={ context.params.block } require="./gutenberg-blocks" />;
next();
},
};

export default devdocs;
10 changes: 1 addition & 9 deletions client/devdocs/design/component-playground.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,7 @@ class ComponentPlayground extends Component {
'design__component-playground-code': true,
'show-code': toggleCode ? this.state.showCode : true,
} );
const { section } = this.props;
let scope = null;
switch ( section ) {
case 'gutenberg-blocks':
scope = require( 'gutenberg-blocks' );
break;
default:
scope = require( 'devdocs/design/playground-scope' );
}
const scope = require( 'devdocs/design/playground-scope' );

return (
<LiveProvider
Expand Down
13 changes: 2 additions & 11 deletions client/devdocs/design/search-collection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,10 @@ const shouldShowInstance = ( example, filter, component ) => {
return ! filter || searchPattern.toLowerCase().indexOf( filter ) > -1;
};

const shouldShowEditLink = section => section !== 'gutenberg-components';

const getReadmeFilePath = ( section, example ) => {
switch ( section ) {
case 'design':
return `/client/components/${ example.props.readmeFilePath }/README.md`;
case 'gutenberg-components':
return `/node_modules/@wordpress/components/src/${ example.props.readmeFilePath }/README.md`;
default:
return `/client/${ section }/${ example.props.readmeFilePath }/README.md`;
}
Expand All @@ -69,7 +65,6 @@ const Collection = ( {
camelCaseToSlug( exampleName )
) }`;
const readmeFilePath = getReadmeFilePath( section, example );
const showEditLink = shouldShowEditLink( section );

showCounter++;

Expand All @@ -93,9 +88,7 @@ const Collection = ( {
component={ component }
section={ section }
/>
{ component && (
<ReadmeViewer readmeFilePath={ readmeFilePath } showEditLink={ showEditLink } />
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that the showEditLink prop has been added in the same PR that added the whole Gutenberg components in the DevDocs (#26314), and is not used anywhere else.
I guess we could remove it from ReadmeViewer (and its tests) as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess we could remove it from ReadmeViewer (and its tests) as well.

Hmm, I still see a couple its usages that are not related to Gutenberg components and blocks: 🤔
https://github.com/Automattic/wp-calypso/search?p=1&q=%22ReadmeViewer%22&unscoped_q=%22ReadmeViewer%22

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I meant remove the showEditLink prop from ReadmeViewer (and its tests), not the entire 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.

Oh sorry, it seems I wasn't fully awake while reading your comment. 🤦‍♂️ That's exactly what you wrote the first time around, but I somehow managed to completely misunderstand it. 😄
Anyway, I'll clean it up in a follow-up.

) }
{ component && <ReadmeViewer readmeFilePath={ readmeFilePath } /> }
</div>
);
}
Expand All @@ -105,9 +98,7 @@ const Collection = ( {
<DocsExampleWrapper name={ exampleName } unique={ !! component } url={ exampleLink }>
{ example }
</DocsExampleWrapper>
{ component && (
<ReadmeViewer readmeFilePath={ readmeFilePath } showEditLink={ showEditLink } />
) }
{ component && <ReadmeViewer readmeFilePath={ readmeFilePath } /> }
</div>
);
} );
Expand Down
9 changes: 0 additions & 9 deletions client/devdocs/design/test/component-playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { LiveProvider } from 'react-live';
import ComponentPlayground from '../component-playground';

jest.mock( 'devdocs/design/playground-scope', () => 'PlaygroundScope' );
jest.mock( 'gutenberg-blocks', () => 'GutenbergBlocks' );

describe( 'ComponentPlayground', () => {
test( 'LiveProvider should use the components scope by default', () => {
Expand All @@ -26,12 +25,4 @@ describe( 'ComponentPlayground', () => {
const liveProvider = wrapper.find( LiveProvider );
expect( liveProvider.props().scope ).toBe( 'PlaygroundScope' );
} );

test( 'LiveProvider should use the Gutenberg blocks scope when section is Gutenberg blocks', () => {
const wrapper = shallow(
<ComponentPlayground section="gutenberg-blocks" code="foo" name="foo" url="foo" />
);
const liveProvider = wrapper.find( LiveProvider );
expect( liveProvider.props().scope ).toBe( 'GutenbergBlocks' );
} );
} );
7 changes: 0 additions & 7 deletions client/devdocs/gutenberg-blocks/README.md

This file was deleted.

33 changes: 0 additions & 33 deletions client/devdocs/gutenberg-blocks/example.jsx

This file was deleted.

237 changes: 0 additions & 237 deletions client/devdocs/gutenberg-blocks/examples.jsx

This file was deleted.

Loading