forked from styleguidist/react-styleguidist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SectionHeading.tsx
47 lines (43 loc) · 1018 Bytes
/
SectionHeading.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React from 'react';
import PropTypes from 'prop-types';
import Slot from 'rsg-components/Slot';
import SectionHeadingRenderer from 'rsg-components/SectionHeading/SectionHeadingRenderer';
interface SectionHeadingProps {
children?: React.ReactNode;
id: string;
slotName: string;
slotProps: object;
depth: number;
href?: string;
deprecated?: boolean;
pagePerSection?: boolean;
}
const SectionHeading: React.FunctionComponent<SectionHeadingProps> = ({
slotName,
slotProps,
children,
id,
href,
...rest
}) => {
return (
<SectionHeadingRenderer
toolbar={<Slot name={slotName} props={slotProps} />}
id={id}
href={href}
{...rest}
>
{children}
</SectionHeadingRenderer>
);
};
SectionHeading.propTypes = {
children: PropTypes.node,
id: PropTypes.string.isRequired,
slotName: PropTypes.string.isRequired,
slotProps: PropTypes.object.isRequired,
depth: PropTypes.number.isRequired,
deprecated: PropTypes.bool,
pagePerSection: PropTypes.bool,
};
export default SectionHeading;