Skip to content

Commit

Permalink
feat: Add all Table components from MUI
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `Table` component has been deprecated. Use codemods to deal with the change.

```
yarn global add @cozy/codemods
yarn global add [email protected]
jscodeshift -t $(yarn global dir)/node_modules/@cozy/codemods/src/transforms/transform-ui-deprecated-table.js src babel --ignore-pattern=src/targets/ --extensions js,jsx,tsx --parser tsx
```
  • Loading branch information
Merkur39 committed Mar 14, 2024
1 parent f4c2e77 commit 5c6438f
Show file tree
Hide file tree
Showing 21 changed files with 543 additions and 541 deletions.
1 change: 0 additions & 1 deletion docs/styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ module.exports = {
'../react/SelectBox/SelectBox.jsx',
'../react/Spinner',
'../react/Stack',
'../react/Table',
'../react/Textarea',
'../react/UnorderedList',
'../react/Wizard'
Expand Down
2 changes: 1 addition & 1 deletion react/ContactsList/Contacts/ContactCozy.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'

import { TableCell } from '../../Table'
import { TableCell } from '../../deprecated/Table'
import styles from '../styles.styl'

const ContactCozy = ({ cozyUrl }) => (
Expand Down
2 changes: 1 addition & 1 deletion react/ContactsList/Contacts/ContactEmail.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'

import { TableCell } from '../../Table'
import { TableCell } from '../../deprecated/Table'
import styles from '../styles.styl'

const ContactEmail = ({ email }) => (
Expand Down
2 changes: 1 addition & 1 deletion react/ContactsList/Contacts/ContactIdentity.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { models } from 'cozy-client'
import PropTypes from 'prop-types'

import { Avatar } from '../../Avatar'
import { TableCell } from '../../Table'
import { TableCell } from '../../deprecated/Table'
import ContactName from './ContactName'
import styles from '../styles.styl'

Expand Down
2 changes: 1 addition & 1 deletion react/ContactsList/Contacts/ContactPhone.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'

import { TableCell } from '../../Table'
import { TableCell } from '../../deprecated/Table'
import styles from '../styles.styl'

const ContactPhone = ({ phone }) => (
Expand Down
2 changes: 1 addition & 1 deletion react/ContactsList/ContactsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'

import { useI18n } from '../providers/I18n'
import { Table } from '../Table'
import { Table } from '../deprecated/Table'
import List from '../List'
import ListSubheader from '../ListSubheader'
import { sortContacts, categorizeContacts, sortHeaders } from './helpers'
Expand Down
8 changes: 4 additions & 4 deletions react/ContactsList/__snapshots__/ContactRow.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exports[`ContactRow should match the contact snapshot 1`] = `
size="medium"
>
<div
className="styles__TableCell___yJCq7 styles__contact-identity___mL3IJ u-flex u-flex-items-center u-ellipsis u-p-0"
className="styles__TableCell___3vgVE styles__contact-identity___mL3IJ u-flex u-flex-items-center u-ellipsis u-p-0"
data-testid="ContactIdentity"
>
<div
Expand Down Expand Up @@ -48,19 +48,19 @@ exports[`ContactRow should match the contact snapshot 1`] = `
</p>
</div>
<div
className="styles__TableCell___yJCq7 styles__contact-email___3n3q2 u-ellipsis u-p-0"
className="styles__TableCell___3vgVE styles__contact-email___3n3q2 u-ellipsis u-p-0"
data-testid="ContactEmail"
>
johndoe@localhost
</div>
<div
className="styles__TableCell___yJCq7 styles__contact-phone___1sA_m u-ellipsis u-p-0"
className="styles__TableCell___3vgVE styles__contact-phone___1sA_m u-ellipsis u-p-0"
data-testid="ContactPhone"
>
0123456789
</div>
<div
className="styles__TableCell___yJCq7 styles__contact-cozyurl___3kBp5 u-ellipsis u-p-0"
className="styles__TableCell___3vgVE styles__contact-cozyurl___3kBp5 u-ellipsis u-p-0"
data-testid="ContactCozy"
>
http://johndoe.mycozy.cloud
Expand Down
3 changes: 3 additions & 0 deletions react/Table/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Table from '@material-ui/core/Table'

export default Table
3 changes: 3 additions & 0 deletions react/TableBody/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import TableBody from '@material-ui/core/TableBody'

export default TableBody
3 changes: 3 additions & 0 deletions react/TableCell/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import TableCell from '@material-ui/core/TableCell'

export default TableCell
3 changes: 3 additions & 0 deletions react/TableContainer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import TableContainer from '@material-ui/core/TableContainer'

export default TableContainer
3 changes: 3 additions & 0 deletions react/TableFooter/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import TableFooter from '@material-ui/core/TableFooter'

export default TableFooter
3 changes: 3 additions & 0 deletions react/TableHead/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import TableHead from '@material-ui/core/TableHead'

export default TableHead
3 changes: 3 additions & 0 deletions react/TablePagination/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import TablePagination from '@material-ui/core/TablePagination'

export default TablePagination
3 changes: 3 additions & 0 deletions react/TableRow/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import TableRow from '@material-ui/core/TableRow'

export default TableRow
3 changes: 3 additions & 0 deletions react/TableSortLabel/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import TableSortLabel from '@material-ui/core/TableSortLabel'

export default TableSortLabel
1,035 changes: 506 additions & 529 deletions react/__snapshots__/examples.spec.jsx.snap

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react/Table/Readme.md → react/deprecated/Table/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TableRow,
TableHeader,
TableCell
} from 'cozy-ui/transpiled/react/Table';
} from 'cozy-ui/transpiled/react/deprecated/Table';

let refRow = ''
const cellStyles = { flexGrow: 1 };
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion react/examples.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ testComponent('SelectBox')
testComponent('Sidebar')
testComponent('Spinner')
testComponent('Switch')
testComponent('Table')
testComponent('Textarea')
testComponent('UnorderedList')
testComponent('Wizard')

0 comments on commit 5c6438f

Please sign in to comment.