Skip to content

Commit 803b0cf

Browse files
committed
🤖 refactor: Convert ReviewControls to Tailwind CSS
- Replaced styled container, labels, inputs, and buttons with Tailwind - Converted checkbox labels with hover states - Separator and stat badge using Tailwind utilities
1 parent 06a1d3b commit 803b0cf

File tree

1 file changed

+18
-108
lines changed

1 file changed

+18
-108
lines changed

src/components/RightSidebar/CodeReview/ReviewControls.tsx

Lines changed: 18 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44

55
import React, { useState } from "react";
6-
import styled from "@emotion/styled";
76
import { usePersistedState } from "@/hooks/usePersistedState";
87
import type { ReviewFilters, ReviewStats } from "@/types/review";
98
import { RefreshButton } from "./RefreshButton";
@@ -20,101 +19,6 @@ interface ReviewControlsProps {
2019
refreshTrigger?: number;
2120
}
2221

23-
const ControlsContainer = styled.div`
24-
padding: 8px 12px;
25-
background: #252526;
26-
border-bottom: 1px solid #3e3e42;
27-
display: flex;
28-
gap: 12px;
29-
align-items: center;
30-
flex-wrap: wrap;
31-
font-size: 11px;
32-
`;
33-
34-
const Label = styled.label`
35-
color: #888;
36-
font-weight: 500;
37-
white-space: nowrap;
38-
`;
39-
40-
const BaseInput = styled.input`
41-
padding: 4px 8px;
42-
background: #1e1e1e;
43-
color: #ccc;
44-
border: 1px solid #444;
45-
border-radius: 3px;
46-
font-size: 11px;
47-
font-family: var(--font-monospace);
48-
width: 140px;
49-
transition: border-color 0.2s ease;
50-
51-
&:hover {
52-
border-color: #007acc;
53-
}
54-
55-
&:focus {
56-
outline: none;
57-
border-color: #007acc;
58-
}
59-
60-
&::placeholder {
61-
color: #666;
62-
}
63-
`;
64-
65-
const StatBadge = styled.div`
66-
padding: 4px 10px;
67-
border-radius: 3px;
68-
font-weight: 500;
69-
font-size: 11px;
70-
background: transparent;
71-
border: 1px solid transparent;
72-
white-space: nowrap;
73-
color: #888;
74-
`;
75-
76-
const Separator = styled.div`
77-
width: 1px;
78-
height: 16px;
79-
background: #3e3e42;
80-
`;
81-
82-
const CheckboxLabel = styled.label`
83-
display: flex;
84-
align-items: center;
85-
gap: 6px;
86-
color: #ccc;
87-
font-size: 11px;
88-
cursor: pointer;
89-
white-space: nowrap;
90-
91-
&:hover {
92-
color: #fff;
93-
}
94-
95-
input[type="checkbox"] {
96-
cursor: pointer;
97-
}
98-
`;
99-
100-
const SetDefaultButton = styled.button`
101-
padding: 2px 8px;
102-
background: transparent;
103-
color: #888;
104-
border: none;
105-
border-radius: 3px;
106-
font-size: 11px;
107-
cursor: pointer;
108-
transition: all 0.2s ease;
109-
font-family: var(--font-primary);
110-
white-space: nowrap;
111-
112-
&:hover {
113-
background: rgba(255, 255, 255, 0.05);
114-
color: #ccc;
115-
}
116-
`;
117-
11822
export const ReviewControls: React.FC<ReviewControlsProps> = ({
11923
filters,
12024
stats,
@@ -178,17 +82,18 @@ export const ReviewControls: React.FC<ReviewControlsProps> = ({
17882
const showSetDefault = filters.diffBase !== defaultBase;
17983

18084
return (
181-
<ControlsContainer>
85+
<div className="py-2 px-3 bg-[#252526] border-b border-[#3e3e42] flex gap-3 items-center flex-wrap text-[11px]">
18286
{onRefresh && <RefreshButton onClick={onRefresh} isLoading={isLoading} />}
183-
<Label>Base:</Label>
184-
<BaseInput
87+
<label className="text-[#888] font-medium whitespace-nowrap">Base:</label>
88+
<input
18589
type="text"
18690
list="base-suggestions"
18791
value={inputValue}
18892
onChange={handleInputChange}
18993
onBlur={handleBaseBlur}
19094
onKeyDown={handleBaseKeyDown}
19195
placeholder="HEAD, main, etc."
96+
className="py-1 px-2 bg-[#1e1e1e] text-[#ccc] border border-[#444] rounded text-[11px] font-[var(--font-monospace)] w-[140px] transition-[border-color] duration-200 hover:border-[#007acc] focus:outline-none focus:border-[#007acc] placeholder:text-[#666]"
19297
/>
19398
<datalist id="base-suggestions">
19499
<option value="HEAD" />
@@ -202,22 +107,27 @@ export const ReviewControls: React.FC<ReviewControlsProps> = ({
202107
</datalist>
203108

204109
{showSetDefault && (
205-
<SetDefaultButton onClick={handleSetDefault}>Set Default</SetDefaultButton>
110+
<button
111+
onClick={handleSetDefault}
112+
className="py-0.5 px-2 bg-transparent text-[#888] border-none rounded text-[11px] cursor-pointer transition-all duration-200 font-[var(--font-primary)] whitespace-nowrap hover:bg-[rgba(255,255,255,0.05)] hover:text-[#ccc]"
113+
>
114+
Set Default
115+
</button>
206116
)}
207117

208-
<CheckboxLabel>
118+
<label className="flex items-center gap-1.5 text-[#ccc] text-[11px] cursor-pointer whitespace-nowrap hover:text-white [&_input[type='checkbox']]:cursor-pointer">
209119
<input
210120
type="checkbox"
211121
checked={filters.includeUncommitted}
212122
onChange={handleUncommittedToggle}
213123
/>
214124
Uncommitted
215-
</CheckboxLabel>
125+
</label>
216126

217-
<CheckboxLabel>
127+
<label className="flex items-center gap-1.5 text-[#ccc] text-[11px] cursor-pointer whitespace-nowrap hover:text-white [&_input[type='checkbox']]:cursor-pointer">
218128
<input type="checkbox" checked={filters.showReadHunks} onChange={handleShowReadToggle} />
219129
Show read
220-
</CheckboxLabel>
130+
</label>
221131

222132
<UntrackedStatus
223133
workspaceId={workspaceId}
@@ -226,11 +136,11 @@ export const ReviewControls: React.FC<ReviewControlsProps> = ({
226136
onRefresh={onRefresh}
227137
/>
228138

229-
<Separator />
139+
<div className="w-px h-4 bg-[#3e3e42]" />
230140

231-
<StatBadge>
141+
<div className="py-1 px-2.5 rounded font-medium text-[11px] bg-transparent border border-transparent whitespace-nowrap text-[#888]">
232142
{stats.read} read / {stats.total} total
233-
</StatBadge>
234-
</ControlsContainer>
143+
</div>
144+
</div>
235145
);
236146
};

0 commit comments

Comments
 (0)