Api pane css fixes.

This commit is contained in:
Satbir Singh 2020-02-12 08:23:50 +00:00
parent 87fd118c91
commit 3feb8a33e7
4 changed files with 51 additions and 20 deletions

View File

@ -1,5 +1,10 @@
import React from "react"; import React from "react";
import { AnchorButton, IButtonProps, MaybeElement } from "@blueprintjs/core"; import {
AnchorButton,
IButtonProps,
MaybeElement,
IconName,
} from "@blueprintjs/core";
import styled, { css } from "styled-components"; import styled, { css } from "styled-components";
import { ButtonStyle } from "widgets/ButtonWidget"; import { ButtonStyle } from "widgets/ButtonWidget";
import { Theme, darkenHover, darkenActive } from "constants/DefaultTheme"; import { Theme, darkenHover, darkenActive } from "constants/DefaultTheme";
@ -114,6 +119,7 @@ interface ButtonContainerProps extends ComponentProps {
disabled?: boolean; disabled?: boolean;
buttonStyle?: ButtonStyle; buttonStyle?: ButtonStyle;
isLoading: boolean; isLoading: boolean;
rightIcon?: IconName | MaybeElement;
} }
const mapButtonStyleToStyleName = (buttonStyle?: ButtonStyle) => { const mapButtonStyleToStyleName = (buttonStyle?: ButtonStyle) => {
@ -135,6 +141,7 @@ const ButtonContainer = (props: ButtonContainerProps & ButtonStyleProps) => {
<BaseButton <BaseButton
className={props.isLoading ? "bp3-skeleton" : ""} className={props.isLoading ? "bp3-skeleton" : ""}
icon={props.icon} icon={props.icon}
rightIcon={props.rightIcon}
text={props.text} text={props.text}
filled={props.buttonStyle !== "SECONDARY_BUTTON"} filled={props.buttonStyle !== "SECONDARY_BUTTON"}
accent={mapButtonStyleToStyleName(props.buttonStyle)} accent={mapButtonStyleToStyleName(props.buttonStyle)}

View File

@ -0,0 +1,11 @@
import styled from "styled-components";
import { Callout } from "@blueprintjs/core";
import { Colors } from "constants/Colors";
const CalloutComponent = styled(Callout)`
&& {
background-color: ${Colors.WHITE_SMOKE};
}
`;
export default CalloutComponent;

View File

@ -1,6 +1,7 @@
// Color Names generated from http://chir.ag/projects/name-that-color // Color Names generated from http://chir.ag/projects/name-that-color
export const Colors: Record<string, string> = { export const Colors: Record<string, string> = {
WHITE: "#FFFFFF", WHITE: "#FFFFFF",
WHITE_SMOKE: "#F4F4F4",
POLAR: "#E9FAF3", POLAR: "#E9FAF3",
GEYSER: "#D3DEE3", GEYSER: "#D3DEE3",
GEYSER_LIGHT: "#D0D7DD", GEYSER_LIGHT: "#D0D7DD",

View File

@ -1,13 +1,11 @@
import React from "react"; import React from "react";
import DynamicTextField from "components/editorComponents/form/fields/DynamicTextField"; import DynamicTextField from "components/editorComponents/form/fields/DynamicTextField";
// import { Button } from "@blueprintjs/core";
import Button from "components/editorComponents/Button";
import styled from "constants/DefaultTheme"; import styled from "constants/DefaultTheme";
import DropdownField from "components/editorComponents/form/fields/DropdownField"; import DropdownField from "components/editorComponents/form/fields/DropdownField";
import FormRow from "components/editorComponents/FormRow"; import FormRow from "components/editorComponents/FormRow";
import { Directions } from "utils/helpers"; import { BaseButton } from "components/designSystems/blueprint/ButtonComponent";
import { Callout } from "@blueprintjs/core"; import CalloutComponent from "components/designSystems/blueprint/CalloutComponent";
interface PaginationProps { interface PaginationProps {
onTestClick: Function; onTestClick: Function;
paginationType: PaginationType; paginationType: PaginationType;
@ -25,6 +23,7 @@ export enum PaginationType {
const ExampleApi = styled.p` const ExampleApi = styled.p`
color: #ef7b63; color: #ef7b63;
font-family: monospace;
`; `;
const StyledLabel = styled.label` const StyledLabel = styled.label`
@ -35,6 +34,22 @@ const StyledLabel = styled.label`
const PaginationTypeView = styled.div` const PaginationTypeView = styled.div`
padding: 0px 6px; padding: 0px 6px;
`; `;
const StyledDynamicTextField = styled(DynamicTextField)`
&&&& {
margin-right: 5px;
}
`;
const TestButton = styled(BaseButton)`
&&& {
max-width: 72px;
margin: 0 5px;
min-height: 32px;
padding-right: 4px;
}
`;
export default function Pagination(props: PaginationProps) { export default function Pagination(props: PaginationProps) {
return ( return (
<React.Fragment> <React.Fragment>
@ -71,30 +86,27 @@ export default function Pagination(props: PaginationProps) {
> >
<StyledLabel>Previous url</StyledLabel> <StyledLabel>Previous url</StyledLabel>
<PaginationFieldWrapper> <PaginationFieldWrapper>
<DynamicTextField name="actionConfiguration.prev" /> <StyledDynamicTextField name="actionConfiguration.prev" />
<Button <TestButton
accent="secondary"
onClick={() => { onClick={() => {
props.onTestClick("PREV"); props.onTestClick("PREV");
}} }}
text={"Test"} text={"Test"}
icon={"play"} rightIcon={"play"}
iconAlignment={Directions.RIGHT} ></TestButton>
filled
></Button>
</PaginationFieldWrapper> </PaginationFieldWrapper>
<StyledLabel>Next url</StyledLabel> <StyledLabel>Next url</StyledLabel>
<PaginationFieldWrapper> <PaginationFieldWrapper>
<DynamicTextField name="actionConfiguration.next" /> <StyledDynamicTextField name="actionConfiguration.next" />
<Button <TestButton
accent="secondary"
onClick={() => { onClick={() => {
props.onTestClick("NEXT"); props.onTestClick("NEXT");
}} }}
text={"Test"} text={"Test"}
icon={"play"} rightIcon={"play"}
iconAlignment={Directions.RIGHT} ></TestButton>
// rightIcon={"play"}
filled
></Button>
</PaginationFieldWrapper> </PaginationFieldWrapper>
</PaginationTypeView> </PaginationTypeView>
<PaginationTypeView <PaginationTypeView
@ -102,7 +114,7 @@ export default function Pagination(props: PaginationProps) {
props.paginationType !== PaginationType.PAGE_NO ? "display-none" : "" props.paginationType !== PaginationType.PAGE_NO ? "display-none" : ""
} }
> >
<Callout> <CalloutComponent>
<p <p
style={{ style={{
marginBottom: "6px", marginBottom: "6px",
@ -114,7 +126,7 @@ export default function Pagination(props: PaginationProps) {
http://api.example.com/users?pageNo={"{{Table.pageNo}}"} http://api.example.com/users?pageNo={"{{Table.pageNo}}"}
&amp;pageSize={"{{Table.pageSize}}"} &amp;pageSize={"{{Table.pageSize}}"}
</ExampleApi> </ExampleApi>
</Callout> </CalloutComponent>
</PaginationTypeView> </PaginationTypeView>
</React.Fragment> </React.Fragment>
); );