-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎁 [punch]: Enable 3D in sidesheet (#951)
Added tooltip to info button on tag overlays in ModelViewer. Fixed bug with not clearing selectedTags state variable.
- Loading branch information
1 parent
68fe781
commit 6d6f03e
Showing
16 changed files
with
190 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { Typography, Icon, Button, Popover } from '@equinor/eds-core-react'; | ||
import { TagOverlay } from '../../types/overlayTags'; | ||
import * as Icons from '@equinor/eds-icons'; | ||
import { useRef, useState } from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
interface TagInfoProps { | ||
tag: TagOverlay; | ||
} | ||
|
||
export const defaultTagColor = '#a0dd28'; | ||
|
||
Icon.add(Icons); | ||
|
||
export const TagInfo = (props: TagInfoProps) => { | ||
const { tag } = props; | ||
|
||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
const ref = useRef<HTMLButtonElement>(null); | ||
|
||
const onClose = () => { | ||
setIsOpen(false); | ||
}; | ||
|
||
const onOpen = () => { | ||
setIsOpen(true); | ||
}; | ||
|
||
return ( | ||
<> | ||
<StyledTagInfoIcon> | ||
<Button | ||
ref={ref} | ||
variant="ghost_icon" | ||
onClick={() => { | ||
if (tag.action) tag.action(tag); | ||
else onOpen(); | ||
}} | ||
> | ||
<Icon name="info_circle" title="tag information" /> | ||
</Button> | ||
</StyledTagInfoIcon> | ||
|
||
<Popover | ||
open={isOpen} | ||
id="tag-popover" | ||
anchorEl={ref.current} | ||
placement="bottom-end" | ||
onClose={onClose} | ||
> | ||
<Popover.Header> | ||
<Popover.Title>Details</Popover.Title> | ||
<Button | ||
style={{ height: '32px', width: '32px' }} | ||
variant="ghost_icon" | ||
aria-label="Close" | ||
onClick={onClose} | ||
> | ||
<Icon name="close" size={24} /> | ||
</Button> | ||
</Popover.Header> | ||
<Popover.Content> | ||
<Typography variant="body_short">{tag.description}</Typography> | ||
</Popover.Content> | ||
</Popover> | ||
</> | ||
); | ||
}; | ||
|
||
const StyledTagInfoIcon = styled.div` | ||
margin: 3px; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
libs/punchsidesheet/src/lib/utils-sidesheet/useModelViewerTags.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Punch } from '@cc-components/punchshared'; | ||
import { TagOverlay } from '@cc-components/modelviewer'; | ||
|
||
export const useModelViewerTags = (punch?: Punch): TagOverlay[] => { | ||
if (!punch) return []; | ||
|
||
return [ | ||
{ | ||
tagNo: punch.tagNo ?? 'No tag', | ||
description: punch.description ?? 'No description', | ||
status: punch.category, | ||
icon: <h3>{punch.category}</h3>, | ||
}, | ||
]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.