From 1a315c510e0cd99d82edc5188519730ec0a14ddd Mon Sep 17 00:00:00 2001 From: Anton Nikolaev Date: Thu, 29 Apr 2021 12:02:54 -0700 Subject: [PATCH] UI Conversion: Switched ButtonGroup to Radio Summary: Switched button group to Ant's radio buttons Reviewed By: mweststrate Differential Revision: D28068173 fbshipit-source-id: bcde8f32d76f76c18cf8bc8c8742bc3e01c54c7c --- .../public/databases/ButtonNavigation.tsx | 35 +++------ desktop/plugins/public/databases/index.tsx | 71 ++++++++++--------- 2 files changed, 47 insertions(+), 59 deletions(-) diff --git a/desktop/plugins/public/databases/ButtonNavigation.tsx b/desktop/plugins/public/databases/ButtonNavigation.tsx index 5e7e52a05..fa662ff0a 100644 --- a/desktop/plugins/public/databases/ButtonNavigation.tsx +++ b/desktop/plugins/public/databases/ButtonNavigation.tsx @@ -7,8 +7,9 @@ * @format */ -import {Button, ButtonGroup, Glyph, colors} from 'flipper'; +import {Radio} from 'antd'; import React from 'react'; +import {LeftOutlined, RightOutlined} from '@ant-design/icons'; export default React.memo( (props: { @@ -22,30 +23,14 @@ export default React.memo( onForward: () => void; }) => { return ( - - - - + + + + + + + + ); }, ); diff --git a/desktop/plugins/public/databases/index.tsx b/desktop/plugins/public/databases/index.tsx index b905cd6ca..004de674b 100644 --- a/desktop/plugins/public/databases/index.tsx +++ b/desktop/plugins/public/databases/index.tsx @@ -48,7 +48,14 @@ import { Layout, useMemoize, } from 'flipper-plugin'; -import {Select} from 'antd'; +import {Select, Radio, RadioChangeEvent, Typography} from 'antd'; +import { + ConsoleSqlOutlined, + DatabaseOutlined, + HistoryOutlined, + SettingOutlined, + TableOutlined, +} from '@ant-design/icons'; const {Option} = Select; @@ -822,6 +829,13 @@ export function Component() { const instance = usePlugin(plugin); const state = useValue(instance.state); + const onViewModeChanged = useCallback( + (evt: RadioChangeEvent) => { + instance.updateViewMode({viewMode: evt.target.value ?? 'data'}); + }, + [instance], + ); + const onDataClicked = useCallback(() => { instance.updateViewMode({viewMode: 'data'}); }, [instance]); @@ -1090,39 +1104,28 @@ export function Component() { return ( - - - - - - - + + + + Data + + + + Structure + + + + SQL + + + + Table Info + + + + Query History + + {state.viewMode === 'data' || state.viewMode === 'structure' ||