Skip to content

Commit

Permalink
chore(ui-expandable,ui-toggle-details): rename the GetToggleProps int…
Browse files Browse the repository at this point in the history
…o ExpandableToggleProps
  • Loading branch information
NamNg1121 authored and ke1k0 committed Jun 1, 2022
1 parent a00f261 commit 8bc8692
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/ui-expandable/src/Expandable/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { controllable } from '@instructure/ui-prop-types'
import type { PropValidators } from '@instructure/shared-types'
import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'

type GetToggleProps = <P extends Record<string, any>>(
type ExpandableToggleProps = <P extends Record<string, any>>(
props?: P & { onClick?: React.MouseEventHandler }
) => {
'aria-controls': string
Expand All @@ -44,7 +44,7 @@ type RenderProps = {
/**
* Props to be spread onto the trigger element
*/
getToggleProps: GetToggleProps
getToggleProps: ExpandableToggleProps

/**
* Props to be spread onto the details element
Expand Down Expand Up @@ -109,6 +109,6 @@ export type {
ExpandableProps,
ExpandableState,
RenderExpandable,
GetToggleProps as ExpandableToggleProps
ExpandableToggleProps
}
export { propTypes, allowedProps }
4 changes: 2 additions & 2 deletions packages/ui-toggle-details/src/ToggleDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ class ToggleDetails extends Component<ToggleDetailsProps> {
}

renderToggle(
ExpandableToggleProps: ReturnType<ExpandableToggleProps>,
toggleProps: ReturnType<ExpandableToggleProps>,
expanded: boolean
) {
const { variant } = this.props

const props = {
...omitProps(this.props, ToggleDetails.allowedProps),
...ExpandableToggleProps,
...toggleProps,
children: this.renderSummary(expanded)
// spread operator makes toggleProps loose Record<string, any>>
} as Record<string, any>
Expand Down

0 comments on commit 8bc8692

Please sign in to comment.