Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update UserPicker size and validation #2583

Merged
merged 7 commits into from
Jul 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/img/icons/filled-circle-person.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/modules/core/components/Fields/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const Input = ({
}: Props) => {
const [id] = useState(idProp || nanoid());
const { formatMessage } = useIntl();
const [inputFieldProps, { error }] = useField<string>(name);
const [inputFieldProps, { error, touched }] = useField<string>(name);

const placeholder =
typeof placeholderProp === 'object'
Expand All @@ -122,7 +122,7 @@ const Input = ({
const inputProps: InputComponentProps = {
...inputFieldProps,
appearance,
'aria-invalid': !!error || !!forcedFieldError,
'aria-invalid': (!!error || !!forcedFieldError) && touched,
formattingOptions,
id,
innerRef,
Expand Down Expand Up @@ -167,6 +167,7 @@ const Input = ({
status={status}
statusValues={statusValues}
error={error || forcedFieldError}
touched={touched}
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { defineMessages } from 'react-intl';
import Cleave from 'cleave.js/react';
import { CleaveOptions } from 'cleave.js/options';
import { ChangeEvent } from 'cleave.js/react/props';
import { isNil } from 'lodash';
import isNil from 'lodash/isNil';
import Decimal from 'decimal.js';

import Button from '~core/Button';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { MessageDescriptor, useIntl } from 'react-intl';
import React from 'react';

import { isNil } from 'lodash';
ArmandoGraterol marked this conversation as resolved.
Show resolved Hide resolved
import { SimpleMessageValues } from '~types/index';
import { getMainClasses } from '~utils/css';

Expand All @@ -26,6 +27,7 @@ interface Props {

/** Values for status text (react-intl interpolation) (if applicable) */
statusValues?: SimpleMessageValues;
touched?: boolean;
}

const displayName = 'InputStatus';
Expand All @@ -35,6 +37,7 @@ const InputStatus = ({
error,
status,
statusValues,
touched,
}: Props) => {
const { formatMessage } = useIntl();
const errorText = typeof error === 'object' ? formatMessage(error) : error;
Expand All @@ -46,7 +49,7 @@ const InputStatus = ({
<Element
className={getMainClasses(appearance, styles, {
error: !!error,
hidden: !text,
hidden: !text || (!!error && !isNil(touched) && !touched),
})}
>
{text}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
.baseInput {
flex: 1 1 0;
margin-left: 10px;
padding: 5px 3px;
height: 32px;
width: 100%;
max-width: 305px;
vertical-align: baseline;
Expand Down Expand Up @@ -94,7 +96,6 @@

.input {
composes: baseInput;
padding: 3px;
width: 100%;

&:focus {
Expand All @@ -108,7 +109,6 @@

.recipientName {
composes: baseInput;
padding: 5px 3px;
overflow: hidden;
font-weight: var(--weight-bold);
text-overflow: ellipsis;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,11 @@ const CreatePaymentDialog = ({

const validationSchema = yup.object().shape({
domainId: yup.number().required(),
recipient: yup
.object()
.shape({
profile: yup.object().shape({
walletAddress: yup.string().address().required(),
}),
})
.nullable()
.default(null),
recipient: yup.object().shape({
profile: yup.object().shape({
walletAddress: yup.string().address().required(),
}),
}),
amount: yup
.number()
.required()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,11 @@ import styles from './PermissionManagementDialog.css';

const validationSchema = yup.object().shape({
domainId: yup.number().required(),
user: yup
.object()
.shape({
profile: yup.object().shape({
walletAddress: yup.string().address().required(),
}),
})
.nullable()
.default(null),
user: yup.object().shape({
profile: yup.object().shape({
walletAddress: yup.string().address().required(),
}),
}),
roles: yup.array().ensure(),
annotation: yup.string().max(4000),
forceAction: yup.boolean(),
Expand Down