From 24ac075d76e3979ab4c75437c997e61f34579448 Mon Sep 17 00:00:00 2001 From: Anton Nikolaev Date: Thu, 29 Apr 2021 12:02:54 -0700 Subject: [PATCH] UI Conversion: Replaced all usages of FlexRow / FlexColumn to Layout Summary: Replaced all usages of FlexRow / FlexColumn to new Layout component Reviewed By: mweststrate Differential Revision: D28055698 fbshipit-source-id: ad50762b068c897e5c4c182ac2d575d7e3a5f166 --- .../public/databases/DatabaseStructure.tsx | 6 +-- desktop/plugins/public/databases/index.tsx | 50 ++++++++++--------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/desktop/plugins/public/databases/DatabaseStructure.tsx b/desktop/plugins/public/databases/DatabaseStructure.tsx index 29c995f08..d8987d431 100644 --- a/desktop/plugins/public/databases/DatabaseStructure.tsx +++ b/desktop/plugins/public/databases/DatabaseStructure.tsx @@ -8,13 +8,13 @@ */ import { - FlexRow, ManagedTable, TableBodyRow, TableBodyColumn, Value, renderValue, } from 'flipper'; +import {Layout} from 'flipper-plugin'; import React, {useMemo} from 'react'; import {Structure} from './index'; @@ -59,7 +59,7 @@ const DatabaseStructureManagedTable = React.memo( [columns], ); return ( - + - + ); }, ); diff --git a/desktop/plugins/public/databases/index.tsx b/desktop/plugins/public/databases/index.tsx index d043c4626..86862d0f3 100644 --- a/desktop/plugins/public/databases/index.tsx +++ b/desktop/plugins/public/databases/index.tsx @@ -12,8 +12,6 @@ import { produce, Toolbar, Select, - FlexColumn, - FlexRow, ManagedTable, Text, Button, @@ -43,7 +41,13 @@ import { } from './UpdateQueryUtil'; import sqlFormatter from 'sql-formatter'; import dateFormat from 'dateformat'; -import {createState, PluginClient, usePlugin, useValue} from 'flipper-plugin'; +import { + createState, + PluginClient, + usePlugin, + useValue, + Layout, +} from 'flipper-plugin'; const PAGE_SIZE = 50; @@ -60,7 +64,7 @@ const ErrorBar = styled.div({ textAlign: 'center', }); const QueryHistoryManagedTable = styled(ManagedTable)({paddingLeft: 16}); -const PageInfoContainer = styled(FlexRow)({alignItems: 'center'}); +const PageInfoContainer = styled(Layout.Horizontal)({alignItems: 'center'}); const TableInfoTextArea = styled(Textarea)({ width: '98%', height: '100%', @@ -171,7 +175,7 @@ const QueryHistory = React.memo(({history}: {history: Array}) => { } return ( - + }) => { rows={rows} horizontallyScrollable={true} /> - + ); }); @@ -220,7 +224,7 @@ const PageInfo = React.memo((props: PageInfoProps) => { ); return ( - +
{props.count === props.totalRows @@ -262,7 +266,7 @@ const DataTable = React.memo( onRowEdited: (changes: {[key: string]: string | null}) => void; }) => page ? ( - + )} - + ) : null, ); @@ -323,7 +327,7 @@ const QueryTable = React.memo( const columns = table.columns; const rows = table.rows; return ( - + )} - + ); } else if (query.id && query.id !== null) { return ( - + Row id: {query.id} - + ); } else if (query.count && query.count !== null) { return ( - + Rows affected: {query.count} - + ); } else { return null; @@ -1046,7 +1050,7 @@ export function Component() { {}; return ( - +
) : null} - - + + {state.viewMode === 'data' ? ( ) : null} - - + + - + {state.viewMode === 'SQL' && state.executionTime !== 0 ? ( {state.executionTime} ms ) : null} @@ -1248,11 +1252,11 @@ export function Component() { onForward={onNextPageClicked} /> ) : null} - + {state.error && ( {getStringFromErrorLike(state.error)} )} - + ); }