Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added clear for graph search #2607

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions src/components/Universe/GraphSearch/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import styled, { css } from 'styled-components'
import { Flex } from '~/components/common/Flex'
import ClearIcon from '~/components/Icons/ClearIcon'
import { useGraphStore } from '~/stores/useGraphStore'
import { colors } from '~/utils'

Expand All @@ -14,14 +16,23 @@ export const GraphSearch = () => {
type="text"
value={searchQuery}
/>
<InputButton
data-testid="search_action_icon"
onClick={() => {
setSearchQuery('')
}}
>
<>{searchQuery?.trim() ? <ClearIcon /> : null}</>
</InputButton>
</Wrapper>
)
}

const Wrapper = styled.div`
const Wrapper = styled(Flex)`
position: absolute;
top: 20px;
left: 20px;
flex-direction: 'row';
`

const Input = styled.input.attrs(() => ({
Expand Down Expand Up @@ -55,10 +66,6 @@ const Input = styled.input.attrs(() => ({
outline: 1px solid ${colors.primaryBlue};
}

&:hover {
background: ${colors.black};
}

&::placeholder {
color: ${colors.GRAY7};
}
Expand All @@ -73,3 +80,17 @@ const Input = styled.input.attrs(() => ({
background-repeat: no-repeat;
`}
`

const InputButton = styled(Flex).attrs({
align: 'center',
justify: 'center',
p: 5,
})`
font-size: 32px;
color: ${colors.mainBottomIcons};
cursor: pointer;
transition-duration: 0.2s;
margin-left: -42px;
z-index: 2;
width: 30px;
`
Loading