Merge branch 'fix/ui-fixes-2' into 'release'

Misc UI Fixes

See merge request theappsmith/internal-tools-client!268
This commit is contained in:
Nikhil Nandagopal 2020-01-28 11:53:16 +00:00
commit 75edd7c85d
11 changed files with 81 additions and 86 deletions

View File

@ -79,6 +79,7 @@ export interface TextInputProps extends IInputGroupProps {
className?: string; className?: string;
type?: string; type?: string;
refHandler?: (ref: HTMLInputElement | null) => void; refHandler?: (ref: HTMLInputElement | null) => void;
noValidate?: boolean;
} }
interface TextInputState { interface TextInputState {

View File

@ -24,9 +24,11 @@ class DatePickerComponent extends React.Component<DatePickerComponentProps> {
render() { render() {
return ( return (
<StyledControlGroup fill> <StyledControlGroup fill>
<Label className={Classes.TEXT_OVERFLOW_ELLIPSIS}> {this.props.label && (
{this.props.label} <Label className={Classes.TEXT_OVERFLOW_ELLIPSIS}>
</Label> {this.props.label}
</Label>
)}
{this.props.datePickerType === "DATE_PICKER" ? ( {this.props.datePickerType === "DATE_PICKER" ? (
<DateInput <DateInput
className={this.props.isLoading ? "bp3-skeleton" : ""} className={this.props.isLoading ? "bp3-skeleton" : ""}

View File

@ -29,6 +29,7 @@ const StyledSingleDropDown = styled(SingleDropDown)`
width: 100%; width: 100%;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
${labelStyle}
} }
.bp3-button-text { .bp3-button-text {
text-overflow: ellipsis; text-overflow: ellipsis;
@ -72,9 +73,11 @@ class DropDownComponent extends React.Component<DropDownComponentProps> {
return ( return (
<DropdownContainer> <DropdownContainer>
<StyledControlGroup fill> <StyledControlGroup fill>
<Label className={Classes.TEXT_OVERFLOW_ELLIPSIS}> {this.props.label && (
{this.props.label} <Label className={Classes.TEXT_OVERFLOW_ELLIPSIS}>
</Label> {this.props.label}
</Label>
)}
{this.props.selectionType === "SINGLE_SELECT" ? ( {this.props.selectionType === "SINGLE_SELECT" ? (
<StyledSingleDropDown <StyledSingleDropDown
className={this.props.isLoading ? "bp3-skeleton" : ""} className={this.props.isLoading ? "bp3-skeleton" : ""}
@ -89,7 +92,7 @@ class DropDownComponent extends React.Component<DropDownComponentProps> {
text={ text={
!_.isEmpty(this.props.options) !_.isEmpty(this.props.options)
? this.props.options[this.props.selectedIndex].label ? this.props.options[this.props.selectedIndex].label
: "Add options" : "-- Empty --"
} }
/> />
</StyledSingleDropDown> </StyledSingleDropDown>

View File

@ -104,11 +104,13 @@ class InputComponent extends React.Component<
render() { render() {
return ( return (
<InputComponentWrapper fill> <InputComponentWrapper fill>
<Label className={Classes.TEXT_OVERFLOW_ELLIPSIS}> {this.props.label && (
<span className={this.props.isLoading ? "bp3-skeleton" : ""}> <Label className={Classes.TEXT_OVERFLOW_ELLIPSIS}>
{this.props.label} <span className={this.props.isLoading ? "bp3-skeleton" : ""}>
</span> {this.props.label}
</Label> </span>
</Label>
)}
{this.isNumberInputType(this.props.inputType) ? ( {this.isNumberInputType(this.props.inputType) ? (
<NumericInput <NumericInput

View File

@ -30,9 +30,11 @@ class RadioGroupComponent extends React.Component<RadioGroupComponentProps> {
render() { render() {
return ( return (
<StyledControlGroup fill> <StyledControlGroup fill>
<Label className={Classes.TEXT_OVERFLOW_ELLIPSIS}> {this.props.label && (
{this.props.label} <Label className={Classes.TEXT_OVERFLOW_ELLIPSIS}>
</Label> {this.props.label}
</Label>
)}
<StyledRadioGroup <StyledRadioGroup
selectedValue={this.props.selectedOptionValue} selectedValue={this.props.selectedOptionValue}
onChange={this.onRadioSelectionChange} onChange={this.onRadioSelectionChange}

View File

@ -33,7 +33,7 @@ export const StyledText = styled(Text)<{ scroll: boolean }>`
display: flex; display: flex;
width: 100%; width: 100%;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: ${props => (props.scroll ? "flex-start" : "center")};
&.bp3-heading { &.bp3-heading {
font-weight: ${props => props.theme.fontWeights[3]}; font-weight: ${props => props.theme.fontWeights[3]};
font-size: ${props => props.theme.fontSizes[4]}px; font-size: ${props => props.theme.fontSizes[4]}px;

View File

@ -58,15 +58,6 @@ const ClickCaptureMask = styled.div`
z-index: 2; z-index: 2;
`; `;
const DragHandle = styled.div`
position: absolute;
left: 0px;
top: -${props => props.theme.fontSizes[CONTROL_THEME_FONTSIZE_INDEX]}px;
cursor: move;
display: none;
cursor: grab;
`;
const DeleteControl = styled.div` const DeleteControl = styled.div`
position: absolute; position: absolute;
right: ${props => props.theme.fontSizes[CONTROL_THEME_FONTSIZE_INDEX]}px; right: ${props => props.theme.fontSizes[CONTROL_THEME_FONTSIZE_INDEX]}px;
@ -85,11 +76,6 @@ const EditControl = styled.div`
const CONTROL_ICON_SIZE = 20; const CONTROL_ICON_SIZE = 20;
const moveControlIcon = ControlIcons.MOVE_CONTROL({
width: CONTROL_ICON_SIZE,
height: CONTROL_ICON_SIZE,
});
const deleteControlIcon = ControlIcons.DELETE_CONTROL({ const deleteControlIcon = ControlIcons.DELETE_CONTROL({
width: CONTROL_ICON_SIZE, width: CONTROL_ICON_SIZE,
height: CONTROL_ICON_SIZE, height: CONTROL_ICON_SIZE,

View File

@ -94,10 +94,23 @@ const TagInputComponent = (props: TagInputProps) => {
} }
}; };
const handleInputBlur = (e: any) => {
if (e.target.value.trim()) {
const newValues = [...values, e.target.value];
commitValues(newValues);
setCurrentValue("");
e.preventDefault();
}
};
return ( return (
<TagInputWrapper intent={props.intent}> <TagInputWrapper intent={props.intent}>
<TagInput <TagInput
inputProps={{ type: props.type, value: currentValue }} inputProps={{
type: props.type,
value: currentValue,
onBlur: handleInputBlur,
}}
onInputChange={handleInputChange} onInputChange={handleInputChange}
placeholder={props.placeholder} placeholder={props.placeholder}
values={_values || [""]} values={_values || [""]}

View File

@ -18,6 +18,7 @@ class TextField extends React.Component<
type={this.props.type || "text"} type={this.props.type || "text"}
component={BaseTextInput} component={BaseTextInput}
{...this.props} {...this.props}
noValidate
/> />
); );
} }

View File

@ -4,28 +4,10 @@ import Form from "components/editorComponents/Form";
import { Card } from "@blueprintjs/core"; import { Card } from "@blueprintjs/core";
export const AuthContainer = styled.section` export const AuthContainer = styled.section`
width: 100vw; position: absolute;
width: 100%;
height: 100vh; height: 100vh;
&& .fade { will-change: transform, opacity;
position: relative;
}
&& .fade-enter {
opacity: 0;
z-index: 1;
}
&& .fade-enter.fade-enter-active {
opacity: 1;
transition: opacity 250ms ease-in;
}
.fade-exit {
opacity: 1;
}
.fade-exit-active {
display: none;
opacity: 0;
transition: opacity 250ms;
}
`; `;
export const AuthCard = styled(Card)` export const AuthCard = styled(Card)`
@ -34,7 +16,6 @@ export const AuthCard = styled(Card)`
border-radius: ${props => props.theme.authCard.borderRadius}px; border-radius: ${props => props.theme.authCard.borderRadius}px;
padding: ${props => props.theme.authCard.padding}px; padding: ${props => props.theme.authCard.padding}px;
box-shadow: ${props => props.theme.authCard.shadow}; box-shadow: ${props => props.theme.authCard.shadow};
position: relative;
border: none; border: none;
& h1, & h1,
h5 { h5 {

View File

@ -1,49 +1,53 @@
import React from "react"; import React from "react";
import { Switch, Route, useRouteMatch, useLocation } from "react-router-dom"; import { Switch, Route, useRouteMatch, useLocation } from "react-router-dom";
import { TransitionGroup, CSSTransition } from "react-transition-group";
import Login from "./Login"; import Login from "./Login";
import Centered from "components/designSystems/appsmith/CenteredWrapper"; import Centered from "components/designSystems/appsmith/CenteredWrapper";
import { animated, useTransition } from "react-spring";
import { AuthContainer, AuthCard } from "./StyledComponents"; import { AuthContainer, AuthCard } from "./StyledComponents";
import SignUp from "./SignUp"; import SignUp from "./SignUp";
import ForgotPassword from "./ForgotPassword"; import ForgotPassword from "./ForgotPassword";
import ResetPassword from "./ResetPassword"; import ResetPassword from "./ResetPassword";
import CreatePassword from "./CreatePassword"; import CreatePassword from "./CreatePassword";
const AnimatedAuthCard = animated(AuthContainer);
export const UserAuth = () => { export const UserAuth = () => {
const { path } = useRouteMatch(); const { path } = useRouteMatch();
const location = useLocation(); const location = useLocation();
return ( const transitions = useTransition(location, location => location.pathname, {
<AuthContainer> from: { opacity: 0, transform: "translate3d(50%,0,0)" },
<Centered> enter: { opacity: 1, transform: "translate3d(0%,0,0)" },
<AuthCard> leave: { opacity: 0, transform: "translate3d(-50%,0,0)" },
<TransitionGroup> reset: true,
<CSSTransition key={location.key} classNames="fade" timeout={300}> });
<Switch location={location}> const renderTransitions = transitions.map(
<Route exact path={`${path}/login`} component={Login} /> ({ item: location, props, key }) => (
<Route exact path={`${path}/signup`} component={SignUp} /> <AnimatedAuthCard key={key} style={props}>
<Route <Centered>
exact <AuthCard>
path={`${path}/resetPassword`} <Switch location={location}>
component={ResetPassword} <Route exact path={`${path}/login`} component={Login} />
/> <Route exact path={`${path}/signup`} component={SignUp} />
<Route <Route
exact exact
path={`${path}/forgotPassword`} path={`${path}/resetPassword`}
component={ForgotPassword} component={ResetPassword}
/> />
<Route <Route
exact exact
path={`${path}/createPassword`} path={`${path}/forgotPassword`}
component={CreatePassword} component={ForgotPassword}
/> />
</Switch> <Route
</CSSTransition> exact
</TransitionGroup> path={`${path}/createPassword`}
</AuthCard> component={CreatePassword}
</Centered> />
</AuthContainer> </Switch>
</AuthCard>
</Centered>
</AnimatedAuthCard>
),
); );
return <React.Fragment>{renderTransitions}</React.Fragment>;
}; };
export default UserAuth; export default UserAuth;