Skip to content

Commit

Permalink
Fix default props deprecated issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dipiash committed Oct 23, 2024
1 parent 6d1a468 commit f16a04b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
6 changes: 1 addition & 5 deletions packages/ui-kit/src/lib/Error/Error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ import { IconAlertCircle } from '@tabler/icons-react'

import { ErrorPropertiesInterface } from './Error.types'

export const Error: FC<ErrorPropertiesInterface> = memo(({ text }) => (
export const Error: FC<ErrorPropertiesInterface> = memo(({ text = 'Error' }) => (
<Alert icon={<IconAlertCircle size={16} />} title="Error" color="red">
{text}
</Alert>
))

Error.defaultProps = {
text: 'Error',
}

Error.displayName = 'Error'
14 changes: 7 additions & 7 deletions packages/ui-kit/src/lib/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import { PaginationPropertiesInterface } from './Pagination.types'

import { Button } from '../Button'

export const Pagination: FC<PaginationPropertiesInterface> = ({ isNextDisabled, isPrevDisabled, onNextClick, onPrevClick }) => (
export const Pagination: FC<PaginationPropertiesInterface> = ({
isNextDisabled = false,
isPrevDisabled: isPreviousDisabled = true,
onNextClick,
onPrevClick,
}) => (
<Group grow gap="xs">
<Button data-testid="button-prev" disabled={isPrevDisabled} onClick={onPrevClick}>
<Button data-testid="button-prev" disabled={isPreviousDisabled} onClick={onPrevClick}>
{'<'} Prev
</Button>
<Button data-testid="button-next" disabled={isNextDisabled} onClick={onNextClick}>
Next {'>'}
</Button>
</Group>
)

Pagination.defaultProps = {
isNextDisabled: false,
isPrevDisabled: true,
}
8 changes: 1 addition & 7 deletions packages/ui-kit/src/lib/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { TablePropertiesInterface } from './Table.types'

import classes from './Table.module.css'

export const Table: FC<TablePropertiesInterface> = ({ columns, data, error }) => {
export const Table: FC<TablePropertiesInterface> = ({ columns = {}, data = [], error = false }) => {
const columnKeys = useMemo(() => Object.keys(columns), [columns])

return (
Expand Down Expand Up @@ -34,9 +34,3 @@ export const Table: FC<TablePropertiesInterface> = ({ columns, data, error }) =>
</div>
)
}

Table.defaultProps = {
columns: {},
data: [],
error: false,
}

0 comments on commit f16a04b

Please sign in to comment.