Files
flipper/desktop/plugins/public/ui-debugger/components/sidebar/Inspector.tsx
Lorenzo Blasa 39a4cc22b1 Dark mode support
Summary:
This change addresses some obvious issues which made the ui-debugger unusable with dark mode on.

There may more things that need changing, but at the very least this should be a good place to start.

Reviewed By: fabiomassimo

Differential Revision: D43083218

fbshipit-source-id: 8e4338b79178d3a0f05f9bcaffa2fc6f35eb0e21
2023-02-07 07:58:12 -08:00

75 lines
2.1 KiB
TypeScript

/**
* Copyright (c) Meta Platforms, Inc. and 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 React from 'react';
// eslint-disable-next-line rulesdir/no-restricted-imports-clone
import {Glyph} from 'flipper';
import {Layout, Tab, Tabs, theme} from 'flipper-plugin';
import {Metadata, MetadataId, UINode} from '../../types';
import {IdentityInspector} from './inspector/IdentityInspector';
import {AttributesInspector} from './inspector/AttributesInspector';
import {Tooltip} from 'antd';
import {NoData} from './inspector/NoData';
type Props = {
node?: UINode;
metadata: Map<MetadataId, Metadata>;
};
export const Inspector: React.FC<Props> = ({node, metadata}) => {
if (!node) {
return <NoData message="Please select a node to view its details" />;
}
return (
<Layout.Container gap pad>
<Tabs grow centered>
<Tab
tab={
<Tooltip title="Identity">
<Layout.Horizontal center>
<Glyph name="badge" size={16} color={theme.primaryColor} />
</Layout.Horizontal>
</Tooltip>
}>
<IdentityInspector node={node} />
</Tab>
<Tab
tab={
<Tooltip title="Attributes">
<Layout.Horizontal center>
<Glyph name="data-table" size={16} color={theme.primaryColor} />
</Layout.Horizontal>
</Tooltip>
}>
<AttributesInspector
mode="attribute"
node={node}
metadata={metadata}
/>
</Tab>
<Tab
tab={
<Tooltip title="Layout">
<Layout.Horizontal center>
<Glyph
name="square-ruler"
size={16}
color={theme.primaryColor}
/>
</Layout.Horizontal>
</Tooltip>
}>
<AttributesInspector mode="layout" node={node} metadata={metadata} />
</Tab>
</Tabs>
</Layout.Container>
);
};