Skip to content

Commit 27a811b

Browse files
committed
refactor: update interfaces and proptypes
1 parent dfe8dda commit 27a811b

File tree

13 files changed

+29
-19
lines changed

13 files changed

+29
-19
lines changed

src/components/dropdown/CDropdown.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,19 @@ export const CDropdown = forwardRef<HTMLDivElement | HTMLLIElement, CDropdownPro
176176
},
177177
)
178178

179+
const alignmentDirection = PropTypes.oneOf<Directions>(['start', 'end'])
180+
179181
CDropdown.propTypes = {
180-
alignment: PropTypes.any, // TODO: fix; add proper PropTypes
182+
// @ts-expect-error TODO: we have to find a solution
183+
alignment: PropTypes.oneOfType([
184+
alignmentDirection,
185+
PropTypes.shape({ xs: alignmentDirection }),
186+
PropTypes.shape({ sm: alignmentDirection }),
187+
PropTypes.shape({ md: alignmentDirection }),
188+
PropTypes.shape({ lg: alignmentDirection }),
189+
PropTypes.shape({ xl: alignmentDirection }),
190+
PropTypes.shape({ xxl: alignmentDirection }),
191+
]),
181192
children: PropTypes.node,
182193
className: PropTypes.string,
183194
component: PropTypes.elementType,

src/components/grid/CCol.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const BREAKPOINTS = [
6666

6767
export const CCol = forwardRef<HTMLDivElement, CColProps>(
6868
({ children, className, ...rest }, ref) => {
69-
const repsonsiveCLassNames: Array<string> = []
69+
const repsonsiveCLassNames: string[] = []
7070

7171
BREAKPOINTS.forEach((bp) => {
7272
const breakpoint = rest[bp]

src/components/grid/CContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const BREAKPOINTS = [
4545

4646
export const CContainer = forwardRef<HTMLDivElement, CContainerProps>(
4747
({ children, className, ...rest }, ref) => {
48-
const repsonsiveCLassNames: Array<string> = []
48+
const repsonsiveCLassNames: string[] = []
4949

5050
BREAKPOINTS.forEach((bp) => {
5151
const breakpoint = rest[bp]

src/components/grid/CRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const BREAKPOINTS = [
6363

6464
export const CRow = forwardRef<HTMLDivElement, CRowProps>(
6565
({ children, className, ...rest }, ref) => {
66-
const repsonsiveCLassNames: Array<string> = []
66+
const repsonsiveCLassNames: string[] = []
6767

6868
BREAKPOINTS.forEach((bp) => {
6969
const breakpoint = rest[bp]

src/components/pagination/CPagination.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export const CPagination = forwardRef<HTMLUListElement, CPaginationProps>(
2525
)
2626

2727
CPagination.propTypes = {
28-
children: PropTypes.any,
29-
className: PropTypes.any,
28+
children: PropTypes.node,
29+
className: PropTypes.string,
3030
size: PropTypes.oneOf(['sm', 'lg']),
3131
}
3232

src/components/popover/CPopover.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export const CPopover: FC<CPopoverProps> = ({
112112
}
113113

114114
CPopover.propTypes = {
115-
children: PropTypes.any,
115+
children: PropTypes.node,
116116
placement: PropTypes.oneOf([
117117
'auto',
118118
'top-end',

src/components/popover/CPopoverContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const CPopoverContent = forwardRef<HTMLDivElement, CPopoverContentProps>(
3232
CPopoverContent.propTypes = {
3333
arrowProps: PropTypes.any,
3434
content: PropTypes.node,
35-
placementClassNamePostfix: PropTypes.any,
35+
placementClassNamePostfix: PropTypes.string,
3636
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
3737
title: PropTypes.string,
3838
transitionClass: PropTypes.string,

src/components/progress/CProgressBar.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export interface CProgressBarProps extends HTMLAttributes<HTMLDivElement> {
1818
* Sets the color context of the component to one of CoreUI’s themed colors. [docs]
1919
*
2020
* @type 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string
21-
* @default 'primary'
2221
*/
2322
color?: Colors
2423
/**
@@ -29,8 +28,6 @@ export interface CProgressBarProps extends HTMLAttributes<HTMLDivElement> {
2928
value?: number
3029
/**
3130
* Set the progress bar variant to optional striped. [docs]
32-
*
33-
* @default 'undefined'
3431
*/
3532
variant?: 'striped'
3633
}
@@ -69,7 +66,7 @@ CProgressBar.propTypes = {
6966
className: PropTypes.string,
7067
color: colorPropType,
7168
value: PropTypes.number,
72-
variant: PropTypes.any,
69+
variant: PropTypes.oneOf(['striped']),
7370
}
7471

7572
CProgressBar.displayName = 'CProgressBar'

src/components/sidebar/CSidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ export const CSidebar = forwardRef<HTMLDivElement, CSidebarProps>(
161161
)
162162

163163
CSidebar.propTypes = {
164-
children: PropTypes.any,
165-
className: PropTypes.any,
164+
children: PropTypes.node,
165+
className: PropTypes.string,
166166
narrow: PropTypes.bool,
167167
onHide: PropTypes.func,
168168
onShow: PropTypes.func,

src/components/toast/CToaster.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface CToasterProps extends HTMLAttributes<HTMLDivElement> {
1010
/**
1111
* Describes the placement of your component. [docs]
1212
*
13-
* @type 'top-start' | 'top' | 'top-end' | 'middle-start' | 'middle' | 'middle-end' | 'bottom-start' | 'bottom' | 'bottom-end' |
13+
* @type 'top-start' | 'top' | 'top-end' | 'middle-start' | 'middle' | 'middle-end' | 'bottom-start' | 'bottom' | 'bottom-end' | string
1414
* @default 'top-end'
1515
*/
1616
placement?:
@@ -31,7 +31,7 @@ export interface CToasterProps extends HTMLAttributes<HTMLDivElement> {
3131
}
3232

3333
export const CToaster = forwardRef<HTMLDivElement, CToasterProps>(
34-
({ children, className, placement, push, ...rest }, ref) => {
34+
({ children, className, placement = 'top-end', push, ...rest }, ref) => {
3535
const [toasts, setToasts] = useState<ReactElement[]>([])
3636
const index = useRef<number>(0)
3737

0 commit comments

Comments
 (0)