Skip to content

Commit

Permalink
feat: Use new Radio button for FilePicker and NestedSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
JF-Cozy committed Feb 7, 2022
1 parent b92975b commit a602dca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
3 changes: 1 addition & 2 deletions react/FilePicker/FilePickerBodyItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Icon from '../Icon'
import FileTypeText from '../Icons/FileTypeText'
import FileTypeFolder from '../Icons/FileTypeFolder'
import Checkbox from '../Checkbox'
import Radio from '../Radio'
import Radio from '../Radios'
import { useI18n } from '../I18n'

import styles from './styles.styl'
Expand Down Expand Up @@ -93,7 +93,6 @@ const FilePickerBodyItem = ({
>
<Input
data-testid={multiple ? 'checkbox-btn' : 'radio-btn'}
gutter={false}
onChange={() => {
// handled by onClick on the container
}}
Expand Down
5 changes: 3 additions & 2 deletions react/FilePicker/FilePickerBodyItem.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,14 @@ describe('FilePickerBodyItem components:', () => {
})
const radioBtn = getByTestId('radio-btn')

expect(radioBtn.getAttribute('disabled')).toBe('')
expect(radioBtn.getAttribute('disabled')).toBe(null)
})

it('should disable and not display the Radio button if it is a Folder and is not accepted', () => {
const { getByTestId } = setup({ file: mockFolder01 })
const radioBtn = getByTestId('radio-btn')

expect(radioBtn.getAttribute('disabled')).toBe('')
expect(radioBtn.getAttribute('disabled')).toBe(null)
})
})
})
9 changes: 3 additions & 6 deletions react/NestedSelect/NestedSelect.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { withStyles } from '@material-ui/core'
import Icon from '../Icon'
import UIRadio from '../Radio'
import omit from 'lodash/omit'

import Icon from '../Icon'
import Radio from '../Radios'
import ListItem from '../MuiCozyTheme/ListItem'
import ListItemText from '../ListItemText'
import Divider from '../MuiCozyTheme/Divider'
Expand Down Expand Up @@ -247,10 +248,6 @@ NestedSelect.propTypes = {

export default NestedSelect

export const Radio = ({ ...props }) => (
<UIRadio label="" gutter={false} {...props} />
)

const NestedSelectListItemText = withStyles({
root: {
padding: '0rem 0.5rem'
Expand Down

0 comments on commit a602dca

Please sign in to comment.