Skip to content

Commit 39c5f1e

Browse files
author
Stephen Gibson
committed
ICommonProps typings adjusted to allow custom Components to be used with the as prop.
Updated documentation to reflect this
1 parent 3d29f02 commit 39c5f1e

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/components/stories/Utils.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ export const StandardProps = () => (
8282
<PropsHeader>Standard properties</PropsHeader>
8383
<Prop
8484
name="as"
85-
type="string"
85+
type="string | React.ComponentType<ICommonProps>"
8686
default="div"
87-
description="Allows control over the outputted HTML element allowing HTML 5 semantic markup to be created."
87+
description="Allows control over the outputted HTML element either through HTML 5 semantic markup or a custom Component."
8888
/>
8989
<Prop
9090
name="centerContent"

src/core-react.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const commonProps = {
1515
id: PropTypes.string,
1616
className: PropTypes.string,
1717
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
18-
as: PropTypes.string,
18+
as: PropTypes.any,
1919
centerContent: PropTypes.oneOf([CenterType.None, CenterType.Vertical, CenterType.HorizontalVertical]),
2020
zIndex: PropTypes.number,
2121
scrollable: PropTypes.bool,

src/core-types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from "react";
2+
13
export enum Type {
24
ViewPort = "viewport",
35
Fixed = "fixed",
@@ -60,7 +62,7 @@ export interface ICommonProps extends IPassThroughEvents {
6062
id?: string;
6163
className?: string;
6264
style?: React.CSSProperties;
63-
as?: string;
65+
as?: keyof React.ReactDOM | React.ComponentType<ICommonProps>;
6466
centerContent?: CenterType;
6567
zIndex?: number;
6668
scrollable?: boolean;

0 commit comments

Comments
 (0)