Skip to content

Commit

Permalink
refactor(CreateTearsheetDivider): convert to typescript (#4584)
Browse files Browse the repository at this point in the history
* fix(createtearsheetdivider): file type updated

* feat(createtearsheetdivider): add typescript types

* fix(createtearsheetdivider): removed type propswithchildren
  • Loading branch information
szinta authored Mar 25, 2024
1 parent b0e84bf commit f9b7168
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 32 deletions.

This file was deleted.

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,
};

0 comments on commit f9b7168

Please sign in to comment.