-
Notifications
You must be signed in to change notification settings - Fork 421
RI-7817: clear search button spacing #5274
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
Merged
+204
−205
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
175 changes: 175 additions & 0 deletions
175
redisinsight/ui/src/components/multi-search/MultiSearch.styles.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,175 @@ | ||
| import { HTMLAttributes } from 'react' | ||
| import styled from 'styled-components' | ||
| import { Theme } from 'uiSrc/components/base/theme/types' | ||
| import { Row } from 'uiSrc/components/base/layout/flex' | ||
| import { TextInput } from 'uiSrc/components/base/inputs' | ||
| import { | ||
| ActionIconButton, | ||
| IconButton, | ||
| } from 'uiSrc/components/base/forms/buttons' | ||
| import GroupBadge from 'uiSrc/components/group-badge' | ||
|
|
||
| interface StyledMultiSearchProps extends HTMLAttributes<HTMLDivElement> { | ||
| $isFocused: boolean | ||
| } | ||
|
|
||
| interface StyledSuggestionProps extends HTMLAttributes<HTMLLIElement> { | ||
| $isFocused?: boolean | ||
| } | ||
|
|
||
| export const StyledMultiSearch = styled(Row)<StyledMultiSearchProps>` | ||
| border: 1px solid | ||
| ${({ theme, $isFocused }: { theme: Theme; $isFocused: boolean }) => | ||
| $isFocused | ||
| ? theme.components.input.states.focused.borderColor | ||
| : theme.components.input.states.normal.borderColor}; | ||
| background-color: ${({ theme }: { theme: Theme }) => | ||
| theme.components.input.states.normal.bgColor}; | ||
| border-radius: 4px; | ||
|
|
||
| position: relative; | ||
| flex: 1; | ||
| height: 100%; | ||
| padding: 5px 6px 5px 0; | ||
| background-repeat: no-repeat; | ||
| background-size: 0 100%; | ||
| transition: | ||
| box-shadow 150ms ease-in, | ||
| background-image 150ms ease-in, | ||
| background-size 150ms ease-in, | ||
| background-color 150ms ease-in; | ||
| ` | ||
| /** | ||
| * Auto-suggestions dropdown container | ||
| * Replaces: .autoSuggestions | ||
| */ | ||
| export const StyledAutoSuggestions = styled.div<React.HTMLAttributes<HTMLDivElement>>` | ||
| background-color: ${({ theme }) => theme.components.select.dropdown.bgColor}; | ||
| border: 1px solid | ||
| ${({ theme }) => theme.components.select.states.disabled.borderColor}; | ||
| position: absolute; | ||
| top: calc(100% + ${({ theme }) => theme.core.space.space025}); | ||
| left: 0; | ||
| width: 100%; | ||
| min-width: calc( | ||
| ${({ theme }) => theme.core.space.space550} * 4 | ||
| ); // 176px instead of hardcoded 180px | ||
|
|
||
| border-radius: ${({ theme }) => theme.core.space.space050}; | ||
| z-index: 1001; | ||
| padding: ${({ theme }) => theme.core.space.space050} 0 0; | ||
| ` | ||
|
|
||
| export const StyledMultiSearchWrapper = styled(Row)< | ||
| React.HTMLAttributes<HTMLDivElement> | ||
| >` | ||
| flex: 1; | ||
| padding-bottom: 0; | ||
| height: 100%; | ||
| min-height: 36px; | ||
| ` | ||
|
|
||
| export const StyledClearHistory = styled.li< | ||
| React.HTMLAttributes<HTMLDivElement> | ||
| >` | ||
| border-top: 1px solid | ||
| ${({ theme }: { theme: Theme }) => theme.semantic.color.border.neutral400}; | ||
| padding: 8px 10px; | ||
| text-align: left; | ||
|
|
||
| display: flex; | ||
| align-items: center; | ||
|
|
||
| cursor: pointer; | ||
| user-select: none; | ||
|
|
||
| &:hover { | ||
| background: ${({ theme }) => | ||
| theme.components.select.dropdown.option.states.highlighted.bgColor}; | ||
| } | ||
| ` | ||
|
|
||
| export const StyledSearchInput = styled(TextInput)` | ||
| flex: 1; | ||
| background-color: transparent; | ||
| max-width: 100%; | ||
| border: none; | ||
| height: 100%; | ||
| padding: 0 6px 0 10px; | ||
| background-image: none; | ||
| ` | ||
|
|
||
| /** | ||
| * Remove button within suggestion item | ||
| * Replaces: .suggestionRemoveBtn | ||
| * Note: Defined before StyledSuggestion so it can be referenced in selectors | ||
| */ | ||
| export const StyledSuggestionRemoveBtn = styled(IconButton)` | ||
| flex-shrink: 0; | ||
| visibility: hidden; | ||
| pointer-events: none; | ||
| ` | ||
|
|
||
| /** | ||
| * Individual suggestion item in the dropdown | ||
| * Replaces: .suggestion | ||
| */ | ||
| export const StyledSuggestion = styled.li<StyledSuggestionProps>` | ||
| display: flex; | ||
| align-items: center; | ||
| text-align: left; | ||
| padding: ${({ theme }) => theme.core.space.space050} | ||
| ${({ theme }) => theme.core.space.space100}; | ||
| cursor: default; | ||
|
|
||
| ${({ $isFocused, theme }) => | ||
| $isFocused && | ||
| `background: ${theme.components.select.dropdown.option.states.highlighted.bgColor};`} | ||
|
|
||
| &:hover { | ||
| background: ${({ theme }) => | ||
| theme.components.select.dropdown.option.states.highlighted.bgColor}; | ||
| } | ||
|
|
||
| /* Show remove button on hover or when focused */ | ||
| &:hover ${StyledSuggestionRemoveBtn} { | ||
| visibility: visible; | ||
| pointer-events: auto; | ||
| } | ||
|
|
||
| ${({ $isFocused }) => | ||
| $isFocused && | ||
| `& ${StyledSuggestionRemoveBtn} { | ||
| visibility: visible; | ||
| pointer-events: auto; | ||
| }`} | ||
| ` | ||
|
|
||
| /** | ||
| * GroupBadge wrapper within suggestion item | ||
| * Replaces: .suggestionOption | ||
| */ | ||
| export const StyledSuggestionOption = styled(GroupBadge)` | ||
| margin-right: ${({ theme }) => theme.core.space.space100}; | ||
| ` | ||
|
|
||
| /** | ||
| * Text content within a suggestion item | ||
| * Replaces: .suggestionText | ||
| */ | ||
| export const StyledSuggestionText = styled.span< | ||
| HTMLAttributes<HTMLSpanElement> | ||
| >` | ||
| text-overflow: ellipsis; | ||
| overflow: hidden; | ||
| white-space: nowrap; | ||
| flex-grow: 1; | ||
| line-height: 1.4; | ||
| ` | ||
| /** | ||
| * Clear/Reset filters button | ||
| * Replaces: .clearButton | ||
| */ | ||
| export const StyledClearButton = styled(ActionIconButton)` | ||
| margin-left: ${({ theme }) => theme.core.space.space050}; | ||
| ` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.