done expanding search
This commit is contained in:
@@ -1,9 +1,13 @@
|
|||||||
import React from "react";
|
import React, { useState } from "react";
|
||||||
import searchBarStyle from "./styles.module.css";
|
import searchBarStyle from "./styles.module.css";
|
||||||
|
|
||||||
const SearchBar = () => {
|
const SearchBar = () => {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form className={searchBarStyle.searchBarContainer}>
|
<form
|
||||||
|
className={`${searchBarStyle.searchBarContainer} ${open ? searchBarStyle.open : ""}`}
|
||||||
|
>
|
||||||
<input
|
<input
|
||||||
className={searchBarStyle.input}
|
className={searchBarStyle.input}
|
||||||
type="text"
|
type="text"
|
||||||
@@ -11,7 +15,10 @@ const SearchBar = () => {
|
|||||||
id=""
|
id=""
|
||||||
placeholder="Search"
|
placeholder="Search"
|
||||||
/>
|
/>
|
||||||
<div className={searchBarStyle.icon}>
|
<div
|
||||||
|
className={searchBarStyle.searchBtn}
|
||||||
|
onClick={() => setOpen((open) => !open)}
|
||||||
|
>
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width={24}
|
width={24}
|
||||||
@@ -21,7 +28,7 @@ const SearchBar = () => {
|
|||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
d="M19.5527 19.5536L14.7064 14.7074M9.16822 16.7847C13.3741 16.7847 16.7837 13.3751 16.7837 9.1692C16.7837 4.96328 13.3741 1.55371 9.16822 1.55371C4.9623 1.55371 1.55273 4.96328 1.55273 9.1692C1.55273 13.3751 4.9623 16.7847 9.16822 16.7847Z"
|
d="M19.5527 19.5536L14.7064 14.7074M9.16822 16.7847C13.3741 16.7847 16.7837 13.3751 16.7837 9.1692C16.7837 4.96328 13.3741 1.55371 9.16822 1.55371C4.9623 1.55371 1.55273 4.96328 1.55273 9.1692C1.55273 13.3751 4.9623 16.7847 9.16822 16.7847Z"
|
||||||
stroke="#858699"
|
stroke="currentColor"
|
||||||
strokeWidth={1.5}
|
strokeWidth={1.5}
|
||||||
strokeLinecap="round"
|
strokeLinecap="round"
|
||||||
strokeLinejoin="round"
|
strokeLinejoin="round"
|
||||||
|
|||||||
@@ -1,21 +1,36 @@
|
|||||||
.searchBarContainer {
|
.searchBarContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 260px;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 6px 6px 6px 12px;
|
|
||||||
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 40px; /*collapse width*/
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
border: 1px solid #31324a;
|
padding: 6px;
|
||||||
|
height: auto;
|
||||||
border: 1px solid color(display-p3 0.1922 0.1961 0.2824);
|
overflow: hidden;
|
||||||
|
transition: width 0.35s ease;
|
||||||
|
position: absolute;
|
||||||
}
|
}
|
||||||
.searchBarContainer > .input {
|
|
||||||
background-color: red;
|
.searchBarContainer:focus-within {
|
||||||
|
background: #292a36;
|
||||||
|
background: color(display-p3 0.1608 0.1647 0.2078);
|
||||||
|
}
|
||||||
|
/* When the searchbar is opened */
|
||||||
|
.open {
|
||||||
|
width: 260px;
|
||||||
|
padding: 6px 6px 6px 12px;
|
||||||
|
justify-content: space-between;
|
||||||
|
border: 1px solid #31324a;
|
||||||
|
border: 1px solid color(display-p3 0.1922 0.1961 0.2824);
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
.input {
|
||||||
|
background: transparent;
|
||||||
outline: none;
|
outline: none;
|
||||||
border: none;
|
border: none;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
opacity: 0; /*hide input kung collapse*/
|
||||||
|
transition: opacity 0.35s ease;
|
||||||
color: #85869b;
|
color: #85869b;
|
||||||
color: color(display-p3 0.5216 0.5255 0.6);
|
color: color(display-p3 0.5216 0.5255 0.6);
|
||||||
font-family: Inter;
|
font-family: Inter;
|
||||||
@@ -27,6 +42,11 @@
|
|||||||
caret-color: #575bc7;
|
caret-color: #575bc7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.open > .input {
|
||||||
|
opacity: 1; /*show input when open*/
|
||||||
|
transition-delay: 0.1s;
|
||||||
|
}
|
||||||
|
|
||||||
.input::placeholder {
|
.input::placeholder {
|
||||||
color: #85869b;
|
color: #85869b;
|
||||||
color: color(display-p3 0.5216 0.5255 0.6);
|
color: color(display-p3 0.5216 0.5255 0.6);
|
||||||
@@ -39,8 +59,13 @@
|
|||||||
letter-spacing: -0.09px;
|
letter-spacing: -0.09px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.searchBtn {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #858699;
|
||||||
|
}
|
||||||
|
.searchBtn:hover {
|
||||||
|
color: #959aff;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import PrimaryButton from "../buttons/primarybutton/PrimaryButton";
|
|||||||
import EditIcon from "../icons/edit";
|
import EditIcon from "../icons/edit";
|
||||||
import UpdateIcon from "../icons/update";
|
import UpdateIcon from "../icons/update";
|
||||||
import SecondaryButton from "../buttons/secondaryButton/SecondaryButton";
|
import SecondaryButton from "../buttons/secondaryButton/SecondaryButton";
|
||||||
|
import SearchBar from "../searchbar/SearchBar";
|
||||||
|
|
||||||
const TopHeader = (props) => {
|
const TopHeader = (props) => {
|
||||||
const [triggerDropDownMenu, setTriggerDropDownMenu] = useState(false);
|
const [triggerDropDownMenu, setTriggerDropDownMenu] = useState(false);
|
||||||
@@ -51,7 +52,7 @@ const TopHeader = (props) => {
|
|||||||
<div className={styles.actionBar}>
|
<div className={styles.actionBar}>
|
||||||
{props?.requiredButtons.includes("search") && (
|
{props?.requiredButtons.includes("search") && (
|
||||||
<div className={styles.searchBarContainer}>
|
<div className={styles.searchBarContainer}>
|
||||||
<SearchIcon />
|
<SearchBar />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{props?.requiredButtons.includes("env") && (
|
{props?.requiredButtons.includes("env") && (
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
align-self: stretch;
|
align-self: stretch;
|
||||||
background: #21232f;
|
background: #21232f;
|
||||||
transition: all 0.15s;
|
transition: all 0.15s;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
.title {
|
.title {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
Reference in New Issue
Block a user