Skip to content

Commit

Permalink
fix getDetailsProps implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
VanAnderson committed Feb 9, 2021
1 parent 3bd153a commit 57dafdd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion src/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ import {COMMON, SystemCommonProps} from './constants'
import {ComponentProps} from './utils/types'
import sx, {SxProp} from './sx'

const Details = styled.details<SystemCommonProps & SxProp>`
type StyledDetailsProps = {
ref?: React.RefObject<HTMLElement>
onToggle?: (event: Event) => void
open?: boolean
} & SystemCommonProps &
SxProp

const Details = styled.details<StyledDetailsProps>`
& > summary {
list-style: none;
}
Expand Down
8 changes: 4 additions & 4 deletions src/__tests__/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('Details', () => {
const Component = () => {
const {getDetailsProps} = useDetails({closeOnOutsideClick: true})
return (
<Details {...getDetailsProps}>
<Details {...getDetailsProps()}>
<summary>hi</summary>
</Details>
)
Expand All @@ -47,7 +47,7 @@ describe('Details', () => {
const Component = () => {
const {getDetailsProps, open} = useDetails({closeOnOutsideClick: true})
return (
<Details {...getDetailsProps}>
<Details {...getDetailsProps()}>
<Button as="summary">{open ? 'Open' : 'Closed'}</Button>
</Details>
)
Expand All @@ -71,7 +71,7 @@ describe('Details', () => {
const Component = () => {
const {getDetailsProps, setOpen, open} = useDetails({closeOnOutsideClick: true, defaultOpen: true})
return (
<Details {...getDetailsProps}>
<Details {...getDetailsProps()}>
<Button as="summary">{open ? 'Open' : 'Closed'}</Button>
<CloseButton onClick={() => setOpen(false)} />
</Details>
Expand All @@ -95,7 +95,7 @@ describe('Details', () => {
const Component = () => {
const {getDetailsProps, open} = useDetails({closeOnOutsideClick: true, defaultOpen: true})
return (
<Details {...getDetailsProps}>
<Details {...getDetailsProps()}>
<Button as="summary">{open ? 'Open' : 'Closed'}</Button>
<Box>
<ButtonPrimary>hi</ButtonPrimary>
Expand Down

0 comments on commit 57dafdd

Please sign in to comment.