import { useState } from "react"; import styled from "styled-components"; import { Box, Button, Input } from "rimble-ui"; import { colors } from "../../themes"; import { Tabs } from "../layouts"; import { SearchIcon } from "./Icons"; export const StyledTabbedInput = styled(Input)` border-radius: 0 0 4px 4px !important; border: 0 !important; padding: 34px 50px 34px 24px !important; width: 100%; `; export interface TabbedSearchBoxProps { placeholderText?: string; onSearch(value: string): void; } export const TabbedSearchBox: React.FunctionComponent = (props) => { const urlParams = new URLSearchParams(window.location.search); const filter = urlParams.get("filter"); const [search, setSearch] = useState(filter || ""); function onKeyDown(event: any) { if (event.code === "Enter") { props.onSearch(search); } } return ( setSearch(event.target.value)} onKeyDown={(event: any) => onKeyDown(event)} placeholder={props.placeholderText || "Search"} required type="text" value={search} /> props.onSearch(search)} style={{ position: "absolute", top: 10, right: 5, zIndex: 9 }} > ); }; export interface TabbedSearchProps { activeTab: string; tabs: any; } export const TabbedSearch: React.FunctionComponent = (props) => { const [activeTabName, setActiveTabName] = useState(props.activeTab); return ( setActiveTabName(tabName)} /> ); };