Skip to content

Commit 8d951aa

Browse files
authored
Fix: UI/UX issues on components (#59)
* Fix combobox issues * Change unchecked tab color * Update tab indicator styles for vertical alignment * enhance font smoothing * Add font variation settings for improved typography
2 parents 9ddfc4c + c2beb46 commit 8d951aa

File tree

4 files changed

+30
-14
lines changed

4 files changed

+30
-14
lines changed

packages/frappe-ui-react/src/components/combobox/combobox.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,17 @@ export const Combobox: React.FC<ComboboxProps> = ({
3838
return flat;
3939
}, [options]);
4040

41+
// For filtering/search
42+
const [query, setQuery] = useState("");
43+
4144
const selectedOption = useMemo(() => {
4245
if (!value) return null;
43-
return allOptionsFlat.find((opt) => getValue(opt) === value) ?? null;
44-
}, [value, allOptionsFlat]);
4546

46-
// For filtering/search
47-
const [query, setQuery] = useState("");
47+
const opt = allOptionsFlat.find((opt) => getValue(opt) === value) ?? null;
48+
49+
setQuery(opt ? getLabel(opt) : "");
50+
return opt;
51+
}, [value, allOptionsFlat]);
4852

4953
const filteredOptions = useMemo(() => {
5054
if (!query) return options;
@@ -105,9 +109,9 @@ export const Combobox: React.FC<ComboboxProps> = ({
105109
)}
106110
<ComboboxInput
107111
className={`
108-
w-full border border-surface-gray-2 rounded
112+
w-full bg-surface-gray-2 border border-surface-gray-2 rounded
109113
${selectedOption && getIcon(selectedOption) ? "pl-8" : "pl-2"}
110-
pr-2 py-1 min-h-[25px] text-base bg-surface-white
114+
pr-2 py-1 min-h-[25px] text-base
111115
placeholder-ink-gray-4 text-ink-gray-8
112116
outline-none focus:border-outline-gray-4 focus:ring-2 focus:ring-outline-gray-3
113117
transition-colors
@@ -144,7 +148,7 @@ export const Combobox: React.FC<ComboboxProps> = ({
144148
{filteredOptions.map((opt) =>
145149
typeof opt === "object" && "group" in opt ? (
146150
<div key={opt.group}>
147-
<div className="px-2 py-1 text-xs text-ink-gray-5 font-semibold bg-surface-gray-2">
151+
<div className="p-2 text-xs text-ink-gray-5 font-semibold">
148152
{opt.group}
149153
</div>
150154
{opt.options.map((option) => (
@@ -167,7 +171,7 @@ export const Combobox: React.FC<ComboboxProps> = ({
167171
<span className="flex-1">{getLabel(option)}</span>
168172
{selectedOption &&
169173
getValue(option) === getValue(selectedOption) && (
170-
<span className="ml-2 text-green-600">
174+
<span className="ml-2 text-ink-gray-5">
171175
<svg width="16" height="16" viewBox="0 0 16 16">
172176
<path
173177
d="M4 8l3 3 5-5"
@@ -202,7 +206,7 @@ export const Combobox: React.FC<ComboboxProps> = ({
202206
{selectedOption &&
203207
getValue(opt as SimpleOption) ===
204208
getValue(selectedOption) && (
205-
<span className="ml-2 text-green-600">
209+
<span className="ml-2 text-ink-gray-5">
206210
<svg width="16" height="16" viewBox="0 0 16 16">
207211
<path
208212
d="M4 8l3 3 5-5"

packages/frappe-ui-react/src/components/tabButtons/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const TabButtons = ({
5858
? ""
5959
: checked
6060
? "text-ink-gray-9 shadow"
61-
: "text-ink-gray-7"
61+
: "!text-ink-gray-5"
6262
} cursor-pointer`}
6363
>
6464
{!button.hideLabel && button.label && (

packages/frappe-ui-react/src/components/tabs/tabList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ export const TabList = ({
7676
<div
7777
ref={indicatorRef}
7878
className={[
79-
"tab-indicator absolute bg-surface-gray-7",
80-
vertical ? "right-0 w-px" : "bottom-0 h-px",
79+
"tab-indicator absolute",
80+
vertical ? "right-0 w-px bg-transparent" : "bottom-0 h-px bg-surface-gray-7",
8181
].join(" ")}
8282
/>
8383
</div>

packages/frappe-ui-react/src/theme.css

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
1-
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
1+
@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");
22
@import "tailwindcss";
33

44
@config '../../../tailwind.config.cjs';
55

66
@custom-variant dark (&:is(.dark *));
77

8-
button, label, input {
8+
html,
9+
body,
10+
button,
11+
p,
12+
span,
13+
div {
14+
-webkit-font-smoothing: antialiased;
15+
font-variation-settings: 'opsz';
16+
}
17+
18+
button,
19+
label,
20+
input {
921
@apply cursor-pointer hover:cursor-pointer;
1022
}
1123

0 commit comments

Comments
 (0)