Skip to content

Commit

Permalink
fix: adjust node styles
Browse files Browse the repository at this point in the history
  • Loading branch information
yvonneyx committed Sep 27, 2024
1 parent a823f91 commit 10c9cea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
17 changes: 11 additions & 6 deletions packages/graphs/src/core/base/node/organization-chart-node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface OrganizationChartNodeProps extends Pick<React.HTMLAttributes<HT
/**
* Working status of the person
*/
status: string;
status?: string;
/**
* Whether the node is hovered
*/
Expand All @@ -33,8 +33,7 @@ const StyledWrapper = styled.div<{ $color?: string; $isActive?: boolean }>`
${(props) =>
props.$isActive &&
css`
height: calc(100% - 6px);
width: calc(100% - 6px);
transform: translate(-3px, -3px);
border: 3px solid #1783ff;
`}
Expand Down Expand Up @@ -65,25 +64,31 @@ const StyledWrapper = styled.div<{ $color?: string; $isActive?: boolean }>`
}
&-detail {
flex: 1;
width: calc(100% - 56px);
}
&-name {
color: #242424;
font-weight: 600;
font-size: 18px;
margin-bottom: 5px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&-post {
color: #616161;
font-size: 14px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
`;

export const OrganizationChartNode: React.FC<OrganizationChartNodeProps> = (props) => {
const { name, position, status, isActive, className, style } = props;
const { name, position, status = 'online', isActive, className, style } = props;

const colorMap = {
online: '#1783FF',
Expand All @@ -98,7 +103,7 @@ export const OrganizationChartNode: React.FC<OrganizationChartNodeProps> = (prop
<div className="org-chart-node-content-avatar">{name.slice(0, 1)}</div>
<div className="org-chart-node-content-detail">
<div className="org-chart-node-content-name">{name}</div>
<div className="org-chart-node-content-post">{position}</div>
{position && <div className="org-chart-node-content-post">{position}</div>}
</div>
</div>
</StyledWrapper>
Expand Down
1 change: 1 addition & 0 deletions packages/graphs/tests/demos/organization-chart2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const OrganizationChart2 = () => {
endArrow: true,
},
},
behaviors: (prev) => [...prev, 'hover-activate-neighbors'],
transforms: (prev) => [
...prev.filter((t) => (t as any).type !== 'collapse-expand-react-node'),
{
Expand Down

0 comments on commit 10c9cea

Please sign in to comment.