PromucFlow_constructor/app/client/src/pages/common/SubHeader.tsx
satbir121 b9154f6ea9
Homepage redesign with themes (#482)
* Updating homepage body color

* WIP: Fixing scrolls and adding anchors

* Removing divider from bottom of the page.

* Adding hover background color to app card

* Changing edit and launch icons.

* Fixing app name paddding in card.

* Fixing workspaces overflow

* Adding right padding to applications view

* Adding share icon to share btn

* Fixing Application card styles.

* Fixing text decoration in button.

* Adding new workspace button

* Fixing new workspace and new app styles.

* Adding icon sizes.

* Fixing Org Name and Org settings menu.

* Application menu working

* Fixing overlay visibility on app card

* Fixing settings page content width.

* Fixing workspace icon

* Changing app card colors.

* Removing debugger

* Adding app icon.

* Fixing the spaces in application card

* Adding storybook-static folder to gitignore.

* Adding other storybook files.

* Adding menu items for app

* Removing cypress selector from text.

* Menu width issue fixed

* Default app icon color added

* Removing hardcoded colors

* Removing hardcoded colors.

* Light Mode on!

* Showing correct icon and color in menu

* Update color working properly.

* Updating appIcon

* Editable text working.

* Adding validator

* Adding edit permissions to menu

* Removing box shadow on app card.

* Fixing context menu fill color

* Fixing Menu hover issues.

* Fixing menu open close hover issues.

* Fixing settings pages

* Changed Workspace to org.

* Fix: State management in EditableText Component (#540)

* Error state height is fixed as per design

* savingState prop condition fixed

* Fixing createnew.

* Fixing saving state for application card.

* Fixed application card editable text error.

* Fixing issue caused during merge.

* Fixing tests in create org.

* Removing commented code.

* Removing unwanted vars.

* Fixing delete duplicate tests.

* Latest color palette.

* Fixing form and table widget.

* Removing switcher from header

* Removing unused files

* Fixing app card context dropdown

* Show overlay fix

* Adding localStorage support to theme.

* Making dark mode the default.

Co-authored-by: Rohit Kumawat <rohit.kumawat@primathon.in>
2020-09-16 17:20:47 +05:30

86 lines
2.1 KiB
TypeScript

import React, { ReactNode } from "react";
import FormDialogComponent from "components/editorComponents/form/FormDialogComponent";
import { ControlGroup } from "@blueprintjs/core";
import styled from "styled-components";
import _, { noop } from "lodash";
import SearchInput, { SearchVariant } from "components/ads/SearchInput";
import Button, { Size } from "components/ads/Button";
const SubHeaderWrapper = styled.div`
width: 100%;
display: flex;
justify-content: space-between;
position: fixed;
padding-top: 30px;
background: ${props => props.theme.colors.homepageBackground};
top: ${props => props.theme.homePage.header}px;
left: 369px;
z-index: 10;
`;
const SearchContainer = styled.div`
flex-grow: 1;
.bp3-control-group {
display: block;
}
&& {
.bp3-input {
width: 40%;
}
}
`;
type SubHeaderProps = {
add?: {
form: ReactNode;
title: string;
formName: string;
isAdding: boolean;
formSubmitIntent: string;
errorAdding?: string;
formSubmitText: string;
onClick: () => void;
};
search?: {
placeholder: string;
debounce?: boolean;
queryFn?: (keyword: string) => void;
};
};
export const ApplicationsSubHeader = (props: SubHeaderProps) => {
const query =
props.search &&
props.search.queryFn &&
_.debounce(props.search.queryFn, 250, { maxWait: 1000 });
const createTrigger = props.add && (
<Button text={props.add.title} size={Size.medium} />
);
return (
<SubHeaderWrapper>
<SearchContainer>
{props.search && (
<ControlGroup>
<SearchInput
cypressSelector={"t--application-search-input"}
placeholder={props.search.placeholder}
variant={SearchVariant.SEAMLESS}
onChange={query || noop}
/>
</ControlGroup>
)}
</SearchContainer>
{props.add && (
<FormDialogComponent
trigger={createTrigger}
Form={props.add.form}
title={props.add.title}
/>
)}
</SubHeaderWrapper>
);
};
export default ApplicationsSubHeader;