Parcourir la source

Remove material Select dependency

Tatiana Inama il y a 6 ans
Parent
commit
da45c3a268

+ 0 - 2
recipes/src/components/Ingredient/index.tsx

@@ -1,9 +1,7 @@
-import IngredientForm from './Form';
 import IngredientList from './List';
 import ScaleTool from './ScaleTool';
 
 export {
-  IngredientForm as Form,
   IngredientList as List,
   ScaleTool
 };

+ 1 - 26
recipes/src/components/Select/index.tsx

@@ -1,7 +1,5 @@
 import React from 'react';
-import Select, { Option } from '@material/react-select';
 
-import '@material/react-select/dist/select.min.css';
 import './styles.scss';
 
 type CBKSelectProps = {
@@ -15,31 +13,8 @@ type CBKSelectProps = {
   disabled?: boolean,
   onChange: (x: any) => void
 }
-class CBKSelect extends React.Component<CBKSelectProps> {
-  state = {
-    value: this.props.value || ''
-  }
 
-  onChange = (index:number) => this.props.onChange(this.props.options[index])
-
-  render() {
-    return (
-      <Select
-        className='cbk-select'
-        enhanced
-        disabled={this.props.disabled}
-        label={this.props.label}
-        value={this.props.value}
-        onEnhancedChange={this.onChange}
-        options={this.props.options}
-      >
-
-      </Select>
-    )
-  }
-}
-
-export const CBKSelect2: React.FunctionComponent<CBKSelectProps> = (props) => (
+export const CBKSelect: React.FunctionComponent<CBKSelectProps> = (props) => (
   <select defaultValue={props.value || ''} className='cbk-select-2' onChange={props.onChange} placeholder={props.label}>
     <option value='' disabled> {props.label} </option>
     { 

+ 1 - 1
recipes/src/containers/ShoppingCart/View/index.tsx

@@ -8,7 +8,7 @@ import { toast } from "react-toastify";
 import Button from 'components/Button';
 import Dialog from 'components/Dialog';
 import List from 'components/List';
-import { CBKSelect2 as Select } from 'components/Select';
+import { CBKSelect as Select } from 'components/Select';
 
 import shoppingCartActions, { fetchCartActionCreator, saveCartActionCreator } from 'containers/ShoppingCart/actions';