Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/grumpy-eagles-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hyperse/inspector-component": patch
---

refactor: update Overlay and Panel components to simplify props and improve styling logic
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ export const OverlayRectContent = styled.div`
background-color: rgba(111, 168, 220, 0.66);
`;

export const OverlayTipRoot = styled.div<{ showcornerhint?: 'block' | 'none' }>`
--inspector-tip-corner-hint-display: ${(props) => props.showcornerhint};
export const OverlayTipRoot = styled.div<{ display?: 'block' | 'none' }>`
--corner-radius: 6px;
--inspector-tip-color-bg: #333740;
--color-shadow-1: #aaa1;
Expand Down Expand Up @@ -129,7 +128,6 @@ export const OverlayCornerHint = styled.div`
width: min-content;
overflow: visible;
position: relative;
display: var(--inspector-tip-corner-hint-display);
align-items: flex-start;
justify-content: center;
padding-top: 1px;
Expand Down
12 changes: 1 addition & 11 deletions packages/inspector-component/src/components/Panel.styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ export const PanelActionLayout = styled.div`
padding: 4px;
`;

export const PanelActionButton = styled.button<{
active: string;
}>`
export const PanelActionButton = styled.button`
cursor: pointer;
padding: 6px 8px;
font-size: 14px;
Expand All @@ -53,14 +51,6 @@ export const PanelActionButton = styled.button<{
background-color: rgba(255, 255, 255, 0.1);
transition: background-color 0.2s ease-in-out;
}
${({ active }) =>
active === 'true'
? css`
color: #ee78e6;
`
: css`
color: rgba(255, 255, 255, 0.9);
`}
`;

export const PanelContentLayout = styled.div`
Expand Down
7 changes: 5 additions & 2 deletions packages/inspector-component/src/overlay/OverlayTip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ const OverlayTip =
<Overlay.OverlayTipRoot
ref={containerRef}
className={className}
showcornerhint={showCornerHint ? 'block' : 'none'}
style={{
display: hidden ? 'none' : 'flex',
translate: position.translate,
Expand All @@ -111,7 +110,11 @@ const OverlayTip =
{width}px × {height}px
</Overlay.OverlaySize>
</Overlay.OverlayInfoRow>
<Overlay.OverlayCornerHint>{cornerHintText}</Overlay.OverlayCornerHint>
<Overlay.OverlayCornerHint
style={{
display: showCornerHint ? 'block' : 'none',
}}
>{cornerHintText}</Overlay.OverlayCornerHint>
</Overlay.OverlayTipRoot>
);
}
Expand Down
8 changes: 6 additions & 2 deletions packages/inspector-component/src/panel/InspectPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,17 @@ export const InspectPanel = <Item extends ElementItem = ElementItem>(
</Panel.PanelDragHandle>
<Panel.PanelActionLayout>
<Panel.PanelActionButton
active={`${chainMode === ElementChainMode.Render}`}
style={{
color: chainMode === ElementChainMode.Render ? '#ee78e6' : 'rgba(255, 255, 255, 0.9)',
}}
onClick={() => setChainMode(ElementChainMode.Render)}
>
Render Chain
</Panel.PanelActionButton>
<Panel.PanelActionButton
active={`${chainMode === ElementChainMode.Source}`}
style={{
color: chainMode === ElementChainMode.Source ? '#ee78e6' : 'rgba(255, 255, 255, 0.9)',
}}
onClick={() => setChainMode(ElementChainMode.Source)}
>
Source Chain
Expand Down
Loading