Skip to content

Commit 03d9aaf

Browse files
committed
Improves the way the custom answer looks and behaves
1 parent 34fe945 commit 03d9aaf

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

apps/webapp/app/components/onboarding/TechnologyPicker.tsx

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import * as Ariakit from "@ariakit/react";
2-
import { XMarkIcon, PlusIcon, MagnifyingGlassIcon } from "@heroicons/react/20/solid";
2+
import { XMarkIcon, PlusIcon, CubeIcon, MagnifyingGlassIcon } from "@heroicons/react/20/solid";
33
import { useCallback, useMemo, useRef, useState } from "react";
44
import { cn } from "~/utils/cn";
55
import { matchSorter } from "match-sorter";
6+
import { ShortcutKey } from "~/components/primitives/ShortcutKey";
67

78
const pillColors = [
89
"bg-green-800/40 border-green-600/50",
@@ -205,10 +206,10 @@ export function TechnologyPicker({
205206
virtualFocus
206207
>
207208
<Ariakit.Select
208-
className="flex h-9 w-full items-center rounded border border-charcoal-650 bg-charcoal-750 px-3 text-sm text-text-dimmed focus-custom hover:border-charcoal-600"
209+
className="flex h-8 w-full items-center rounded bg-charcoal-750 pl-2 pr-3 text-sm text-text-dimmed ring-charcoal-600 transition focus-custom hover:bg-charcoal-650 hover:ring-1"
209210
onClick={() => setOpen(true)}
210211
>
211-
<MagnifyingGlassIcon className="mr-2 size-4 flex-none text-text-dimmed" />
212+
<CubeIcon className="mr-1.5 size-4 flex-none text-text-dimmed" />
212213
<span>Select your technologies…</span>
213214
</Ariakit.Select>
214215

@@ -222,7 +223,8 @@ export function TechnologyPicker({
222223
"max-h-[min(400px,var(--popover-available-height))]"
223224
)}
224225
>
225-
<div className="flex h-9 w-full flex-none items-center border-b border-grid-dimmed bg-transparent px-3 text-xs text-text-dimmed outline-none">
226+
<div className="flex h-9 w-full flex-none items-center gap-2 border-b border-grid-dimmed bg-transparent px-3 text-xs text-text-dimmed outline-none">
227+
<MagnifyingGlassIcon className="size-3.5 flex-none text-text-dimmed" />
226228
<Ariakit.Combobox
227229
autoSelect
228230
placeholder="Search technologies…"
@@ -240,7 +242,7 @@ export function TechnologyPicker({
240242
toggleOption(option);
241243
}}
242244
>
243-
<div className="flex h-8 w-full items-center gap-2 rounded-sm px-2 hover:bg-tertiary group-data-[active-item=true]:bg-tertiary">
245+
<div className="flex h-8 w-full items-center gap-2 rounded-sm px-2 group-data-[active-item=true]:bg-tertiary hover:bg-tertiary">
244246
<div
245247
className={cn(
246248
"flex size-4 flex-none items-center justify-center rounded border",
@@ -277,33 +279,42 @@ export function TechnologyPicker({
277279
)}
278280
</Ariakit.ComboboxList>
279281

280-
<div className="sticky bottom-0 border-t border-charcoal-700 bg-background-bright">
282+
<div className="sticky bottom-0 border-t border-charcoal-700 bg-background-bright px-1 py-1">
281283
{showOtherInput ? (
282-
<div className="flex items-center px-3 py-2">
284+
<div className="flex h-8 w-full items-center rounded-sm bg-tertiary px-2 ring-1 ring-charcoal-650">
283285
<input
284286
ref={otherInputRef}
285287
type="text"
286288
value={otherInputValue}
287289
onChange={(e) => setOtherInputValue(e.target.value)}
288290
onKeyDown={handleOtherKeyDown}
289291
placeholder="Type and press Enter to add"
290-
className="flex-1 bg-transparent text-xs text-text-bright outline-none placeholder:text-text-dimmed"
292+
className="flex-1 border-none bg-transparent pl-0.5 text-2sm text-text-bright shadow-none outline-none ring-0 placeholder:text-text-dimmed focus:border-none focus:outline-none focus:ring-0"
291293
autoFocus
292294
/>
295+
<ShortcutKey
296+
shortcut={{ key: "Enter" }}
297+
variant="small"
298+
className={cn(
299+
"mr-1.5 transition-opacity duration-150",
300+
otherInputValue.length > 0 ? "opacity-100" : "opacity-0"
301+
)}
302+
/>
293303
<button
294304
type="button"
295305
onClick={() => {
296-
addCustomValue();
306+
setOtherInputValue("");
307+
setShowOtherInput(false);
297308
}}
298-
className="ml-2 text-xs text-indigo-400 hover:text-indigo-300"
309+
className="flex items-center text-text-dimmed hover:text-text-bright"
299310
>
300-
Add
311+
<XMarkIcon className="size-4" />
301312
</button>
302313
</div>
303314
) : (
304315
<button
305316
type="button"
306-
className="group flex h-8 w-full cursor-pointer items-center gap-2 px-3 text-2sm text-text-dimmed hover:bg-tertiary"
317+
className="flex h-8 w-full cursor-pointer items-center gap-2 rounded-sm px-2 text-2sm text-text-dimmed hover:bg-tertiary"
307318
onClick={() => {
308319
setShowOtherInput(true);
309320
setTimeout(() => otherInputRef.current?.focus(), 0);

0 commit comments

Comments
 (0)