-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
94 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
45 changes: 45 additions & 0 deletions
45
packages/swr-devtools-panel/src/components/SearchInput.tsx
This file contains 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,45 @@ | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
import { SearchIcon } from "./icons/SearchIcon"; | ||
|
||
type Props = { | ||
onChange: (value: string) => void; | ||
value: string; | ||
}; | ||
|
||
export const SearchInput = (props: Props) => ( | ||
<SearchArea> | ||
<SearchIcon /> | ||
<Input | ||
type="text" | ||
value={props.value} | ||
onChange={(e) => props.onChange(e.currentTarget.value)} | ||
aria-label="Search" | ||
placeholder="Input a search query" | ||
/> | ||
</SearchArea> | ||
); | ||
|
||
const SearchArea = styled.label` | ||
top: 0; | ||
position: sticky; | ||
width: 100%; | ||
display: flex; | ||
align-items: center; | ||
gap: 8px; | ||
height: 2rem; | ||
margin: 0; | ||
padding: 0; | ||
border-bottom: solid 1px var(--swr-devtools-border-color); | ||
`; | ||
|
||
const Input = styled.input` | ||
width: 100%; | ||
height: 100%; | ||
background-color: var(--swr-devtools-bg-color); | ||
border: solid 1px var(--swr-devtools-border-color); | ||
border: 0; | ||
margin: 0; | ||
padding: 0; | ||
color: var(--swr-devtools-text-color); | ||
`; |
22 changes: 22 additions & 0 deletions
22
packages/swr-devtools-panel/src/components/icons/SearchIcon.tsx
This file contains 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,22 @@ | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
|
||
export const SearchIcon = () => ( | ||
<IconWrapper> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
x="0px" | ||
y="0px" | ||
width="24" | ||
height="24" | ||
viewBox="0 0 16 16" | ||
style={{ fill: "var(--swr-devtools-text-color)" }} | ||
> | ||
<path d="M 10.5 1 C 8.019531 1 6 3.019531 6 5.5 C 6 6.558594 6.382813 7.523438 7 8.292969 L 2.023438 13.269531 L 2.726563 13.980469 L 7.707031 9 C 8.476563 9.617188 9.441406 10 10.5 10 C 12.980469 10 15 7.980469 15 5.5 C 15 3.019531 12.980469 1 10.5 1 Z M 10.5 2 C 12.4375 2 14 3.5625 14 5.5 C 14 7.4375 12.4375 9 10.5 9 C 8.5625 9 7 7.4375 7 5.5 C 7 3.5625 8.5625 2 10.5 2 Z" /> | ||
</svg> | ||
</IconWrapper> | ||
); | ||
|
||
const IconWrapper = styled.span` | ||
display: inline-block; | ||
`; |
acb9013
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: