Skip to content

Commit

Permalink
Merge pull request #442 from alvarotrigo/dev
Browse files Browse the repository at this point in the history
Merging dev branch 0.1.46
  • Loading branch information
alvarotrigo authored Dec 8, 2024
2 parents db7626a + 186e5b9 commit 2c643bc
Show file tree
Hide file tree
Showing 10 changed files with 26,997 additions and 29,602 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Quickstart Example:

```jsx
import React from 'react';
import ReactDOM from 'react-dom';
import ReactDOM from 'react-dom/client';
import ReactFullpage from '@fullpage/react-fullpage';

const Fullpage = () => (
Expand All @@ -117,14 +117,15 @@ const Fullpage = () => (
/>
);

ReactDOM.render(<Fullpage />, document.getElementById('react-root'));
const root = ReactDOM.createRoot(document.getElementById('react-root'));
root.render(<Fullpage />);
```

Fullpage.js Extension Example:

```jsx
import React from 'react';
import ReactDOM from 'react-dom';
import ReactDOM from 'react-dom/client';
import ReactFullpage from '@fullpage/react-fullpage';

// NOTE: if using fullpage extensions/plugins put them here and pass it as props
Expand Down Expand Up @@ -160,7 +161,8 @@ const Fullpage = () => (
/>
);

ReactDOM.render(<Fullpage />, document.getElementById('react-root'));
const root = ReactDOM.createRoot(document.getElementById('react-root'));
root.render(<Fullpage />);
```

Notice that when using any [fullPage.js extension](https://alvarotrigo.com/fullPage/extensions/) you'll pass the `pluginWrapper` function prop to include the file for those features before the `react-fullpage` component mounted.
Expand Down
8 changes: 4 additions & 4 deletions dist/react-fullpage-umd.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/react-fullpage.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"serve": "export SET NODE_OPTIONS=--openssl-legacy-provider && gatsby serve"
},
"dependencies": {
"@fullpage/react-fullpage": "^0.1.45",
"@fullpage/react-fullpage": "^0.1.46",
"gatsby": "^4.22.1",
"react": "^18.1.0",
"react-dom": "^18.1.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"author": "cmswalker",
"license": "GPL-3.0",
"dependencies": {
"@fullpage/react-fullpage": "^0.1.45",
"@fullpage/react-fullpage": "^0.1.46",
"next": "^12.1.6",
"react": "^18.1.0",
"react-dom": "^18.1.0"
Expand Down
56,422 changes: 26,904 additions & 29,518 deletions examples/react/dist/bundle.js

Large diffs are not rendered by default.

42 changes: 34 additions & 8 deletions examples/react/src/hooks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
import React, { useCallback, useState } from 'react';
import ReactDOM from 'react-dom/client';
import ReactFullpage from '../../../components';
import Styles from './styles.css';

Expand All @@ -15,12 +15,16 @@ const pluginWrapper = () => {

const
originalColors = ['#ff5f45', '#0798ec', '#fc6c7c', '#435b71', 'orange', 'blue', 'purple', 'yellow'],
originalPages = [{ text: "Section 1" }, { text: "Section 2" }, { text: "Section 3" }];
originalPages = [{ text: "Section 1" }],
originalSlides = [{ text: "Slide1" }, { text: "Slide2" }, { text: "Slide3" }];

const Hooks = () => {
console.warn("....");

const
[sectionsColor, setsectionsColor] = useState([...originalColors]),
[fullpages, setfullpages] = useState([...originalPages]);
[fullpages, setfullpages] = useState([...originalPages]),
[slides, setSlides] = useState([...originalSlides]);

const
onLeave = (origin, destination, direction) => {
Expand Down Expand Up @@ -52,9 +56,22 @@ const Hooks = () => {
return setfullpages(newPages)
},


moveSectionDown = () => {
return fullpage_api.moveSectionDown();
}
};

const handleRemoveSlide = useCallback(() => {
setSlides((prevSlides) => prevSlides.slice(0, -1));
}, [setSlides]);


const handleAddSlide = useCallback(() => {
setSlides((prevSlides) => [
...prevSlides,
{ text: `Slide${prevSlides.length + 1}` },
]);
}, [setSlides]);

const Menu = () => (
<div
Expand All @@ -68,7 +85,9 @@ const Hooks = () => {
<ul className="actions">
<li>
<button onClick={handleAddSection}> Add Section </button>
<button onClick={handleAddSlide}> Add Slide </button>
<button onClick={handleRemoveSection}> Remove Section </button>
<button onClick={handleRemoveSlide}> Remove Slide </button>
<button onClick={handleChangeColors}> Change background colors </button>
<button onClick={moveSectionDown}> Move Section Down </button>
</li>
Expand All @@ -92,12 +111,18 @@ const Hooks = () => {
sectionSelector={SECTION_SEL}
onLeave={onLeave}
sectionsColor={sectionsColor}
slidesNavigation ={true}
observer={false}

render={() => (
<ReactFullpage.Wrapper>
{fullpages.map(({ text }) => (
<div key={text} className={SEL}>
<h1>{text}</h1>
{slides.map(({ text }) => (
<div key={text} className="slide">
<h3>{text}</h3>
</div>
))}
</div>
))}
</ReactFullpage.Wrapper>
Expand All @@ -106,5 +131,6 @@ const Hooks = () => {
</div>
);
}
const rootElement = document.getElementById('react-root');
ReactDOM.render(<Hooks />, rootElement);

const root = ReactDOM.createRoot(document.getElementById('react-root'));
root.render(<Hooks />);
7 changes: 4 additions & 3 deletions examples/react/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import ReactDOM from 'react-dom/client';
import ReactFullpage from '../../../components';
import Styles from './styles.css';

Expand Down Expand Up @@ -144,5 +144,6 @@ class App extends React.Component {
}
}

const rootElement = document.getElementById('react-root');
ReactDOM.render(<App />, rootElement);

const root = ReactDOM.createRoot(document.getElementById('react-root'));
root.render(<App />);
90 changes: 35 additions & 55 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fullpage/react-fullpage",
"version": "0.1.45",
"version": "0.1.46",
"description": "Official react wrapper for fullPage.js",
"author": "cmswalker",
"contributors": [
Expand Down Expand Up @@ -55,8 +55,8 @@
"node-sass": "6.0.1",
"prettier": "^2.3.2",
"prettier-eslint": "^13.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-testing-library": "^5.4.4",
"sass-loader": "12.1.0",
"style-loader": "3.2.1",
Expand All @@ -68,6 +68,6 @@
},
"dependencies": {
"@babel/polyfill": "^7.2.5",
"fullpage.js": "^4.0.30"
"fullpage.js": "^4.0.31"
}
}

0 comments on commit 2c643bc

Please sign in to comment.