Skip to content

Commit

Permalink
Mvp bug fix (#13)
Browse files Browse the repository at this point in the history
* feat: ux 개선

* feat: chrome에서 button이 사라지던 문제 해결
  • Loading branch information
hin6150 authored May 22, 2024
1 parent 5b86368 commit c0f7e3c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions apps/web/src/components/Search/Search.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const iconContainer = recipe({
true: {
position: 'absolute',
right: 59,
zIndex: 10,
},
},
},
Expand Down
17 changes: 13 additions & 4 deletions apps/web/src/components/Search/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { useEffect, useState } from 'react'
import { useEffect, useRef, useState } from 'react'
import { Icon, Text } from '@vook-client/design-system/src/index'

import {
Expand Down Expand Up @@ -69,6 +69,7 @@ const HistoryBar = ({ word, handleSearch }: HistoryBarType) => {
export const SearchBox = () => {
const { query, queryHistory, setQuery, setQueryHistory, setRequestQuery } =
searchStore()
const inputRef = useRef<HTMLInputElement>(null)

const [isFocused, setIsFocused] = useState(false)

Expand Down Expand Up @@ -102,7 +103,7 @@ export const SearchBox = () => {
const word = searchedWord.trim()

if (word === '') {
setQuery(word)
setRequestQuery()
return
}

Expand All @@ -125,18 +126,23 @@ export const SearchBox = () => {

return (
<div
role="presentation"
className={searchBoxContainer}
onFocus={() => setIsFocused(true)}
onBlur={() => {
setIsFocused(false)
}}
onClick={() => {
inputRef.current?.focus()
}}
>
<div className={searchBar()}>
<div className={iconContainer()}>
<Icon name="symbol" />
</div>
<div className={inputContainer}>
<input
ref={inputRef}
className={inputBox()}
placeholder="어떤 용어가 궁금하신가요?"
value={query}
Expand All @@ -152,8 +158,10 @@ export const SearchBox = () => {
<div
role="presentation"
className={iconContainer({ click: true, absoulte: true })}
onClick={() => {
onClick={(e) => {
e.stopPropagation()
setQuery('')
setRequestQuery()
}}
>
<Icon name="close-circle" />
Expand All @@ -162,7 +170,8 @@ export const SearchBox = () => {
<div
role="presentation"
className={iconContainer({ click: true })}
onClick={() => {
onClick={(e) => {
e.stopPropagation()
handleSearch()
}}
>
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Button } from '@vook-client/design-system'

import { Logo } from '../common'

import { chromeOnly, header, headerContainer, inner } from './Layout.css'
import { displayNone, header, headerContainer, inner } from './Layout.css'

export const Header = () => {
const [isChrome, setIsChrome] = useState(false)
Expand All @@ -20,7 +20,7 @@ export const Header = () => {
<div className={inner}>
<div className={headerContainer}>
<Logo />
<div id="chrome-only-element" className={isChrome ? chromeOnly : ''}>
<div id="chrome-only-element" className={isChrome ? '' : displayNone}>
<Button size="small">Download</Button>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/layout/Layout.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const inner = style({
height: '100%',
})

export const chromeOnly = style({
export const displayNone = style({
display: 'none',
})

Expand Down
1 change: 0 additions & 1 deletion packages/design-system/src/components/Text/Text.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export const text = recipe({
display: 'inline',
letterSpacing: '0.01em',
whiteSpace: 'pre-wrap',
margin: 0,
},
variants: {
type: {
Expand Down

0 comments on commit c0f7e3c

Please sign in to comment.