Update setup and createTable tutorial to 100% Sandy

Summary:
The current desktop plugin tutorial was outdated as it has several steps that are now automated, and still referred to old APIs. This has been updated now.

Additionally left the intermediate code of the tutorial in the plugin, but splitting `index.tsx` into `index_table.tsx` and `index_custom.tsx` (which will be updated in the next diff)

Clarified the tutorial page labels a little bit to show that 3 pages are covering the Desktop plugin development process.

Changelog: Updated the Desktop plugin tutorial

Reviewed By: jknoxville

Differential Revision: D28990029

fbshipit-source-id: a06a7a774ceca3daf10f8e8fbd4e03191dbfd1cc
This commit is contained in:
Michel Weststrate
2021-06-09 07:25:19 -07:00
committed by Facebook GitHub Bot
parent 0ba08150f6
commit a0c872dd38
9 changed files with 92 additions and 130 deletions

View File

@@ -5,7 +5,7 @@
"private": true,
"version": "0.0.0",
"main": "dist/bundle.js",
"flipperBundlerEntry": "src/index.tsx",
"flipperBundlerEntry": "src/index_table.tsx",
"license": "MIT",
"keywords": [
"flipper-plugin"

View File

@@ -29,7 +29,7 @@ import {act} from '@testing-library/react';
}
import {TestUtils} from 'flipper-plugin';
import * as MammalsPlugin from '..';
import * as MammalsPlugin from '../index_custom';
test('It can store rows', () => {
const {instance, sendEvent} = TestUtils.startPlugin(MammalsPlugin);

View File

@@ -0,0 +1,43 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import {DataTableColumn, createTablePlugin} from 'flipper-plugin';
type Row = {
id: number;
title: string;
url: string;
};
const columns: DataTableColumn<Row>[] = [
{
key: 'title',
width: 150,
},
{
key: 'url',
title: 'URL',
},
];
/**
* Table based plugin, based on the table tutorial:
* https://fbflipper.com/docs/tutorial/js-table
*
* For a custom Plugin layout, update this file according to the custom plugin tutorial:
* https://fbflipper.com/docs/tutorial/js-custom
*
* The full API of createTablePlugin can be found here:
* https://fbflipper.com/docs/extending/flipper-plugin#createtableplugin
*/
module.exports = createTablePlugin<Row>({
columns,
key: 'id',
method: 'newRow',
});