Skip to content

Commit

Permalink
fix: fix prop types
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardo committed Aug 18, 2021
1 parent 4f81b75 commit a00b1ea
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 21 deletions.
12 changes: 6 additions & 6 deletions components/sharing-dialog/src/access-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ export const AccessSelect = ({
)

AccessSelect.propTypes = {
access: PropTypes.string,
accessOptions: PropTypes.array,
access: PropTypes.string.isRequired,
accessOptions: PropTypes.array.isRequired,
onChange: PropTypes.func.isRequired,
disabled: PropTypes.bool,
label: PropTypes.string,
placeholder: PropTypes.string,
prefix: PropTypes.string,
showRemoveOption: PropTypes.bool,
onChange: PropTypes.func,
}

const CustomSingleSelectOption = ({
Expand All @@ -78,9 +78,9 @@ const CustomSingleSelectOption = ({
)

CustomSingleSelectOption.propTypes = {
label: PropTypes.string.isRequired,
value: PropTypes.string.isRequired,
onClick: PropTypes.func.isRequired,
active: PropTypes.bool,
destructive: PropTypes.bool,
label: PropTypes.string,
value: PropTypes.string,
onClick: PropTypes.func,
}
7 changes: 3 additions & 4 deletions components/sharing-dialog/src/autocomplete/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const SearchResults = ({ searchResults, onClick }) => (
)

SearchResults.propTypes = {
searchResults: PropTypes.array,
onClick: PropTypes.func,
searchResults: PropTypes.array.isRequired,
onClick: PropTypes.func.isRequired,
}

export const Autocomplete = ({
Expand All @@ -55,7 +55,6 @@ export const Autocomplete = ({
}
}, [])

// TODO debounce
const onInputChange = ({ value }) => {
onSearch(value)
}
Expand Down Expand Up @@ -98,12 +97,12 @@ Autocomplete.defaultProps = {
}

Autocomplete.propTypes = {
searchResults: PropTypes.array.isRequired,
dataTest: PropTypes.string,
inputWidth: PropTypes.string,
label: PropTypes.string,
maxHeight: PropTypes.string,
placeholder: PropTypes.string,
searchResults: PropTypes.array,
value: PropTypes.string,
onChange: PropTypes.func,
onClose: PropTypes.func,
Expand Down
8 changes: 6 additions & 2 deletions components/sharing-dialog/src/icons/avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from '@dhis2/prop-types'
import React from 'react'
import { avatarStyles } from '../sharing-dialog.styles'

export const Avatar = ({ name } = { name: 'USER' }) => {
export const Avatar = ({ name }) => {
const nameParts = name.split(' ')

let initials = nameParts.shift().charAt(0)
Expand All @@ -19,6 +19,10 @@ export const Avatar = ({ name } = { name: 'USER' }) => {
)
}

Avatar.defaultProps = {
name: 'USER',
}

Avatar.propTypes = {
name: PropTypes.string,
name: PropTypes.string.isRequired,
}
2 changes: 1 addition & 1 deletion components/sharing-dialog/src/share-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,5 @@ export const ShareBlock = ({ onAdd }) => {
}

ShareBlock.propTypes = {
onAdd: PropTypes.func,
onAdd: PropTypes.func.isRequired,
}
7 changes: 4 additions & 3 deletions components/sharing-dialog/src/sharing-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const mutation = {
}

export const SharingDialog = ({
initialSharingSettings = defaultSharingSettings,
initialSharingSettings,
id,
type,
onClose,
Expand Down Expand Up @@ -268,11 +268,14 @@ export const SharingDialog = ({
}

SharingDialog.defaultProps = {
initialSharingSettings: defaultSharingSettings,
onError: Function.prototype,
onSave: Function.prototype,
}

SharingDialog.propTypes = {
type: PropTypes.string.isRequired,
onClose: PropTypes.func.isRequired,
id: PropTypes.string,
initialSharingSettings: PropTypes.shape({
allowExternal: PropTypes.bool,
Expand All @@ -283,8 +286,6 @@ SharingDialog.propTypes = {
public: PropTypes.string,
users: PropTypes.object,
}),
type: PropTypes.string,
onClose: PropTypes.func,
onError: PropTypes.func,
onSave: PropTypes.func,
}
10 changes: 5 additions & 5 deletions components/sharing-dialog/src/sharing-list-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ export const SharingListItem = ({
}

SharingListItem.propTypes = {
access: PropTypes.string,
accessOptions: PropTypes.array,
access: PropTypes.string.isRequired,
accessOptions: PropTypes.array.isRequired,
name: PropTypes.string.isRequired,
target: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
disabled: PropTypes.bool,
name: PropTypes.string,
target: PropTypes.string,
onChange: PropTypes.func,
onRemove: PropTypes.func,
}

0 comments on commit a00b1ea

Please sign in to comment.