-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(CreateTearsheetDivider): convert to typescript (#4584)
* fix(createtearsheetdivider): file type updated * feat(createtearsheetdivider): add typescript types * fix(createtearsheetdivider): removed type propswithchildren
- Loading branch information
Showing
2 changed files
with
46 additions
and
32 deletions.
There are no files selected for viewing
32 changes: 0 additions & 32 deletions
32
packages/ibm-products/src/components/CreateTearsheet/CreateTearsheetDivider.js
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
packages/ibm-products/src/components/CreateTearsheet/CreateTearsheetDivider.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Copyright IBM Corp. 2021, 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React, { ForwardedRef, forwardRef } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import cx from 'classnames'; | ||
import { pkg } from '../../settings'; | ||
|
||
const componentName = 'CreateTearsheetDivider'; | ||
const blockClass = `${pkg.prefix}--tearsheet-create__section--divider`; | ||
|
||
interface CreateTearsheetDividerProps { | ||
/** Specifies an optional className to be added to the tearsheet divider */ | ||
className?: string; | ||
} | ||
|
||
export let CreateTearsheetDivider: React.FC<CreateTearsheetDividerProps> = | ||
forwardRef( | ||
( | ||
{ | ||
className, | ||
// Collect any other property values passed in | ||
...rest | ||
}, | ||
ref: ForwardedRef<HTMLSpanElement> | ||
) => { | ||
return <span {...rest} ref={ref} className={cx(blockClass, className)} />; | ||
} | ||
); | ||
|
||
// Return a placeholder if not released and not enabled by feature flag | ||
CreateTearsheetDivider = pkg.checkComponentEnabled( | ||
CreateTearsheetDivider, | ||
componentName | ||
); | ||
|
||
CreateTearsheetDivider.propTypes = { | ||
/** | ||
* Sets an optional className to be added to the tearsheet divider | ||
*/ | ||
className: PropTypes.string, | ||
}; |