Skip to content

Commit

Permalink
chore(react-components): Move close button to side panel header (#4906)
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonflatval-cognite authored Nov 28, 2024
1 parent 67b2e5b commit 4527648
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Accordion,
Avatar,
Button,
CloseIcon,
Divider,
Flex,
ShareIcon,
Expand All @@ -24,6 +25,7 @@ import { useCommentsForPoiQuery } from './useCommentsForPoiQuery';
import { RevealButtons } from '../RevealButtons';
import { useSelectedPoi } from './useSelectedPoi';
import { useTranslation } from '../../i18n/I18n';
import { usePoiDomainObject } from './usePoiDomainObject';

export const PoiInfoPanelContent = (): ReactNode => {
return (
Expand All @@ -37,6 +39,8 @@ export const PoiInfoPanelContent = (): ReactNode => {
const PanelHeader = (): ReactNode => {
const { t } = useTranslation();

const poiDomainObject = usePoiDomainObject();

const selectedPoi = useSelectedPoi();
if (selectedPoi === undefined) {
return undefined;
Expand All @@ -55,6 +59,10 @@ const PanelHeader = (): ReactNode => {
</Tooltip>
</Dropdown>
<RevealButtons.DeleteSelectedPointOfInterest toolbarPlacement={'top'} />
<Button
icon=<CloseIcon />
onClick={() => poiDomainObject?.setSelectedPointOfInterest(undefined)}
/>
</Flex>
</Flex>
);
Expand Down

0 comments on commit 4527648

Please sign in to comment.