From e4b0d6d1cdaff2e47407d47d63eee69a72454e6c Mon Sep 17 00:00:00 2001 From: Gigi Date: Tue, 14 Oct 2025 00:50:52 +0200 Subject: [PATCH] refactor: unify button styles across sidebars using IconButton - Convert HighlightsPanel buttons to use IconButton component - Add style prop support to IconButton for custom styling - Remove redundant CSS for old button classes (level-toggle-btn, refresh-highlights-btn, etc.) - Keep only highlight-level-toggles container styling - Consistent button appearance across left and right sidebars - DRY: Single IconButton component handles all sidebar buttons --- .../HighlightsPanel/HighlightsPanelHeader.tsx | 74 +++++++++---------- src/components/IconButton.tsx | 6 +- src/styles/layout/highlights.css | 32 -------- 3 files changed, 39 insertions(+), 73 deletions(-) diff --git a/src/components/HighlightsPanel/HighlightsPanelHeader.tsx b/src/components/HighlightsPanel/HighlightsPanelHeader.tsx index 2faffc05..fa156592 100644 --- a/src/components/HighlightsPanel/HighlightsPanelHeader.tsx +++ b/src/components/HighlightsPanel/HighlightsPanelHeader.tsx @@ -1,7 +1,7 @@ import React from 'react' -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faChevronRight, faEye, faEyeSlash, faRotate, faUser, faUserGroup, faNetworkWired } from '@fortawesome/free-solid-svg-icons' import { HighlightVisibility } from '../HighlightsPanel' +import IconButton from '../IconButton' interface HighlightsPanelHeaderProps { loading: boolean @@ -32,76 +32,72 @@ const HighlightsPanelHeader: React.FC = ({
{onHighlightVisibilityChange && (
- - - + style={{ color: highlightVisibility.mine ? 'var(--highlight-color-mine, #eab308)' : undefined }} + />
)} {onRefresh && ( - + spin={loading} + /> )} {hasHighlights && ( - + ariaLabel={showHighlights ? 'Hide highlights' : 'Show highlights'} + variant="ghost" + /> )}
- + ariaLabel="Collapse highlights panel" + variant="ghost" + style={{ transform: 'rotate(180deg)' }} + /> ) diff --git a/src/components/IconButton.tsx b/src/components/IconButton.tsx index 8b046d28..bbde52a3 100644 --- a/src/components/IconButton.tsx +++ b/src/components/IconButton.tsx @@ -12,6 +12,7 @@ interface IconButtonProps { disabled?: boolean spin?: boolean className?: string + style?: React.CSSProperties } const IconButton: React.FC = ({ @@ -23,7 +24,8 @@ const IconButton: React.FC = ({ size = 33, disabled = false, spin = false, - className = '' + className = '', + style }) => { return (