UNPKG

1.19 kBJavaScriptView Raw
1import { __rest } from "tslib";
2import * as React from 'react';
3import styles from '@patternfly/react-styles/css/components/SkipToContent/skip-to-content';
4import buttonStyles from '@patternfly/react-styles/css/components/Button/button';
5import { css } from '@patternfly/react-styles';
6export class SkipToContent extends React.Component {
7 constructor() {
8 super(...arguments);
9 this.componentRef = React.createRef();
10 }
11 componentDidMount() {
12 if (this.props.show && this.componentRef.current) {
13 this.componentRef.current.focus();
14 }
15 }
16 render() {
17 // eslint-disable-next-line @typescript-eslint/no-unused-vars
18 const _a = this.props, { children, className, href, show, type } = _a, rest = __rest(_a, ["children", "className", "href", "show", "type"]);
19 return (React.createElement("a", Object.assign({}, rest, { className: css(buttonStyles.button, buttonStyles.modifiers.primary, styles.skipToContent, className), ref: this.componentRef, href: href }), children));
20 }
21}
22SkipToContent.displayName = 'SkipToContent';
23SkipToContent.defaultProps = {
24 show: false
25};
26//# sourceMappingURL=SkipToContent.js.map
\No newline at end of file