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

EPMRPP-87043 || Fix inconsistencies in Post issue modal #3620

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const DynamicField = ({
withValidation,
children,
darkView,
modalView,
...rest
}) => {
const fieldChildren = withValidation ? (
Expand All @@ -53,27 +54,27 @@ export const DynamicField = ({
{...fieldCommonProps}
fieldWrapperClassName={cx('field-wrapper')}
containerClassName={cx('form-field-item')}
labelClassName={cx('form-group-label', { 'dark-view': darkView })}
labelClassName={cx('form-group-label', { 'dark-view': darkView, 'modal-view': modalView })}
>
{fieldChildren}
</FormField>
);
};

DynamicField.propTypes = {
field: dynamicFieldShape,
customBlock: PropTypes.object,
customFieldWrapper: PropTypes.func,
withValidation: PropTypes.bool,
children: PropTypes.any,
darkView: PropTypes.bool,
modalView: PropTypes.bool,
};

DynamicField.defaultProps = {
field: {},
customBlock: null,
customFieldWrapper: null,
withValidation: false,
children: null,
darkView: false,
modalView: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
padding-right: 0;
color: $COLOR--dirty-gray;
}

&.modal-view {
font-size: 13px;
font-family: $FONT-REGULAR;
text-align: left;
line-height: 16px;
}

@media (max-width: $SCREEN_XS_MAX) {
width: 100%;
margin-bottom: 8px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export class DynamicFieldsSection extends Component {
defaultOptionValueKey: PropTypes.oneOf([VALUE_ID_KEY, VALUE_NAME_KEY]),
darkView: PropTypes.bool,
children: PropTypes.node,
modalView: PropTypes.bool,
};

static defaultProps = {
Expand All @@ -47,6 +48,7 @@ export class DynamicFieldsSection extends Component {
defaultOptionValueKey: VALUE_NAME_KEY,
darkView: false,
children: null,
modalView: false,
};

getCustomBlockConfig = (field) => {
Expand All @@ -64,6 +66,7 @@ export class DynamicFieldsSection extends Component {
withValidation,
defaultOptionValueKey,
darkView,
modalView,
} = this.props;

return fields.map((field) => {
Expand All @@ -77,6 +80,7 @@ export class DynamicFieldsSection extends Component {
withValidation={withValidation}
customFieldWrapper={customFieldWrapper}
defaultOptionValueKey={defaultOptionValueKey}
modalView={modalView}
darkView={darkView}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ export class ArrayField extends Component {
field: PropTypes.object.isRequired,
defaultOptionValueKey: PropTypes.string.isRequired,
darkView: PropTypes.bool,
modalView: PropTypes.bool,
};

static defaultProps = {
darkView: false,
modalView: false,
};

formatOptions = (values = []) =>
Expand Down Expand Up @@ -56,14 +58,15 @@ export class ArrayField extends Component {
parseTags = (options) => (options && options.map(this.parseValueToString)) || undefined;

render() {
const { field, darkView, ...rest } = this.props;
const { field, darkView, modalView, ...rest } = this.props;

return (
<DynamicField
field={field}
format={this.creatable ? this.formatOptions : this.formatTags}
parse={this.parseTags}
darkView={darkView}
modalView={modalView}
{...rest}
>
<MultipleAutocomplete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,28 @@ export class DateField extends Component {
static propTypes = {
field: PropTypes.object.isRequired,
darkView: PropTypes.bool,
modalView: PropTypes.bool,
};

static defaultProps = {
darkView: false,
modalView: false,
};

parseDateValue = (value) => [(value && moment(value).format(DATE_FORMAT)) || ''];

formatDateValue = (value) => value && value[0];

render() {
const { field, darkView, ...rest } = this.props;
const { field, darkView, modalView, ...rest } = this.props;
return (
<div className={cx('date-field')}>
<DynamicField
field={field}
parse={this.parseDateValue}
format={this.formatDateValue}
darkView={darkView}
modalView={modalView}
{...rest}
>
<DatePicker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Dropdown } from 'componentLibrary/dropdown';
import { InputDropdown } from 'components/inputs/inputDropdown';
import { DynamicField } from '../dynamicField';

export class DropdownField extends Component {
static propTypes = {
field: PropTypes.object.isRequired,
defaultOptionValueKey: PropTypes.string.isRequired,
darkView: PropTypes.bool,
modalView: PropTypes.bool,
};

static defaultProps = {
modalView: false,
};

getInputOptions = (values = []) =>
Expand All @@ -37,16 +43,19 @@ export class DropdownField extends Component {
formatDropdownValue = (value) => value && value[0];

render() {
const { field, darkView, ...rest } = this.props;
const { field, darkView, modalView, ...rest } = this.props;
const DropdownComponent = modalView ? InputDropdown : Dropdown;

return (
<DynamicField
field={field}
parse={this.parseDropdownValue}
format={this.formatDropdownValue}
darkView={darkView}
modalView={modalView}
{...rest}
>
<Dropdown
<DropdownComponent
mobileDisabled
options={this.getInputOptions(field.definedValues)}
customClasses={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,39 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { FieldText } from 'componentLibrary/fieldText';
import { Input } from 'components/inputs/input';
import { DynamicField } from '../dynamicField';

export class TextField extends Component {
static propTypes = {
field: PropTypes.object.isRequired,
darkView: PropTypes.bool,
modalView: PropTypes.bool,
};

static defaultProps = {
darkView: false,
modalView: false,
};

formatInputValue = (value) => value && value[0];

parseInputValue = (value) => (value ? [value] : []);

render() {
const { field, darkView, ...rest } = this.props;
const { field, darkView, modalView, ...rest } = this.props;
const FieldComponent = modalView ? Input : FieldText;

return (
<DynamicField
field={field}
format={this.formatInputValue}
parse={this.parseInputValue}
darkView={darkView}
modalView={modalView}
{...rest}
>
<FieldText defaultWidth={false} className={darkView && 'dark-view'} mobileDisabled />
<FieldComponent defaultWidth={false} className={darkView && 'dark-view'} mobileDisabled />
</DynamicField>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ export class PostIssueModal extends Component {
fields={fields}
defaultOptionValueKey={getDefaultOptionValueKey(pluginName)}
darkView
modalView
/>
) : (
<div className={cx('no-default-properties-message')}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
font-size: 12px;
color: $COLOR--gray-47;
font-family: $FONT-REGULAR;
text-transform: uppercase;
&.dark-view {
color: $COLOR--dirty-gray;
}
Expand Down
Loading