Skip to content

Commit da3c86d

Browse files
astagisabato-galassosabato.galasso
authored
feat: use class sticky-top instead of react-stickup
Co-authored-by: sabato-galasso <[email protected]> Co-authored-by: sabato.galasso <[email protected]>
1 parent de04aac commit da3c86d

File tree

4 files changed

+7
-33
lines changed

4 files changed

+7
-33
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@
140140
"classnames": "^2.3.1",
141141
"is-number": "^7.0.0",
142142
"react-bootstrap": "^2.10.6",
143-
"react-stickup": "^1.12.1",
144143
"react-toastify": "^7.0.4",
145144
"react-transition-group": "^4.4.5",
146145
"reactstrap": "9.2.2",

src/Header/Headers.tsx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import React, { FC, HTMLAttributes } from 'react';
22
import classNames from 'classnames';
3-
import { Sticky, StickyProvider } from 'react-stickup';
4-
53
export interface HeadersProps extends HTMLAttributes<HTMLElement> {
64
/** Aggiunge un ombra per enfatizzare il componente rispetto alla pagina in cui è contenuto */
75
shadow?: boolean;
@@ -17,18 +15,11 @@ export const Headers: FC<HeadersProps> = ({ className, shadow = false, sticky =
1715
'it-header-wrapper',
1816
{
1917
'it-shadow': shadow,
20-
'it-header-sticky': sticky
18+
'it-header-sticky': sticky,
19+
'sticky-top': sticky
20+
2121
},
2222
className
2323
);
24-
if (!sticky) {
25-
return <div className={classes} {...attributes} data-testid={testId}></div>;
26-
}
27-
return (
28-
<StickyProvider>
29-
<Sticky style={{ position: 'sticky', zIndex: 2 }} data-testid={testId}>
30-
<div className={classes} {...attributes}></div>
31-
</Sticky>
32-
</StickyProvider>
33-
);
24+
return <div className={classes} {...attributes} data-testid={testId}></div>;
3425
};

stories/Components/Header/CompleteHeader.stories.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,9 @@ export const CompleteHeaderStory: Story = {
294294
theme: {
295295
control: 'radio',
296296
options: ['', 'light', 'dark']
297+
},
298+
sticky: {
299+
control: 'boolean'
297300
}
298301
}
299302
};

yarn.lock

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5836,11 +5836,6 @@ mdast-util-to-string@^4.0.0:
58365836
dependencies:
58375837
"@types/mdast" "^4.0.0"
58385838

5839-
memoize-one@^5.1.1:
5840-
version "5.2.1"
5841-
resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-5.2.1.tgz#8337aa3c4335581839ec01c3d594090cebe8f00e"
5842-
integrity sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q==
5843-
58445839
memoizerific@^1.11.3:
58455840
version "1.11.3"
58465841
resolved "https://registry.yarnpkg.com/memoizerific/-/memoizerific-1.11.3.tgz#7c87a4646444c32d75438570905f2dbd1b1a805a"
@@ -6882,13 +6877,6 @@ react-popper@^2.2.4:
68826877
react-fast-compare "^3.0.1"
68836878
warning "^4.0.2"
68846879

6885-
react-stickup@^1.12.1:
6886-
version "1.12.1"
6887-
resolved "https://registry.yarnpkg.com/react-stickup/-/react-stickup-1.12.1.tgz#35eed24c21fe9be52b4f56cb9b9830e134eb693f"
6888-
integrity sha512-YVLPzj/QlxuRLi4IMzCqU0OY9bol8TwPVCoXKpe4uQzOTazqa9s7TiELlBIjEUk+8sxc+cnZQd+7M09l8RrhHw==
6889-
dependencies:
6890-
react-viewport-utils "^1.12.1"
6891-
68926880
react-toastify@^7.0.4:
68936881
version "7.0.4"
68946882
resolved "https://registry.yarnpkg.com/react-toastify/-/react-toastify-7.0.4.tgz#7d0b743f2b96f65754264ca6eae31911a82378db"
@@ -6906,13 +6894,6 @@ react-transition-group@^4.4.2, react-transition-group@^4.4.5:
69066894
loose-envify "^1.4.0"
69076895
prop-types "^15.6.2"
69086896

6909-
react-viewport-utils@^1.12.1:
6910-
version "1.12.1"
6911-
resolved "https://registry.yarnpkg.com/react-viewport-utils/-/react-viewport-utils-1.12.1.tgz#7e2cf3f4818f96132d9327c1142a67704cbc5f69"
6912-
integrity sha512-sjj8rNIKSlzwhVf3mJJJl3Z+34ILFrMxCdP2jmzkAGtwXjdvKm2my9lZMV54oh837bUGx3k6XZlF/988Up3GZg==
6913-
dependencies:
6914-
memoize-one "^5.1.1"
6915-
69166897
"react@^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0":
69176898
version "19.0.0"
69186899
resolved "https://registry.yarnpkg.com/react/-/react-19.0.0.tgz#6e1969251b9f108870aa4bff37a0ce9ddfaaabdd"

0 commit comments

Comments
 (0)