improved search bar styling

This commit is contained in:
Kim, Jimin 2021-08-10 08:57:42 +09:00
parent 3841aabcbb
commit 4bd425061b

View file

@ -19,12 +19,6 @@ import PostCard from "../components/PostCard"
const StyledSearch = styled.div` const StyledSearch = styled.div`
text-align: center; text-align: center;
color: ${(props) =>
theming.theme(props.theme.currentTheme, {
light: theming.dark.color1,
dark: theming.dark.color1,
})};
` `
const StyledSearchContainer = styled.div` const StyledSearchContainer = styled.div`
@ -54,11 +48,31 @@ const StyledDateRange = styled(DateRange)`
} }
` `
const StyledInput = styled.input` const StyledSearchBar = styled.input`
width: 100%; width: 100%;
height: 2rem; border-radius: 100px; /* arbitrarily large value */
height: 3rem;
padding: 0 0 0 1rem;
font-size: 1.25rem;
background-color: ${theming.dark.color0}; border: ${(props) =>
theming.theme(props.theme.currentTheme, {
light: "1px solid #ccc",
dark: "1px solid #555",
})};
outline: none;
background-color: ${(props) =>
theming.theme(props.theme.currentTheme, {
light: theming.dark.color1,
dark: theming.dark.backgroundColor1,
})};
color: ${(props) =>
theming.theme(props.theme.currentTheme, {
light: theming.light.color1,
dark: theming.dark.color1,
})};
` `
function isDateInRange( function isDateInRange(
@ -232,18 +246,18 @@ function _Search() {
<StyledSearchControlContainer <StyledSearchControlContainer
onSubmit={(event) => { onSubmit={(event) => {
event.preventDefault() event.preventDefault()
doSearch() if (searchInput) doSearch()
}} }}
> >
<StyledInput <StyledSearchBar
type="text" type="text"
ref={inputRef} ref={inputRef}
value={searchInput} value={searchInput}
placeholder="Search"
onChange={(event) => onChange={(event) =>
setSearchInput(event.target.value) setSearchInput(event.target.value)
} }
/> />
<input type="submit" value="Search"></input>
<br /> <br />
<br /> <br />
<small> <small>