From 6ab207372a44f6e4eef06da0e0b3e0932a7eb8c6 Mon Sep 17 00:00:00 2001 From: Jacob Blomgren Date: Tue, 15 Jan 2019 14:20:49 +0100 Subject: [PATCH] fix: group together related components to same folders (#500) Everything table related goes into src/table, etc: table-cell --> table/table-cell tbody --> table/tbody td --> table/td tfoot --> table/tfoot th --> table/th thead --> table/thead tr --> table/tr tab --> tabs/tab tabpanel --> tabs/tabpanel --- src/components/table/index.js | 8 +++++++- src/components/{ => table}/table-cell/index.js | 0 .../{ => table}/table-cell/table-cell-styles.jsx | 2 +- src/components/{ => table}/table-cell/table-cell.jsx | 0 src/components/{ => table}/tbody/index.js | 0 src/components/{ => table}/tbody/tbody-styles.jsx | 2 +- src/components/{ => table}/tbody/tbody.jsx | 0 src/components/{ => table}/td/index.js | 0 src/components/{ => table}/td/td.jsx | 0 src/components/{ => table}/tfoot/index.js | 0 src/components/{ => table}/tfoot/tfoot-styles.jsx | 2 +- src/components/{ => table}/tfoot/tfoot.jsx | 0 src/components/{ => table}/th/index.js | 0 src/components/{ => table}/th/th.jsx | 0 src/components/{ => table}/thead/index.js | 0 src/components/{ => table}/thead/thead-styles.jsx | 2 +- src/components/{ => table}/thead/thead.jsx | 0 src/components/{ => table}/tr/index.js | 0 src/components/{ => table}/tr/tr-styles.jsx | 4 ++-- src/components/{ => table}/tr/tr.jsx | 2 +- src/components/tabs/index.js | 4 +++- src/components/{ => tabs}/tab/index.js | 0 src/components/{ => tabs}/tab/tab-styles.jsx | 0 src/components/{ => tabs}/tab/tab.jsx | 0 src/components/{ => tabs}/tabpanel/index.js | 0 .../{ => tabs}/tabpanel/tabpanel-styles.jsx | 0 src/components/{ => tabs}/tabpanel/tabpanel.jsx | 0 src/index.js | 12 ++---------- .../smart-table-content/smart-table-content.test.js | 2 +- .../smart-table-content/table-head.test.js | 4 ++-- .../table/{table-cell => }/table-cell.test.js | 4 ++-- test/components/{tab => tabs}/tab.test.js | 2 +- test/components/{tabpanel => tabs}/tabpanel.test.js | 2 +- test/components/tabs/tabs.test.js | 4 ++-- 34 files changed, 28 insertions(+), 28 deletions(-) rename src/components/{ => table}/table-cell/index.js (100%) rename src/components/{ => table}/table-cell/table-cell-styles.jsx (97%) rename src/components/{ => table}/table-cell/table-cell.jsx (100%) rename src/components/{ => table}/tbody/index.js (100%) rename src/components/{ => table}/tbody/tbody-styles.jsx (91%) rename src/components/{ => table}/tbody/tbody.jsx (100%) rename src/components/{ => table}/td/index.js (100%) rename src/components/{ => table}/td/td.jsx (100%) rename src/components/{ => table}/tfoot/index.js (100%) rename src/components/{ => table}/tfoot/tfoot-styles.jsx (86%) rename src/components/{ => table}/tfoot/tfoot.jsx (100%) rename src/components/{ => table}/th/index.js (100%) rename src/components/{ => table}/th/th.jsx (100%) rename src/components/{ => table}/thead/index.js (100%) rename src/components/{ => table}/thead/thead-styles.jsx (96%) rename src/components/{ => table}/thead/thead.jsx (100%) rename src/components/{ => table}/tr/index.js (100%) rename src/components/{ => table}/tr/tr-styles.jsx (91%) rename src/components/{ => table}/tr/tr.jsx (96%) rename src/components/{ => tabs}/tab/index.js (100%) rename src/components/{ => tabs}/tab/tab-styles.jsx (100%) rename src/components/{ => tabs}/tab/tab.jsx (100%) rename src/components/{ => tabs}/tabpanel/index.js (100%) rename src/components/{ => tabs}/tabpanel/tabpanel-styles.jsx (100%) rename src/components/{ => tabs}/tabpanel/tabpanel.jsx (100%) rename test/components/table/{table-cell => }/table-cell.test.js (85%) rename test/components/{tab => tabs}/tab.test.js (99%) rename test/components/{tabpanel => tabs}/tabpanel.test.js (98%) diff --git a/src/components/table/index.js b/src/components/table/index.js index a62247d8..b46d3d8b 100644 --- a/src/components/table/index.js +++ b/src/components/table/index.js @@ -1 +1,7 @@ -export { default } from './table'; +export { default as Table } from './table'; +export { default as Tbody } from './tbody'; +export { default as Td } from './td'; +export { default as Tfoot } from './tfoot'; +export { default as Th } from './th'; +export { default as Thead } from './thead'; +export { default as Tr } from './tr'; diff --git a/src/components/table-cell/index.js b/src/components/table/table-cell/index.js similarity index 100% rename from src/components/table-cell/index.js rename to src/components/table/table-cell/index.js diff --git a/src/components/table-cell/table-cell-styles.jsx b/src/components/table/table-cell/table-cell-styles.jsx similarity index 97% rename from src/components/table-cell/table-cell-styles.jsx rename to src/components/table/table-cell/table-cell-styles.jsx index 29bee2a5..eececd06 100644 --- a/src/components/table-cell/table-cell-styles.jsx +++ b/src/components/table/table-cell/table-cell-styles.jsx @@ -1,4 +1,4 @@ -import styleUtils from '../table/style-utilities'; +import styleUtils from '../style-utilities'; export default theme => { const { palette, typography, mixins, transitions } = theme; diff --git a/src/components/table-cell/table-cell.jsx b/src/components/table/table-cell/table-cell.jsx similarity index 100% rename from src/components/table-cell/table-cell.jsx rename to src/components/table/table-cell/table-cell.jsx diff --git a/src/components/tbody/index.js b/src/components/table/tbody/index.js similarity index 100% rename from src/components/tbody/index.js rename to src/components/table/tbody/index.js diff --git a/src/components/tbody/tbody-styles.jsx b/src/components/table/tbody/tbody-styles.jsx similarity index 91% rename from src/components/tbody/tbody-styles.jsx rename to src/components/table/tbody/tbody-styles.jsx index bf0dfd3f..dec6a605 100644 --- a/src/components/tbody/tbody-styles.jsx +++ b/src/components/table/tbody/tbody-styles.jsx @@ -1,4 +1,4 @@ -import styleUtils from '../table/style-utilities'; +import styleUtils from '../style-utilities'; export default theme => { const { palette, mixins } = theme; diff --git a/src/components/tbody/tbody.jsx b/src/components/table/tbody/tbody.jsx similarity index 100% rename from src/components/tbody/tbody.jsx rename to src/components/table/tbody/tbody.jsx diff --git a/src/components/td/index.js b/src/components/table/td/index.js similarity index 100% rename from src/components/td/index.js rename to src/components/table/td/index.js diff --git a/src/components/td/td.jsx b/src/components/table/td/td.jsx similarity index 100% rename from src/components/td/td.jsx rename to src/components/table/td/td.jsx diff --git a/src/components/tfoot/index.js b/src/components/table/tfoot/index.js similarity index 100% rename from src/components/tfoot/index.js rename to src/components/table/tfoot/index.js diff --git a/src/components/tfoot/tfoot-styles.jsx b/src/components/table/tfoot/tfoot-styles.jsx similarity index 86% rename from src/components/tfoot/tfoot-styles.jsx rename to src/components/table/tfoot/tfoot-styles.jsx index bf62f561..224fc6f5 100644 --- a/src/components/tfoot/tfoot-styles.jsx +++ b/src/components/table/tfoot/tfoot-styles.jsx @@ -1,4 +1,4 @@ -import styleUtils from '../table/style-utilities'; +import styleUtils from '../style-utilities'; export default ({ mixins, typography, palette: { color } }) => ({ tfoot: { diff --git a/src/components/tfoot/tfoot.jsx b/src/components/table/tfoot/tfoot.jsx similarity index 100% rename from src/components/tfoot/tfoot.jsx rename to src/components/table/tfoot/tfoot.jsx diff --git a/src/components/th/index.js b/src/components/table/th/index.js similarity index 100% rename from src/components/th/index.js rename to src/components/table/th/index.js diff --git a/src/components/th/th.jsx b/src/components/table/th/th.jsx similarity index 100% rename from src/components/th/th.jsx rename to src/components/table/th/th.jsx diff --git a/src/components/thead/index.js b/src/components/table/thead/index.js similarity index 100% rename from src/components/thead/index.js rename to src/components/table/thead/index.js diff --git a/src/components/thead/thead-styles.jsx b/src/components/table/thead/thead-styles.jsx similarity index 96% rename from src/components/thead/thead-styles.jsx rename to src/components/table/thead/thead-styles.jsx index 7410d1b9..57dc2d0d 100644 --- a/src/components/thead/thead-styles.jsx +++ b/src/components/table/thead/thead-styles.jsx @@ -1,4 +1,4 @@ -import styleUtils from '../table/style-utilities'; +import styleUtils from '../style-utilities'; const normal = ({ mixins, typography, palette: { color } }) => ({ thead: { diff --git a/src/components/thead/thead.jsx b/src/components/table/thead/thead.jsx similarity index 100% rename from src/components/thead/thead.jsx rename to src/components/table/thead/thead.jsx diff --git a/src/components/tr/index.js b/src/components/table/tr/index.js similarity index 100% rename from src/components/tr/index.js rename to src/components/table/tr/index.js diff --git a/src/components/tr/tr-styles.jsx b/src/components/table/tr/tr-styles.jsx similarity index 91% rename from src/components/tr/tr-styles.jsx rename to src/components/table/tr/tr-styles.jsx index bbca9e74..44128731 100644 --- a/src/components/tr/tr-styles.jsx +++ b/src/components/table/tr/tr-styles.jsx @@ -1,5 +1,5 @@ -import styleUtils from '../table/style-utilities'; -import color from '../../styles/color'; +import styleUtils from '../style-utilities'; +import color from '../../../styles/color'; const normal = theme => { const { mixins } = theme; diff --git a/src/components/tr/tr.jsx b/src/components/table/tr/tr.jsx similarity index 96% rename from src/components/tr/tr.jsx rename to src/components/table/tr/tr.jsx index 6b06f5e4..46274d9e 100644 --- a/src/components/tr/tr.jsx +++ b/src/components/table/tr/tr.jsx @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import injectSheet from 'react-jss'; import classNames from 'classnames'; -import omit from '../../utilities/omit'; +import omit from '../../../utilities/omit'; import styles, { stickyOffset as stickyOffsetStyles } from './tr-styles'; function Tr({ classes, className, children, size, border, sticky, stickyBorder, stickyOffset, ...rest }) { diff --git a/src/components/tabs/index.js b/src/components/tabs/index.js index 203dd523..9ed9cc14 100644 --- a/src/components/tabs/index.js +++ b/src/components/tabs/index.js @@ -1 +1,3 @@ -export { default } from './tabs'; +export { default as Tabs } from './tabs'; +export { default as Tab } from './tab'; +export { default as Tabpanel } from './tabpanel'; diff --git a/src/components/tab/index.js b/src/components/tabs/tab/index.js similarity index 100% rename from src/components/tab/index.js rename to src/components/tabs/tab/index.js diff --git a/src/components/tab/tab-styles.jsx b/src/components/tabs/tab/tab-styles.jsx similarity index 100% rename from src/components/tab/tab-styles.jsx rename to src/components/tabs/tab/tab-styles.jsx diff --git a/src/components/tab/tab.jsx b/src/components/tabs/tab/tab.jsx similarity index 100% rename from src/components/tab/tab.jsx rename to src/components/tabs/tab/tab.jsx diff --git a/src/components/tabpanel/index.js b/src/components/tabs/tabpanel/index.js similarity index 100% rename from src/components/tabpanel/index.js rename to src/components/tabs/tabpanel/index.js diff --git a/src/components/tabpanel/tabpanel-styles.jsx b/src/components/tabs/tabpanel/tabpanel-styles.jsx similarity index 100% rename from src/components/tabpanel/tabpanel-styles.jsx rename to src/components/tabs/tabpanel/tabpanel-styles.jsx diff --git a/src/components/tabpanel/tabpanel.jsx b/src/components/tabs/tabpanel/tabpanel.jsx similarity index 100% rename from src/components/tabpanel/tabpanel.jsx rename to src/components/tabs/tabpanel/tabpanel.jsx diff --git a/src/index.js b/src/index.js index 9288276f..54353a47 100644 --- a/src/index.js +++ b/src/index.js @@ -22,17 +22,9 @@ import ShowMore from './components/show-more'; import TableContentWrapper from './components/table-content-wrapper'; import Spinner from './components/spinner'; import Subsection from './components/subsection/subsection'; -import Tabs from './components/tabs'; -import Tab from './components/tab'; -import Tabpanel from './components/tabpanel'; -import Table from './components/table'; -import Tbody from './components/tbody'; -import Td from './components/td'; -import Tfoot from './components/tfoot'; -import Th from './components/th'; -import Thead from './components/thead'; +import { Tabs, Tab, Tabpanel } from './components/tabs'; +import { Table, Tbody, Td, Tfoot, Th, Thead, Tr } from './components/table'; import Tooltip from './components/tooltip'; -import Tr from './components/tr'; import Ul from './components/ul/ul'; import { PopupMenu, PopupMenuItem } from './components/popup-menu'; diff --git a/test/components/smart-table-content/smart-table-content.test.js b/test/components/smart-table-content/smart-table-content.test.js index 1d20e1b6..b845afa3 100644 --- a/test/components/smart-table-content/smart-table-content.test.js +++ b/test/components/smart-table-content/smart-table-content.test.js @@ -5,7 +5,7 @@ import { mockClasses } from '../../../src'; import { Component as TableContentWrapper, styles } from '../../../src/components/table-content-wrapper/table-content-wrapper'; import TableHead from '../../../src/components/table-content-wrapper/table-head/table-head'; import TableBody from '../../../src/components/table-content-wrapper/table-body/table-body'; -import Table from '../../../src/components/table'; +import Table from '../../../src/components/table/table'; import Pagination from '../../../src/components/pagination'; const classes = mockClasses(styles); diff --git a/test/components/smart-table-content/table-head.test.js b/test/components/smart-table-content/table-head.test.js index 95553e4b..a4a5e6f1 100644 --- a/test/components/smart-table-content/table-head.test.js +++ b/test/components/smart-table-content/table-head.test.js @@ -3,8 +3,8 @@ import { expect } from 'chai'; import sinon from 'sinon'; import { shallow } from 'enzyme'; import { mockClasses } from '../../../src'; -import Tr from '../../../src/components/tr'; -import Th from '../../../src/components/th'; +import Tr from '../../../src/components/table/tr'; +import Th from '../../../src/components/table/th'; import ArrowDownStraight from '../../../src/components/icon/icons/arrowDownStraight'; import ArrowUpStraight from '../../../src/components/icon/icons/arrowUpStraight'; import { diff --git a/test/components/table/table-cell/table-cell.test.js b/test/components/table/table-cell.test.js similarity index 85% rename from test/components/table/table-cell/table-cell.test.js rename to test/components/table/table-cell.test.js index 013b43aa..d63102de 100644 --- a/test/components/table/table-cell/table-cell.test.js +++ b/test/components/table/table-cell.test.js @@ -1,8 +1,8 @@ import React from 'react'; import { expect } from 'chai'; import { shallow } from 'enzyme'; -import { mockClasses } from '../../../../src'; -import { Component as TableCell, styles } from '../../../../src/components/table-cell/table-cell'; +import { mockClasses } from '../../../src'; +import { Component as TableCell, styles } from '../../../src/components/table/table-cell/table-cell'; describe('', () => { const classes = mockClasses(styles); diff --git a/test/components/tab/tab.test.js b/test/components/tabs/tab.test.js similarity index 99% rename from test/components/tab/tab.test.js rename to test/components/tabs/tab.test.js index ce7334b5..6c1d8df1 100644 --- a/test/components/tab/tab.test.js +++ b/test/components/tabs/tab.test.js @@ -2,7 +2,7 @@ import React from 'react'; import { expect } from 'chai'; import { shallow } from 'enzyme'; import sinon from 'sinon'; -import { Component as Tab, styles } from '../../../src/components/tab/tab'; +import { Component as Tab, styles } from '../../../src/components/tabs/tab/tab'; import { mockClasses } from '../../../src'; const classes = mockClasses(styles); diff --git a/test/components/tabpanel/tabpanel.test.js b/test/components/tabs/tabpanel.test.js similarity index 98% rename from test/components/tabpanel/tabpanel.test.js rename to test/components/tabs/tabpanel.test.js index 997663ed..bccf0b00 100644 --- a/test/components/tabpanel/tabpanel.test.js +++ b/test/components/tabs/tabpanel.test.js @@ -1,7 +1,7 @@ import React from 'react'; import { expect } from 'chai'; import { shallow } from 'enzyme'; -import { Component as Tabpanel, styles } from '../../../src/components/tabpanel/tabpanel'; +import { Component as Tabpanel, styles } from '../../../src/components/tabs/tabpanel/tabpanel'; import { mockClasses } from '../../../src'; const classes = mockClasses(styles); diff --git a/test/components/tabs/tabs.test.js b/test/components/tabs/tabs.test.js index 8b9d6964..e90e8e81 100644 --- a/test/components/tabs/tabs.test.js +++ b/test/components/tabs/tabs.test.js @@ -2,8 +2,8 @@ import React from 'react'; import { expect } from 'chai'; import { shallow } from 'enzyme'; import { Component as Tabs, styles } from '../../../src/components/tabs/tabs'; -import Tab from '../../../src/components/tab/tab'; -import Tabpanel from '../../../src/components/tabpanel/tabpanel'; +import Tab from '../../../src/components/tabs/tab/tab'; +import Tabpanel from '../../../src/components/tabs/tabpanel/tabpanel'; import { mockClasses } from '../../../src'; const classes = mockClasses(styles);