feat: get object metadata from backend in Object Detail and New Field… (#2122)
* feat: get object metadata from backend in Object Detail and New Field - Step 1 Closes #2008 * refactor: add useLazyLoadIcon hook
This commit is contained in:
@ -3,16 +3,18 @@ import styled from '@emotion/styled';
|
||||
|
||||
import { IconComponent } from '@/ui/display/icon/types/IconComponent';
|
||||
import { LightIconButton } from '@/ui/input/button/components/LightIconButton';
|
||||
import { useLazyLoadIcon } from '@/ui/input/hooks/useLazyLoadIcon';
|
||||
import { TableCell } from '@/ui/layout/table/components/TableCell';
|
||||
import { TableRow } from '@/ui/layout/table/components/TableRow';
|
||||
import { Field } from '~/generated-metadata/graphql';
|
||||
|
||||
import { ObjectFieldItem } from '../../types/ObjectFieldItem';
|
||||
import { ObjectFieldDataType } from '../../types/ObjectFieldDataType';
|
||||
|
||||
import { SettingsObjectFieldDataType } from './SettingsObjectFieldDataType';
|
||||
|
||||
type SettingsObjectFieldItemTableRowProps = {
|
||||
ActionIcon: IconComponent;
|
||||
fieldItem: ObjectFieldItem;
|
||||
fieldItem: Field;
|
||||
};
|
||||
|
||||
export const StyledObjectFieldTableRow = styled(TableRow)`
|
||||
@ -34,18 +36,19 @@ export const SettingsObjectFieldItemTableRow = ({
|
||||
fieldItem,
|
||||
}: SettingsObjectFieldItemTableRowProps) => {
|
||||
const theme = useTheme();
|
||||
const { Icon } = useLazyLoadIcon(fieldItem.icon ?? '');
|
||||
|
||||
return (
|
||||
<StyledObjectFieldTableRow>
|
||||
<StyledNameTableCell>
|
||||
<fieldItem.Icon size={theme.icon.size.md} />
|
||||
{fieldItem.name}
|
||||
{!!Icon && <Icon size={theme.icon.size.md} />}
|
||||
{fieldItem.label}
|
||||
</StyledNameTableCell>
|
||||
<TableCell>{fieldItem.isCustom ? 'Custom' : 'Standard'}</TableCell>
|
||||
<TableCell>
|
||||
{fieldItem.type === 'standard' ? 'Standard' : 'Custom'}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<SettingsObjectFieldDataType value={fieldItem.dataType} />
|
||||
<SettingsObjectFieldDataType
|
||||
value={fieldItem.type as ObjectFieldDataType}
|
||||
/>
|
||||
</TableCell>
|
||||
<StyledIconTableCell>
|
||||
<LightIconButton Icon={ActionIcon} accent="tertiary" />
|
||||
|
||||
Reference in New Issue
Block a user