소스 검색

Remove unused TabBar implementation

Tatiana Inama 7 년 전
부모
커밋
a3e2f3b0da
3개의 변경된 파일4개의 추가작업 그리고 96개의 파일을 삭제
  1. 1 6
      recipes/src/components/IngredientForm/index.tsx
  2. 2 89
      recipes/src/components/TabBar/index.tsx
  3. 1 1
      recipes/src/components/TabBar/stories.js

+ 1 - 6
recipes/src/components/IngredientForm/index.tsx

@@ -2,7 +2,7 @@ import React from 'react';
 import Input from 'components/Input';
 import Select from 'components/Select';
 import List, {ListItem, ListItemText} from '@material/react-list';
-import { TabBar } from 'components/TabBar';
+import TabBar from 'components/TabBar';
 
 import IRecipe, { ISubRecipe, IAuthor, IDetails, _recipe, _subRecipe, _ingredient, IIngredient, ISuggestion } from 'types/recipes';
 
@@ -56,11 +56,6 @@ class IngredientForm extends React.Component<IngredientFormProps, { activeGroup:
         {
           components.map((group, groupIdx) => (
             <div key={groupIdx} className='cbk-ingredients-component'>
-              {/* <Input
-                label='group name'
-                value={group.name}
-                onChange={updateField(['ingredients', groupIdx, 'name'])}
-              /> */}
               <div className='cbk-ingredients-component-list'>
                 <div className='cbk-ingredients-component-header'>
                   <div className='cbk-title'>Ingredient Name</div>

+ 2 - 89
recipes/src/components/TabBar/index.tsx

@@ -7,15 +7,6 @@ import classnames from 'classnames';
 import './styles.scss';
 
 type TabBarProps = {
-  tabs: string[]
-  onUpdateTab?: (key: string|number[], newValue: string) => void,
-  onDeleteTab?: (deletedIndex: number) => void,
-  onSelectTab?: (selectedIndex: number) => void,
-  onAddTab?: () => void,
-  activeIndex?: number,
-}
-
-type TabBarPropsII = {
   tabs: string[]
   onUpdateTab: (index: number, newValue: string) => void,
   onDeleteTab: (deletedIndex: number) => void,
@@ -29,7 +20,7 @@ type TabBarState = {
   tabs: string[],
 }
 
-const TabBar = ({tabs, onUpdateTab, onDeleteTab, onSelectTab, onAddTab, activeIndex}: TabBarPropsII) => (
+const TabBar = ({tabs, onUpdateTab, onDeleteTab, onSelectTab, onAddTab, activeIndex}: TabBarProps) => (
   <div className='cbk-tab-bar' role="tablist">
     { tabs.map((tab, index) => (
       <div
@@ -56,82 +47,4 @@ const TabBar = ({tabs, onUpdateTab, onDeleteTab, onSelectTab, onAddTab, activeIn
   </div>
 );
 
-class CBKTabBar extends React.Component<TabBarProps, TabBarState> {
-  constructor(props: TabBarProps) {
-    super(props);
-    this.state = {
-      activeIndex: this.props.activeIndex || 0,
-      tabs: props.tabs
-    };
-  }
-
-  updateTabs = (key: string|number[]) => {
-    return (e: any) => {
-      const newValue = e.currentTarget.value;
-      this.setState({
-        tabs: assocPath(key, newValue, this.state.tabs)
-      });
-      if (this.props.onUpdateTab) {
-        this.props.onUpdateTab(key, newValue);
-      }
-    }
-  }
-
-  deleteTab = (index: number) => {
-    return (e: any) => {
-      this.setState({
-        tabs: remove(index, 1, this.state.tabs)
-      })
-    }
-  }
-
-  clickTab = (activeIndex: number) => (event: any) => {
-    this.setState({
-      activeIndex
-    })
-  } 
-
-  addTab = (e: any) => {
-    this.setState({
-      tabs: this.state.tabs.concat([''])
-    })
-  }
-
-  render () {
-    const { tabs, activeIndex } = this.state;
-
-    return (
-      <div className='cbk-tab-bar' role="tablist">
-        { tabs.map((tab, index) => (
-          <div
-            className={classnames({
-              'cbk-tab': true,
-              'cbk-tab--active': index === activeIndex
-            })}
-            onClick={this.clickTab(index)}>
-            <div className='cbk-tab__content'> 
-              <Input
-                value={tab}
-                label=''
-                onChange={this.updateTabs([index])}
-              />
-            </div>
-            <div className='cbk-tab__actions'>
-              <Button icon='clear' onClick={this.deleteTab(index)}></Button>
-            </div>
-          </div>
-        )) }
-        <div className='cbk-tab cbk-tab-add'>
-          <Button icon='add' onClick={this.addTab}></Button>
-        </div>
-      </div>
-    )
-  }
-}
-
-export {
-  CBKTabBar,
-  TabBar,
-};
-
-export default CBKTabBar;
+export default TabBar;

+ 1 - 1
recipes/src/components/TabBar/stories.js

@@ -12,4 +12,4 @@ const tabs = [
 ]
 
 storiesOf('TabBar', module)
-  .add('eee', () => <TabBar tabs={tabs} onClickText={action('text-click')} onClickTab={action('tab-click')}/>)
+  .add('To be implemented', () => <div></div>)