mirror of
https://github.com/stan-smith/FossFLOW.git
synced 2026-04-23 08:31:16 -04:00
fix: hides label when no content to display
This commit is contained in:
@@ -71,7 +71,8 @@ export const LabelContainer = ({
|
||||
left: -contentSize.width * 0.5,
|
||||
top: -(contentSize.height + labelHeight + yOffset),
|
||||
py: 1,
|
||||
px: 1.5
|
||||
px: 1.5,
|
||||
overflow: 'hidden'
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -31,6 +31,12 @@ export const Node = ({ node, icon, order }: Props) => {
|
||||
});
|
||||
}, [node.position, getTilePosition]);
|
||||
|
||||
const label = useMemo(() => {
|
||||
if (node.label === undefined || node.label === '<p><br></p>') return null;
|
||||
|
||||
return node.label;
|
||||
}, [node.label]);
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -47,21 +53,23 @@ export const Node = ({ node, icon, order }: Props) => {
|
||||
top: position.y
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
position: 'absolute'
|
||||
}}
|
||||
>
|
||||
{label && (
|
||||
<Box
|
||||
sx={{
|
||||
position: 'absolute',
|
||||
top: -projectedTileSize.height
|
||||
position: 'absolute'
|
||||
}}
|
||||
/>
|
||||
<LabelContainer labelHeight={node.labelHeight} connectorDotSize={5}>
|
||||
{node.label && <MarkdownLabel label={node.label} />}
|
||||
</LabelContainer>
|
||||
</Box>
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
position: 'absolute',
|
||||
top: -projectedTileSize.height
|
||||
}}
|
||||
/>
|
||||
<LabelContainer labelHeight={node.labelHeight} connectorDotSize={5}>
|
||||
<MarkdownLabel label={label} />
|
||||
</LabelContainer>
|
||||
</Box>
|
||||
)}
|
||||
{icon && (
|
||||
<Box
|
||||
sx={{
|
||||
|
||||
@@ -29,7 +29,6 @@ export const PlaceElement: ModeActions = {
|
||||
scene.actions.createNode({
|
||||
id: generateId(),
|
||||
iconId: uiState.mode.icon.id,
|
||||
label: 'New Node',
|
||||
position: uiState.mouse.position.tile
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user