Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react-components): Style the DomainObjectPanel different so it fits better on Fusion #4737

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,9 @@ export abstract class DomainObject {

public getPanelToolbar(): BaseCommand[] {
return [
new DeleteDomainObjectCommand(this),
new CopyToClipboardCommand(),
new ToggleMetricUnitsCommand()
new ToggleMetricUnitsCommand(),
new DeleteDomainObjectCommand(this)
];
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* Copyright 2024 Cognite AS
*/
import { Icon, type IconType, Body } from '@cognite/cogs.js';
import { Icon, type IconType, Body, Flex } from '@cognite/cogs.js';
import styled from 'styled-components';
import { useEffect, useMemo, useState, type ReactElement } from 'react';
import {
Expand All @@ -21,7 +21,7 @@ import { type UnitSystem } from '../../architecture/base/renderTarget/UnitSystem
import { type DomainObject } from '../../architecture/base/domainObjects/DomainObject';

const TEXT_SIZE = 'x-small';
const HEADER_SIZE = 'small';
const HEADER_SIZE = 'medium';

export const DomainObjectPanel = (): ReactElement => {
const [currentDomainObjectInfo, setCurrentDomainObjectInfo] = useState<
Expand Down Expand Up @@ -73,25 +73,15 @@ export const DomainObjectPanel = (): ReactElement => {
margin: style.marginPx,
padding: style.paddingPx
}}>
<table>
<tbody>
<tr>
{icon !== undefined && (
<PaddedTh>
<Icon type={icon} />
</PaddedTh>
)}
{text !== undefined && (
<PaddedTh>
<Body size={HEADER_SIZE}>{text}</Body>
</PaddedTh>
)}
<th>
<CommandButtons commands={commands} isHorizontal={true} />
</th>
</tr>
</tbody>
</table>
<Flex justifyContent={'space-between'} alignItems={'center'}>
<Flex gap={8}>
{icon !== undefined && <Icon type={icon} />}
{text !== undefined && <Body size={HEADER_SIZE}>{text}</Body>}
</Flex>
<Flex>
<CommandButtons commands={commands} isHorizontal={true} />
</Flex>
</Flex>
<table>
<tbody>{info.items.map((item, _i) => addTextWithNumber(item, unitSystem))}</tbody>
</table>
Expand Down
Loading