Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 71dff1d

Browse filesBrowse files
committed
refactor(CButton, CHeaderBrand, CLink, ClistGroupItem): update interface
1 parent 1098ea8 commit 71dff1d
Copy full SHA for 71dff1d

File tree

4 files changed

+10
-9
lines changed
Filter options

4 files changed

+10
-9
lines changed

‎packages/coreui-react/src/components/button/CButton.tsx

Copy file name to clipboardExpand all lines: packages/coreui-react/src/components/button/CButton.tsx
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import React, { ButtonHTMLAttributes, ElementType, forwardRef } from 'react'
1+
import React, { ElementType, forwardRef } from 'react'
22
import PropTypes from 'prop-types'
33
import classNames from 'classnames'
44

55
import { Colors, Shapes, colorPropType } from '../Types'
6-
import { CLink } from '../link/CLink'
6+
import { CLink, CLinkProps } from '../link/CLink'
77

8-
export interface CButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
8+
export interface CButtonProps extends Omit<CLinkProps, 'size'> {
99
/**
1010
* Toggle the active state for the component.
1111
*/

‎packages/coreui-react/src/components/header/CHeaderBrand.tsx

Copy file name to clipboardExpand all lines: packages/coreui-react/src/components/header/CHeaderBrand.tsx
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import React, { ElementType, forwardRef, HTMLAttributes } from 'react'
1+
import React, { ElementType, forwardRef, AnchorHTMLAttributes } from 'react'
22
import PropTypes from 'prop-types'
33
import classNames from 'classnames'
44

5-
export interface CHeaderBrandProps extends HTMLAttributes<HTMLAnchorElement | HTMLSpanElement> {
5+
export interface CHeaderBrandProps
6+
extends AnchorHTMLAttributes<HTMLAnchorElement | HTMLSpanElement> {
67
/**
78
* A string of all className you want applied to the component.
89
*/

‎packages/coreui-react/src/components/link/CLink.tsx

Copy file name to clipboardExpand all lines: packages/coreui-react/src/components/link/CLink.tsx
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { AllHTMLAttributes, ElementType, forwardRef, MouseEvent } from 'r
22
import PropTypes from 'prop-types'
33
import classNames from 'classnames'
44

5-
export interface CLinkProps extends AllHTMLAttributes<HTMLElement> {
5+
export interface CLinkProps extends AllHTMLAttributes<HTMLButtonElement | HTMLAnchorElement> {
66
/**
77
* Toggle the active state for the component.
88
*/
@@ -36,7 +36,7 @@ export const CLink = forwardRef<HTMLButtonElement | HTMLAnchorElement, CLinkProp
3636
{...(active && { 'aria-current': 'page' })}
3737
{...(Component === 'a' && disabled && { 'aria-disabled': true, tabIndex: -1 })}
3838
{...((Component === 'a' || Component === 'button') && {
39-
onClick: (event: MouseEvent<HTMLElement>) => {
39+
onClick: (event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {
4040
event.preventDefault
4141
!disabled && rest.onClick && rest.onClick(event)
4242
},

‎packages/coreui-react/src/components/list-group/CListGroupItem.tsx

Copy file name to clipboardExpand all lines: packages/coreui-react/src/components/list-group/CListGroupItem.tsx
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import React, { ElementType, HTMLAttributes, forwardRef } from 'react'
1+
import React, { ElementType, AnchorHTMLAttributes, forwardRef } from 'react'
22
import PropTypes from 'prop-types'
33
import classNames from 'classnames'
44

55
import { Colors, colorPropType } from '../Types'
66
import { CLink } from '../link/CLink'
77

88
export interface CListGroupItemProps
9-
extends HTMLAttributes<HTMLLIElement | HTMLAnchorElement | HTMLButtonElement> {
9+
extends AnchorHTMLAttributes<HTMLLIElement | HTMLAnchorElement | HTMLButtonElement> {
1010
/**
1111
* Toggle the active state for the component.
1212
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.