Skip to content

Commit

Permalink
[GEN-1717]: Action header-node border width (#1764)
Browse files Browse the repository at this point in the history
Co-authored-by: Alon Braymok <138359965+alonkeyval@users.noreply.github.com>
  • Loading branch information
BenElferink and alonkeyval authored Nov 17, 2024
1 parent 34c2c74 commit ed0080c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const buildNodesAndEdges = ({
}),
],
actions: [
createNode('action-header', 'header', postions['actions']['x'], 0, {
createNode('action-header', 'header', postions['actions']['x'] - (!!actions.length ? 15 : 0), 0, {
icon: getEntityIcon(OVERVIEW_ENTITY_TYPES.ACTION),
title: 'Actions',
tagValue: actions.length,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface HeaderNodeProps {
}

const Container = styled.div<{ $nodeWidth: HeaderNodeProps['nodeWidth'] }>`
width: ${({ $nodeWidth }) => `${$nodeWidth + 40}px`};
width: ${({ $nodeWidth }) => `${$nodeWidth}px`};
padding: 12px 0px 16px 0px;
gap: 8px;
display: flex;
Expand All @@ -36,6 +36,10 @@ const ActionsWrapper = styled.div`

const HeaderNode = ({ data, nodeWidth }: HeaderNodeProps) => {
const { title, icon, tagValue } = data;
const isSources = title === 'Sources';
const isActions = title === 'Actions';
const extraWidth = isActions && !!tagValue ? 70 : 40;

const { configuredSources, setConfiguredSources } = useAppStore((state) => state);
const { sources } = useSourceCRUD();

Expand All @@ -50,8 +54,7 @@ const HeaderNode = ({ data, nodeWidth }: HeaderNodeProps) => {
}, [configuredSources]);

const renderActions = () => {
if (title !== 'Sources') return null;
if (!sources.length) return null;
if (!isSources || !sources.length) return null;

const onSelect = (bool: boolean) => {
if (bool) {
Expand Down Expand Up @@ -79,7 +82,7 @@ const HeaderNode = ({ data, nodeWidth }: HeaderNodeProps) => {
};

return (
<Container $nodeWidth={nodeWidth}>
<Container $nodeWidth={nodeWidth + extraWidth}>
<Image src={icon} width={16} height={16} alt={title} />
<Title size={14}>{title}</Title>
<Badge label={tagValue} />
Expand Down

0 comments on commit ed0080c

Please sign in to comment.