Skip to content

Commit ae89dc5

Browse files
committed
Split star button
1 parent 1749de1 commit ae89dc5

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

apps/web/src/components/StarButton.jsx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,24 +112,31 @@ export default function StarButton({ projectId, className, onToggle }) {
112112
? t("stars.unstar")
113113
: t("stars.star");
114114

115-
// Compact outlined buttons, used everywhere (project page and cards). Custom
116-
// rather than PrimeReact's Button, whose icon-only variant forces a fixed
117-
// square width and ignores horizontal padding. The star toggles; the count
118-
// navigates to the stargazers page.
119-
const outlined = {
115+
// A GitHub-style split button: the star toggle and the count are joined into
116+
// one outlined control, divided by a shared border. The star toggles; the
117+
// count navigates to the stargazers page. Custom (rather than PrimeReact's
118+
// SplitButton, which is a button + dropdown menu).
119+
const segment = {
120120
display: "inline-flex",
121121
alignItems: "center",
122122
justifyContent: "center",
123123
background: "transparent",
124-
border: "1px solid #6c757d",
125-
borderRadius: "6px",
126-
padding: "0.3rem 0.4rem",
124+
border: "none",
125+
padding: "0.3rem 0.45rem",
127126
fontSize: "0.8rem",
128127
lineHeight: 1,
129128
};
130129

131130
return (
132-
<span className={`flex align-items-center gap-2 ${className || ""}`}>
131+
<span
132+
className={`inline-flex ${className || ""}`}
133+
style={{
134+
border: "1px solid #6c757d",
135+
borderRadius: "6px",
136+
overflow: "hidden",
137+
alignItems: "stretch",
138+
}}
139+
>
133140
<button
134141
type="button"
135142
onClick={handleToggle}
@@ -138,7 +145,8 @@ export default function StarButton({ projectId, className, onToggle }) {
138145
aria-pressed={starred}
139146
aria-label={toggleTitle}
140147
style={{
141-
...outlined,
148+
...segment,
149+
borderRight: "1px solid #6c757d",
142150
color: starred ? "#f5c518" : "#c0c0c0",
143151
cursor: currentUserId ? "pointer" : "default",
144152
}}
@@ -154,7 +162,7 @@ export default function StarButton({ projectId, className, onToggle }) {
154162
title={t("stars.viewStargazers")}
155163
aria-label={t("stars.viewStargazers")}
156164
style={{
157-
...outlined,
165+
...segment,
158166
color: "#c0c0c0",
159167
fontWeight: 700,
160168
cursor: "pointer",

0 commit comments

Comments
 (0)