Skip to content

Commit 1566c25

Browse files
committed
Reformat with prettier
1 parent fd58cae commit 1566c25

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/index.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ function hashLinkScroll() {
3232
if (observer === null) {
3333
observer = new MutationObserver(getElAndScroll);
3434
}
35-
observer.observe(document, { attributes: true, childList: true, subtree: true });
35+
observer.observe(document, {
36+
attributes: true,
37+
childList: true,
38+
subtree: true,
39+
});
3640
// if the element doesn't show up in 10 seconds, stop checking
3741
asyncTimerId = window.setTimeout(() => {
3842
reset();
@@ -46,13 +50,23 @@ export function genericHashLink(props, As) {
4650
reset();
4751
if (props.onClick) props.onClick(e);
4852
if (typeof props.to === 'string') {
49-
hashFragment = props.to.split('#').slice(1).join('#');
50-
} else if (typeof props.to === 'object' && typeof props.to.hash === 'string') {
53+
hashFragment = props.to
54+
.split('#')
55+
.slice(1)
56+
.join('#');
57+
} else if (
58+
typeof props.to === 'object' &&
59+
typeof props.to.hash === 'string'
60+
) {
5161
hashFragment = props.to.hash.replace('#', '');
5262
}
5363
if (hashFragment !== '') hashLinkScroll();
5464
}
55-
return <As {...props} onClick={handleClick}>{props.children}</As>;
65+
return (
66+
<As {...props} onClick={handleClick}>
67+
{props.children}
68+
</As>
69+
);
5670
}
5771

5872
export function HashLink(props) {
@@ -66,10 +80,7 @@ export function NavHashLink(props) {
6680
const propTypes = {
6781
onClick: PropTypes.func,
6882
children: PropTypes.node,
69-
to: PropTypes.oneOfType([
70-
PropTypes.string,
71-
PropTypes.object,
72-
]),
83+
to: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
7384
};
7485

7586
HashLink.propTypes = propTypes;

0 commit comments

Comments
 (0)