Skip to content

Commit

Permalink
fix: removed hardcoded children props
Browse files Browse the repository at this point in the history
  • Loading branch information
benjitrosch committed Apr 6, 2022
1 parent 0000986 commit 7d93caa
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 23 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog

### [1.7.5](https://www.github.com/daisyui/react-daisyui/compare/v1.7.4...v1.7.5) (2022-04-05)


### Bug Fixes

* removed polymorphic typing from types.ts ([0000986](https://www.github.com/daisyui/react-daisyui/commit/00009869c60c0752817bbaf8f2d90c434784753e))

### [1.7.4](https://www.github.com/daisyui/react-daisyui/compare/v1.7.3...v1.7.4) (2022-04-05)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "react-daisyui",
"version": "1.7.4",
"version": "1.7.5",
"description": "react-daisyui - DaisyUI components built with React 🌼",
"author": "daisyui",
"license": "MIT",
Expand Down
1 change: 0 additions & 1 deletion src/Alert/Alert.tsx
Expand Up @@ -6,7 +6,6 @@ import { IComponentBaseProps, ComponentStatus } from '../types'

export type AlertProps = React.HTMLAttributes<HTMLDivElement> &
IComponentBaseProps & {
children?: ReactNode | ReactNode[]
icon?: ReactNode
status?: ComponentStatus
}
Expand Down
3 changes: 1 addition & 2 deletions src/Artboard/Artboard.tsx
@@ -1,12 +1,11 @@
import React, { forwardRef, ReactNode } from 'react'
import React, { forwardRef } from 'react'
import clsx from 'clsx'
import { twMerge } from 'tailwind-merge'

import { IComponentBaseProps } from '../types'

export type ArtboardProps = React.HTMLAttributes<HTMLDivElement> &
IComponentBaseProps & {
children?: ReactNode | ReactNode[]
size?: 1 | 2 | 3 | 4 | 5 | 6
horizontal?: boolean
}
Expand Down
1 change: 0 additions & 1 deletion src/Divider/Divider.tsx
Expand Up @@ -6,7 +6,6 @@ import { IComponentBaseProps } from '../types'

export type DividerProps = React.HTMLAttributes<HTMLDivElement> &
IComponentBaseProps & {
children?: string
vertical?: boolean
}

Expand Down
2 changes: 0 additions & 2 deletions src/Link/Link.tsx
Expand Up @@ -6,8 +6,6 @@ import { IComponentBaseProps, ComponentColor } from '../types'

export type LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> &
IComponentBaseProps & {
children: string
href?: string
color?: 'neutral' | ComponentColor
hover?: boolean
}
Expand Down
1 change: 0 additions & 1 deletion src/Modal/Modal.tsx
Expand Up @@ -13,7 +13,6 @@ export type ModalRef = {

export type ModalProps = React.HTMLAttributes<HTMLDivElement> &
IComponentBaseProps & {
children?: ReactNode | ReactNode[]
open?: boolean
title?: string
footer?: boolean
Expand Down
21 changes: 8 additions & 13 deletions src/Tabs/Tab.tsx
@@ -1,25 +1,19 @@
import React, { ReactNode } from 'react'
import React from 'react'
import clsx from 'clsx'
import { twMerge } from 'tailwind-merge'

import { ComponentSize } from '../types'

export type TabProps<T> = {
children?: ReactNode | ReactNode[]
export type TabProps<T> = React.AnchorHTMLAttributes<HTMLAnchorElement> & {
value: T
activeValue?: T
onClick?: (value: T) => void
size?: ComponentSize
variant?: 'bordered' | 'lifted'
className?: string
style?: Record<string, string | number>
}

const TabInner = <T extends string | number | undefined>(
props: TabProps<T>,
ref?: React.ForwardedRef<T>
): JSX.Element => {
const {
{
children,
value,
activeValue,
Expand All @@ -28,9 +22,10 @@ const TabInner = <T extends string | number | undefined>(
variant,
className,
style,
...rest
} = props

...props
}: TabProps<T>,
ref?: React.ForwardedRef<T>
): JSX.Element => {
const classes = twMerge(
'tab',
className,
Expand All @@ -44,7 +39,7 @@ const TabInner = <T extends string | number | undefined>(
return (
<a
role="tab"
{...rest}
{...props}
className={classes}
style={style}
onClick={() => onClick && onClick(value)}
Expand Down

0 comments on commit 7d93caa

Please sign in to comment.