Browse Source

chore(js): Remove old deprecated form stories (#40371)

Evan Purkhiser 2 years ago
parent
commit
f215d2d686

+ 3 - 5
docs-ui/stories/assets/icons/searchPanel.tsx

@@ -2,7 +2,7 @@ import {useCallback, useEffect, useState} from 'react';
 import styled from '@emotion/styled';
 import Fuse from 'fuse.js';
 
-import TextField from 'sentry/components/deprecatedforms/textField';
+import Input from 'sentry/components/input';
 import space from 'sentry/styles/space';
 
 import {IconData, iconGroups, IconPropName, iconProps, icons} from './data';
@@ -105,13 +105,11 @@ function SearchPanel() {
 
   return (
     <Wrap>
-      <TextField
+      <Input
         name="query"
         placeholder="Search icons by name or similar keywords"
         value={query}
-        onChange={value => {
-          setQuery(value as string);
-        }}
+        onChange={e => setQuery(e.target.value)}
       />
 
       {results.map(group => (

+ 0 - 59
docs-ui/stories/components/selectFields.stories.js

@@ -1,59 +0,0 @@
-import {action} from '@storybook/addon-actions';
-
-import {Form as LegacyForm} from 'sentry/components/deprecatedforms';
-import SelectCreatableField from 'sentry/components/deprecatedforms/selectCreatableField';
-import SelectField from 'sentry/components/deprecatedforms/selectField';
-
-export default {
-  title: 'Deprecated/SelectFields',
-};
-
-export const _SelectField = () => (
-  <LegacyForm onSubmit={action('onSubmit')}>
-    <SelectField
-      name="foos"
-      choices={[
-        ['foo', 'Foo'],
-        ['bar', 'Bar'],
-        ['baz', 'Baz'],
-      ]}
-    />
-    <SelectField
-      name="multi_foos"
-      choices={[
-        ['foo', 'Foo'],
-        ['bar', 'Bar'],
-        ['baz', 'Baz'],
-      ]}
-      multiple
-    />
-  </LegacyForm>
-);
-
-_SelectField.storyName = 'SelectField';
-
-export const _SelectCreatableField = () => (
-  <LegacyForm onSubmit={action('onSubmit')}>
-    <SelectCreatableField
-      label="Creatable"
-      name="creatable_foos"
-      choices={[
-        ['foo', 'Foo'],
-        ['bar', 'Bar'],
-        ['baz', 'Baz'],
-      ]}
-    />
-    <SelectCreatableField
-      label="Creatable (and Multiple)"
-      name="creatable_multi_foos"
-      multiple
-      choices={[
-        ['foo', 'Foo'],
-        ['bar', 'Bar'],
-        ['baz', 'Baz'],
-      ]}
-    />
-  </LegacyForm>
-);
-
-_SelectCreatableField.storyName = 'SelectCreatableField';

+ 0 - 26
docs-ui/stories/deprecated/form-old-fields.stories.js

@@ -1,26 +0,0 @@
-import {
-  BooleanField,
-  Form as LegacyForm,
-  PasswordField,
-} from 'sentry/components/deprecatedforms';
-
-export default {
-  title: 'Deprecated/Fields',
-};
-
-export const _PasswordField = () => (
-  <LegacyForm>
-    <PasswordField hasSavedValue name="password" label="password" />
-  </LegacyForm>
-);
-
-_PasswordField.storyName = 'PasswordField';
-
-export const _BooleanField = () => (
-  <LegacyForm>
-    <BooleanField name="field" />
-    <BooleanField name="disabled-field" disabled disabledReason="This is off." />
-  </LegacyForm>
-);
-
-_BooleanField.storyName = 'BooleanField';

+ 0 - 70
docs-ui/stories/deprecated/form-old.stories.js

@@ -1,70 +0,0 @@
-import {Component} from 'react';
-import {action} from '@storybook/addon-actions';
-import PropTypes from 'prop-types';
-
-import {
-  Form as LegacyForm,
-  TextField as LegacyTextField,
-} from 'sentry/components/deprecatedforms';
-
-class UndoButton extends Component {
-  handleClick(e) {
-    e.preventDefault();
-    this.context.form.undo();
-  }
-
-  render() {
-    return (
-      <button type="button" onClick={this.handleClick.bind(this)}>
-        Undo
-      </button>
-    );
-  }
-}
-
-UndoButton.contextTypes = {
-  form: PropTypes.object,
-};
-
-export default {
-  title: 'Deprecated/Form',
-};
-
-export const Empty = () => <LegacyForm onSubmit={action('submit')} />;
-
-Empty.storyName = 'empty';
-
-export const WithCancel = () => (
-  <LegacyForm onCancel={action('cancel')} onSubmit={action('submit')} />
-);
-
-WithCancel.storyName = 'with Cancel';
-WithCancel.parameters = {
-  docs: {
-    description: {
-      story: 'Adds a "Cancel" button when `onCancel` is defined',
-    },
-  },
-};
-
-export const SaveOnBlurAndUndo = () => (
-  <LegacyForm saveOnBlur allowUndo>
-    <LegacyTextField
-      name="name"
-      label="Team Name"
-      placeholder="e.g. Operations, Web, Desktop"
-      required
-    />
-    <LegacyTextField name="slug" label="Short name" placeholder="e.g. api-team" />
-    <UndoButton />
-  </LegacyForm>
-);
-
-SaveOnBlurAndUndo.storyName = 'save on blur and undo';
-SaveOnBlurAndUndo.parameters = {
-  docs: {
-    description: {
-      story: 'Saves on blur and has undo',
-    },
-  },
-};