Skip to content

Commit

Permalink
don't show cmd k on phones (#2707)
Browse files Browse the repository at this point in the history
closes #2701
  • Loading branch information
cor authored Aug 9, 2024
2 parents 079965d + 8ca84a3 commit ea2e817
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 27 deletions.
57 changes: 32 additions & 25 deletions app/src/lib/components/search/search-bar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,55 @@
import { cn } from "$lib/utilities/shadcn"
import SearchIcon from "virtual:icons/lucide/search"
import { Input } from "$lib/components/ui/input/index.ts"
import { Button } from "$lib/components/ui/button"
export let searchInput = ""
export let onInputClick: ((event: MouseEvent) => void) | undefined = undefined
export let onInputChange: ((event: InputEvent) => void) | undefined = undefined
export let windowWidth = window.innerWidth
</script>

<div class="relative mr-auto flex-1 w-full max-w-full antialiased">
<SearchIcon class="absolute left-2.5 top-2.5 size-5 text-muted-foreground" />
<Input
type="text"
tabindex={-1}
name="search"
readonly={true}
autocorrect="off"
inputmode="search"
autocomplete="off"
spellcheck="false"
autocapitalize="off"
on:click={onInputClick}
on:input={onInputChange}
bind:value={searchInput}
pattern="[A-Za-z0-9\-]+"
placeholder={(windowWidth >= 930 || windowWidth <= 768) && windowWidth > 538
<div class="flex justify-end">
<Button size="icon" variant="outline" class="sm:hidden" on:click={onInputClick}>
<SearchIcon class="size-5 text-muted-foreground"/>
</Button>
<div class="hidden sm:flex relative mr-auto flex-1 w-full max-w-full antialiased">
<SearchIcon class="absolute left-2.5 top-2.5 size-5 text-muted-foreground"/>
<Input
type="text"
tabindex={-1}
name="search"
readonly={true}
autocorrect="off"
inputmode="search"
autocomplete="off"
spellcheck="false"
autocapitalize="off"
on:click={onInputClick}
on:input={onInputChange}
bind:value={searchInput}
pattern="[A-Za-z0-9\-]+"
placeholder={(windowWidth >= 930 || windowWidth <= 768) && windowWidth > 538
? 'Search for address or tx hash...'
: 'Search...'}
class={cn(
class={cn(
'h-10 cursor-pointer',
'dark:hover:bg-muted hover:bg-secondary',
'shadow-sm transition-colors placeholder:text-muted-foreground',
'w-full bg-background pl-8 self-stretch lowercase border-[1px] border-input',
'focus-visible:border-secondary focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
)}
/>
<kbd
class={cn(
/>
<kbd
class={cn(
'h-7 gap-0.5 px-1.5',
'text-white dark:text-black',
'absolute select-none pointer-events-none',
'right-1.5 top-1.5 inline-flex items-center border bg-primary font-mono text-xs font-medium opacity-100',
'right-1.5 top-1.5 items-center border bg-primary font-mono text-xs font-medium opacity-100 hidden md:inline-flex',
)}
>
<span class="text-sm mb-1"><span class="text-lg mr-0.25">⌘</span>K</span>
</kbd>
>
<span class="text-sm mb-1"><span class="text-lg mr-0.25">⌘</span>K</span>
</kbd>
</div>
</div>

5 changes: 3 additions & 2 deletions dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ Cosmoverse
Counterparties
Counterparty
Cpath
Cryptopunks
Csvg
Cryptopunkssvg
Cypherpunk
DATADIR
DYLD
Expand Down Expand Up @@ -660,6 +659,8 @@ keccak
keepertest
keplr
keybase
keyboardconnect
keyboarddisconnect
keyframes
keygen
keyof
Expand Down

0 comments on commit ea2e817

Please sign in to comment.