Skip to content

Commit

Permalink
cleanup formik WIP #556
Browse files Browse the repository at this point in the history
  • Loading branch information
vbojilova committed Aug 12, 2024
1 parent f620e67 commit 460cd6e
Show file tree
Hide file tree
Showing 75 changed files with 91 additions and 4,713 deletions.
2 changes: 1 addition & 1 deletion app/components/EntityListDownload/OptionListHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import PropTypes from 'prop-types';
import { Box, Text } from 'grommet';
import styled from 'styled-components';

import IndeterminateCheckbox, { STATES } from 'components/forms/IndeterminateCheckbox';
import IndeterminateCheckbox, { STATES } from 'components/formik/IndeterminateCheckbox';
const Checkbox = styled(IndeterminateCheckbox)`
vertical-align: middle;
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import styled from 'styled-components';
import { FormattedMessage, injectIntl } from 'react-intl';

import IndeterminateCheckbox from 'components/forms/IndeterminateCheckbox';
import IndeterminateCheckbox from 'components/formik/IndeterminateCheckbox';
import SelectReset from 'components/SelectReset';
import ButtonFlatIconOnly from 'components/buttons/ButtonFlatIconOnly';
import Icon from 'components/Icon';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { palette } from 'styled-theme';
import { getSortOption } from 'utils/sort';
import appMessage from 'utils/app-message';

import { STATES as CHECKBOX_STATES } from 'components/forms/IndeterminateCheckbox';
import { STATES as CHECKBOX_STATES } from 'components/formik/IndeterminateCheckbox';
import { SORT_ORDER_OPTIONS } from 'containers/App/constants';
import { COLUMN_WIDTHS } from 'themes/config';

Expand Down
4 changes: 2 additions & 2 deletions app/components/EntityListSidebar/editOptionsFactory.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { find, forEach } from 'lodash/collection';
import { STATES as CHECKBOX } from 'components/forms/IndeterminateCheckbox';
import { STATES as CHECKBOX } from 'components/formik/IndeterminateCheckbox';
import { startsWith } from 'utils/string';

import {
Expand All @@ -10,7 +10,7 @@ import {
getEntityParentId,
} from 'utils/entities';
import { qe } from 'utils/quasi-equals';
import { makeTagFilterGroups } from 'utils/forms';
import { makeTagFilterGroups } from 'utils/formik';

export const checkedState = (count, length) => {
if (count === length) {
Expand Down
2 changes: 1 addition & 1 deletion app/components/EntityListSidebar/filterOptionsFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
getEntityParentId,
} from 'utils/entities';
import { qe } from 'utils/quasi-equals';
import { makeTagFilterGroups } from 'utils/forms';
import { makeTagFilterGroups } from 'utils/formik';

import {
optionChecked,
Expand Down
2 changes: 1 addition & 1 deletion app/components/formik/DateControl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { toLower } from 'lodash/string';

// eslint-disable-next-line import/no-unresolved
import { isValid, format, parse, startOfToday, getYear, getMonth } from 'date-fns';
import validateDateFormat from 'components/forms/validators/validate-date-format';
import validateDateFormat from 'components/formik/validators/validate-date-format';
import { DayPicker } from 'react-day-picker';
import { useField, useFormikContext } from "formik";

Expand Down
27 changes: 17 additions & 10 deletions app/components/formik/RadioControl/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Field } from 'react-redux-form/immutable';

import styled from 'styled-components';
import { palette } from 'styled-theme';

const StyledWrapper = styled.span``;

const Option = styled.div`
padding: 0.25em 0;
`;
Expand All @@ -21,20 +23,23 @@ const Label = styled.label`
const LabelInner = styled.span`
padding-left: 5px;
`;

const Input = styled.input`
`;
export class RadioControl extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
render() {
const { model, options, hints } = this.props;
const { options, hints, onChange, name, value } = this.props;
return (
<Field model={model}>
<StyledWrapper>
{
options && options.map((option, i) => (
<Option key={i}>
<Label highlight={option.highlight}>
<input
type="radio"
name={model}
<Input
type='radio'
name={name}
value={option.value}
checked={option.value === value}
onChange={onChange}
/>
<LabelInner>{option.label}</LabelInner>
</Label>
Expand All @@ -54,15 +59,17 @@ export class RadioControl extends React.PureComponent { // eslint-disable-line r
</Hint>
)
}
</Field>
</StyledWrapper>
);
}
}

RadioControl.propTypes = {
model: PropTypes.string.isRequired,
options: PropTypes.array.isRequired,
hints: PropTypes.object,
onChange: PropTypes.func,
name: PropTypes.string,
value: PropTypes.string,
};

export default RadioControl;
export default RadioControl;
124 changes: 0 additions & 124 deletions app/components/forms/AuthForm/index.js

This file was deleted.

8 changes: 0 additions & 8 deletions app/components/forms/ControlCheckbox.js

This file was deleted.

13 changes: 0 additions & 13 deletions app/components/forms/ControlInput.js

This file was deleted.

28 changes: 0 additions & 28 deletions app/components/forms/ControlLink.js

This file was deleted.

11 changes: 0 additions & 11 deletions app/components/forms/ControlSelect.js

This file was deleted.

7 changes: 0 additions & 7 deletions app/components/forms/ControlShort.js

This file was deleted.

15 changes: 0 additions & 15 deletions app/components/forms/ControlTextArea.js

This file was deleted.

8 changes: 0 additions & 8 deletions app/components/forms/ControlTextAreaLarge.js

This file was deleted.

11 changes: 0 additions & 11 deletions app/components/forms/ControlTitle.js

This file was deleted.

8 changes: 0 additions & 8 deletions app/components/forms/ControlTitleText.js

This file was deleted.

Loading

0 comments on commit 460cd6e

Please sign in to comment.