├── nextjs-example
├── components
│ ├── select
│ │ ├── select.scss
│ │ └── select.js
│ ├── page
│ │ ├── page.js
│ │ └── page.css
│ ├── background
│ │ ├── background.js
│ │ └── background.scss
│ ├── section
│ │ ├── section.css
│ │ └── section.js
│ ├── layout
│ │ ├── layout.js
│ │ └── layout.scss
│ ├── react-logo
│ │ ├── react-logo.js
│ │ └── react-logo.scss
│ ├── startup
│ │ ├── startup.js
│ │ └── startup.scss
│ ├── lettering
│ │ ├── lettering.css
│ │ └── lettering.js
│ ├── mouse
│ │ ├── mouse.js
│ │ └── mouse.scss
│ ├── fullpage
│ │ ├── fullpage.css
│ │ ├── fullpage.js
│ │ └── media.js
│ ├── nav
│ │ ├── nav.js
│ │ └── nav.scss
│ └── content
│ │ ├── content.js
│ │ └── content.scss
├── public
│ └── favicon.ico
├── static
│ └── favicon.ico
├── next.config.js
├── pages
│ ├── index.js
│ ├── page-two.js
│ ├── page-three.js
│ └── _app.js
├── .gitignore
└── package.json
├── .gitignore
└── README.md
/nextjs-example/components/select/select.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/nextjs-example/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rcaferati/ras-fullpage-strategies/HEAD/nextjs-example/public/favicon.ico
--------------------------------------------------------------------------------
/nextjs-example/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rcaferati/ras-fullpage-strategies/HEAD/nextjs-example/static/favicon.ico
--------------------------------------------------------------------------------
/nextjs-example/next.config.js:
--------------------------------------------------------------------------------
1 | const withCSS = require('@zeit/next-css');
2 | const withSass = require('@zeit/next-sass');
3 |
4 | module.exports = withCSS(withSass({}));
5 |
--------------------------------------------------------------------------------
/nextjs-example/components/page/page.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './page.css';
3 |
4 | const Page = ({ children }) => {
5 | return
{children}
;
6 | };
7 |
8 | export default Page;
9 |
--------------------------------------------------------------------------------
/nextjs-example/pages/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import FullpageSlider from "../components/fullpage/fullpage";
3 |
4 | const Home = () => {
5 | return ;
6 | };
7 |
8 | export default Home;
9 |
--------------------------------------------------------------------------------
/nextjs-example/pages/page-two.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import FullpageSlider from "../components/fullpage/fullpage";
3 |
4 | const PageTwo = () => {
5 | return ;
6 | };
7 |
8 | export default PageTwo;
9 |
--------------------------------------------------------------------------------
/nextjs-example/pages/page-three.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import FullpageSlider from "../components/fullpage/fullpage";
3 |
4 | const PageThree = () => {
5 | return ;
6 | };
7 |
8 | export default PageThree;
9 |
--------------------------------------------------------------------------------
/nextjs-example/components/background/background.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './background.scss';
3 |
4 | const Background = ({ src, alt = 'background' }) => {
5 | return ;
6 | };
7 |
8 | export default Background;
9 |
--------------------------------------------------------------------------------
/nextjs-example/components/section/section.css:
--------------------------------------------------------------------------------
1 | .section {
2 | display: flex;
3 | align-items: center;
4 | justify-content: center;
5 | min-height: 100vh;
6 | width: 100vw;
7 | position: relative;
8 | }
9 |
10 | .awssld--fill-parent {
11 | height: 100vh !important;
12 | }
13 |
--------------------------------------------------------------------------------
/nextjs-example/components/background/background.scss:
--------------------------------------------------------------------------------
1 | .background {
2 | display: block;
3 | position: absolute;
4 | top: 0;
5 | left: 0;
6 | width: 100%;
7 | height: 100%;
8 | object-fit: cover;
9 | z-index: 0;
10 | filter: grayscale(100%) opacity(35%);
11 | mix-blend-mode: multiply;
12 | }
13 |
--------------------------------------------------------------------------------
/nextjs-example/components/layout/layout.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import "./layout.scss";
3 | import Nav from "../nav/nav";
4 |
5 | const Layout = ({ children }) => {
6 | return (
7 | <>
8 |
9 | {children}
10 | >
11 | );
12 | };
13 |
14 | export default Layout;
15 |
--------------------------------------------------------------------------------
/nextjs-example/components/react-logo/react-logo.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './react-logo.scss';
3 |
4 | const ReactLogo = () => {
5 | return (
6 |
7 |
8 |
9 |
10 |
11 | );
12 | };
13 |
14 | export default ReactLogo;
15 |
--------------------------------------------------------------------------------
/nextjs-example/components/startup/startup.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactLogo from '../react-logo/react-logo';
3 | import './startup.scss';
4 |
5 | const Startup = () => {
6 | return (
7 |
8 |
9 |
10 | );
11 | };
12 |
13 | export default Startup;
14 |
--------------------------------------------------------------------------------
/nextjs-example/components/startup/startup.scss:
--------------------------------------------------------------------------------
1 | .startup {
2 | display: flex;
3 | align-items: center;
4 | justify-content: center;
5 | position: absolute;
6 | top: 0;
7 | left: 0;
8 | width: 100%;
9 | height: 100%;
10 | background-color: #20232a;
11 | z-index: 1001;
12 |
13 | .logo-container {
14 | --size: 164px;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/nextjs-example/components/lettering/lettering.css:
--------------------------------------------------------------------------------
1 | .lettering {
2 | color: #fff;
3 | font-family: monospace;
4 | text-align: center;
5 | position: relative;
6 | }
7 |
8 | .lettering h1 {
9 | font-size: 32px;
10 | line-height: 40px;
11 | margin-bottom: 24px;
12 | }
13 |
14 | .lettering p {
15 | font-size: 16px;
16 | line-height: 24px;
17 | margin-bottom: 8px;
18 | }
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | .env*
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
--------------------------------------------------------------------------------
/nextjs-example/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | .env*
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
--------------------------------------------------------------------------------
/nextjs-example/components/section/section.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './section.css';
3 |
4 | const Section = ({ children, wrapper = true, backgroundColor = '#FFFFFF' }) => {
5 | return (
6 |
7 | {wrapper ? {children}
: children}
8 |
9 | );
10 | };
11 |
12 | export default Section;
13 |
--------------------------------------------------------------------------------
/nextjs-example/components/mouse/mouse.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './mouse.scss';
3 |
4 | const Mouse = ({ visible = true }) => {
5 | const className = ['scroll'];
6 |
7 | if (visible === false) {
8 | className.push('hidden');
9 | }
10 | return (
11 |
12 |
13 |
14 | );
15 | };
16 |
17 | export default Mouse;
18 |
--------------------------------------------------------------------------------
/nextjs-example/components/lettering/lettering.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './lettering.css';
3 |
4 | const Lettering = ({ text = [], title = '' }) => {
5 | const renderText = () => {
6 | return text && text.length
7 | ? text.map((line, index) => {
8 | return {line}
;
9 | })
10 | : null;
11 | };
12 |
13 | return (
14 |
15 |
{title}
16 | {renderText()}
17 |
18 | );
19 | };
20 |
21 | export default Lettering;
22 |
--------------------------------------------------------------------------------
/nextjs-example/components/fullpage/fullpage.css:
--------------------------------------------------------------------------------
1 | .awesome-slider {
2 | --organic-arrow-color: #fff;
3 | }
4 |
5 | .sectioned {
6 | display: block;
7 | overflow: scroll;
8 | }
9 |
10 | .slide {
11 | display: flex;
12 | align-items: center;
13 | justify-content: center;
14 | position: absolute;
15 | min-height: 100%;
16 | width: 100%;
17 | background-color: teal;
18 | }
19 |
20 | .awssld__content > img {
21 | filter: grayscale(100%) opacity(35%);
22 | mix-blend-mode: multiply;
23 | }
24 |
25 | .button {
26 | font-family: monospace;
27 | text-align: center;
28 | color: #fff;
29 | }
30 |
--------------------------------------------------------------------------------
/nextjs-example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nextjs-example",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "export": "next export",
10 | "deploy": "npm run build && npm run export"
11 | },
12 | "dependencies": {
13 | "@zeit/next-css": "^1.0.1",
14 | "@zeit/next-sass": "^1.0.1",
15 | "next": "9.1.7",
16 | "node-sass": "^4.13.0",
17 | "react": "16.12.0",
18 | "react-awesome-slider": "^3.1.0",
19 | "react-awesome-button": "^6.4.0",
20 | "react-dom": "16.12.0"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/nextjs-example/components/select/select.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './select.scss';
3 |
4 | const Select = ({ options = [], onChange, selected }) => {
5 | const renderOptions = () => {
6 | return options.map(({ value, label }) => {
7 | return (
8 |
9 | {label}
10 |
11 | );
12 | });
13 | };
14 |
15 | return (
16 | {
19 | onChange(event.currentTarget.value);
20 | }}
21 | >
22 | {renderOptions()}
23 |
24 | );
25 | };
26 |
27 | export default Select;
28 |
--------------------------------------------------------------------------------
/nextjs-example/components/page/page.css:
--------------------------------------------------------------------------------
1 | .page {
2 | display: block;
3 | width: 100vw;
4 | height: 100vh;
5 | overflow-x: hidden;
6 | overflow-y: scroll;
7 | -webkit-overflow-scrolling: touch;
8 | -ms-overflow-style: -ms-autohiding-scrollbar;
9 | scrollbar-width: thin;
10 | scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
11 | background-color: transparent;
12 | }
13 |
14 | .page::-webkit-scrollbar {
15 | height: 20px;
16 | width: 6px;
17 | }
18 | .page::-webkit-scrollbar-track {
19 | background-color: rgba(0, 0, 0, 0.05);
20 | }
21 | .page::-webkit-scrollbar-thumb {
22 | background-color: rgba(0, 0, 0, 0.1);
23 | /* Add :hover, :active as needed */
24 | }
25 | .page::-webkit-scrollbar-thumb:vertical {
26 | min-height: purple;
27 | }
28 | .page::-webkit-scrollbar-thumb:horizontal {
29 | min-width: 20px;
30 | }
31 |
--------------------------------------------------------------------------------
/nextjs-example/pages/_app.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Provider } from "react-awesome-slider/dist/navigation";
3 | import Layout from "../components/layout/layout";
4 | import { useRouter } from "next/router";
5 | import Head from "next/head";
6 |
7 | function App({ Component, pageProps }) {
8 | const router = useRouter();
9 |
10 | return (
11 |
12 |
13 |
14 | Fullpage Javascript Navigation HOC with React Awesome Slider
15 |
16 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | );
31 | }
32 |
33 | export default App;
34 |
--------------------------------------------------------------------------------
/nextjs-example/components/fullpage/fullpage.js:
--------------------------------------------------------------------------------
1 | import React, { useRef } from "react";
2 | import AwesomeSlider from "react-awesome-slider";
3 | import "react-awesome-slider/dist/custom-animations/cube-animation.css";
4 | import "react-awesome-slider/dist/custom-animations/fall-animation.css";
5 | import "react-awesome-slider/dist/custom-animations/fold-out-animation.css";
6 | import "react-awesome-slider/dist/custom-animations/scale-out-animation.css";
7 | import "react-awesome-slider/dist/custom-animations/open-animation.css";
8 | import {
9 | withNavigationHandlers,
10 | withNavigationContext
11 | } from "react-awesome-slider/dist/navigation";
12 | import { media } from "./media";
13 | import Startup from "../startup/startup";
14 |
15 | const Slider = withNavigationHandlers(AwesomeSlider);
16 |
17 | export default withNavigationContext(({ fullpage }) => {
18 | const isFirstLoad = useRef(true);
19 | const animation = fullpage.navigation.animation || `foldOutAnimation`;
20 |
21 | return (
22 | }
24 | startupDelay={275}
25 | animation={animation}
26 | className="awesome-slider"
27 | onTransitionEnd={() => {
28 | // HANDLE THE PAGE ELEMENTS ANIMATION ON FIRST TRANSITION END
29 | if (isFirstLoad.current === true) {
30 | document.querySelector("body").classList.add("animated");
31 | document.querySelector("body").classList.add("visible");
32 | }
33 | }}
34 | media={media}
35 | />
36 | );
37 | });
38 |
--------------------------------------------------------------------------------
/nextjs-example/components/nav/nav.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import {
3 | withNavigationContext,
4 | Link
5 | } from "react-awesome-slider/dist/navigation";
6 | import ReactLogo from "../react-logo/react-logo";
7 | import "./nav.scss";
8 |
9 | const Nav = withNavigationContext(({ fullpage }) => {
10 | const { slug } = fullpage.navigation;
11 |
12 | return (
13 |
14 |
15 |
16 |
17 |
18 |
19 | REACT
20 | AWESOME SLIDER
21 |
22 |
FULL-PAGE TRANSITION STRATEGY
23 |
24 | Built with {`<3`} by{" "}
25 |
26 | @rcaferati
27 |
28 |
29 |
30 |
31 |
32 |
33 | index
34 |
35 |
39 | page-two
40 |
41 |
45 | page-three
46 |
47 |
48 |
49 |
50 | );
51 | });
52 |
53 | export default Nav;
54 |
--------------------------------------------------------------------------------
/nextjs-example/components/layout/layout.scss:
--------------------------------------------------------------------------------
1 | @import url("https://fonts.googleapis.com/css?family=Montserrat:400,500,700&display=swap");
2 |
3 | /* Box sizing rules */
4 | *,
5 | *::before,
6 | *::after {
7 | box-sizing: border-box;
8 | }
9 |
10 | /* Remove default padding */
11 | ul[class],
12 | ol[class] {
13 | padding: 0;
14 | }
15 |
16 | /* Remove default margin */
17 | body,
18 | h1,
19 | h2,
20 | h3,
21 | h4,
22 | p,
23 | ul[class],
24 | ol[class],
25 | li,
26 | figure,
27 | figcaption,
28 | blockquote,
29 | dl,
30 | dd {
31 | margin: 0;
32 | }
33 |
34 | /* Set core body defaults */
35 | body {
36 | min-height: 100vh;
37 | scroll-behavior: smooth;
38 | text-rendering: optimizeSpeed;
39 | line-height: 1.5;
40 | background-color: #202020;
41 | }
42 |
43 | /* Remove list styles on ul, ol elements with a class attribute */
44 | ul[class],
45 | ol[class] {
46 | list-style: none;
47 | }
48 |
49 | /* A elements that don't have a class get default styles */
50 | a:not([class]) {
51 | text-decoration-skip-ink: auto;
52 | }
53 |
54 | /* Make images easier to work with */
55 | img {
56 | max-width: 100%;
57 | display: block;
58 | }
59 |
60 | /* Natural flow and rhythm in articles by default */
61 | article > * + * {
62 | margin-top: 1em;
63 | }
64 |
65 | /* Inherit fonts for inputs and buttons */
66 | input,
67 | button,
68 | textarea,
69 | select {
70 | font: inherit;
71 | }
72 |
73 | /* Remove all animations and transitions for people that prefer not to see them */
74 | @media (prefers-reduced-motion: reduce) {
75 | * {
76 | animation-duration: 0.01ms !important;
77 | animation-iteration-count: 1 !important;
78 | transition-duration: 0.01ms !important;
79 | scroll-behavior: auto !important;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/nextjs-example/components/react-logo/react-logo.scss:
--------------------------------------------------------------------------------
1 | $size: 72px;
2 | $speed: 2;
3 | $color-primary: #61dafb;
4 | $total: 3;
5 | $angle: 66deg;
6 |
7 | %path {
8 | border-radius: 50%;
9 | bottom: 0;
10 | left: 0;
11 | margin: auto;
12 | position: absolute;
13 | right: 0;
14 | top: 0;
15 | }
16 |
17 | .logo-container {
18 | --size: #{$size};
19 | --ellipse: calc(var(--size) / 2);
20 | --circle: calc(var(--ellipse) / 10);
21 | --border: calc(var(--size) / 16);
22 | --speed: #{$speed};
23 | --background: #{$color-primary};
24 | --angle: #{$angle};
25 |
26 | display: block;
27 | height: var(--size);
28 | position: relative;
29 | transform: rotate(180deg);
30 | width: var(--size);
31 | z-index: 1000;
32 |
33 | &:before {
34 | content: ' ';
35 | background-color: var(--background);
36 | border-radius: calc(var(--size) / 12);
37 | display: block;
38 | height: calc(var(--size) / 6);
39 | left: calc(50% - (var(--size) / 12));
40 | position: absolute;
41 | top: calc(50% - (var(--size) / 12));
42 | width: calc(var(--size) / 6);
43 | z-index: 1;
44 | }
45 |
46 | > span {
47 | @extend %path;
48 | width: calc(var(--ellipse) * 2);
49 | height: calc(var(--ellipse) * 2);
50 | border: var(--border) var(--background) solid;
51 | transform-style: preserve-3d;
52 | &:before {
53 | @extend %path;
54 | content: ' ';
55 | width: calc(var(--circle) * 2);
56 | height: calc(var(--circle) * 2);
57 | animation: path linear infinite;
58 | background: var(--background);
59 | display: block;
60 | }
61 |
62 | @for $i from 1 through $total {
63 | &:nth-child(#{$i}) {
64 | transform: rotateZ($i * 180deg / $total) rotateY(var(--angle));
65 |
66 | &:before {
67 | animation-duration: #{$speed * $i * 0.5}s;
68 | }
69 | }
70 | }
71 | }
72 | }
73 |
74 | @keyframes path {
75 | from {
76 | transform: rotateZ(0) translateX(var(--ellipse)) rotateZ(0)
77 | rotateY(var(--angle));
78 | }
79 | to {
80 | transform: rotateZ(360deg) translateX(var(--ellipse)) rotateZ(-360deg)
81 | rotateY(var(--angle));
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/nextjs-example/components/content/content.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withNavigationContext } from "react-awesome-slider/dist/navigation";
3 | import Select from "../select/select";
4 | import "./content.scss";
5 |
6 | const options = [
7 | {
8 | label: "Cube Animation",
9 | value: "cubeAnimation"
10 | },
11 | {
12 | label: "Fall Animation",
13 | value: "fallAnimation"
14 | },
15 | {
16 | label: "Fold Out Animation",
17 | value: "foldOutAnimation"
18 | },
19 | {
20 | label: "Open Animation",
21 | value: "openAnimation"
22 | },
23 | {
24 | label: "Scale Out Animation",
25 | value: "scaleOutAnimation"
26 | }
27 | ];
28 |
29 | const Content = withNavigationContext(({ fullpage, main, action }) => {
30 | return (
31 |
32 |
{main}
33 |
34 |
35 | {
38 | fullpage.navigate({
39 | ...fullpage.navigation,
40 | animation: value
41 | });
42 | }}
43 | options={options}
44 | />
45 |
46 |
{action}
47 |
62 |
63 |
64 | );
65 | });
66 |
67 | export default Content;
68 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # React Awesome Slider Navigation HOC strategies
2 | React awesome slider fullpage strategies and usage examples. For more information about the slider itself please access the main repository at [rcaferati/react-awesome-slider](https://github.com/rcaferati/ras-fullpage-strategies)
3 |
4 | ## Live preview
5 | Access the live preview at: [fullpage.caferati.me](https://fullpage.caferati.me)
6 |
7 |
8 | [ ](https://fullpage.caferati.me/)
9 |
10 | ## Implementation
11 |
12 | The `Navigation` HOC exposes a number of methods for dealing with fullpage navigation. The code bellow is a basic concept example, if you want a functional one just check out the [NextJS example folder](https://github.com/rcaferati/ras-fullpage-strategies/tree/master/nextjs-example).
13 |
14 | | Method | Type | Description |
15 | | :---------------------- | :----------------------- | :-------------------------------------------------------------------------------- |
16 | | Provider | `Context Provider` | A context provider component for the application to be wrapped in. |
17 | | withNavigationContext | `Context Consumer` | A navigation context consumer for accessing the navigation object as a prop. |
18 | | withNavigationHandlers | `Navigation Handlers` | A HOC to add the navigation handlers to your AwesomeSlider instance. |
19 | | Link | `Link Component` | A Link component for handling page linking. |
20 |
21 | ```JS
22 | import AwesomeSlider from "react-awesome-slider"
23 | import 'react-awesome-slider/dist/styles.css';
24 |
25 | import {
26 | Provider,
27 | Link,
28 | withNavigationContext,
29 | withNavigationHandlers
30 | } from "react-awesome-slider/dist/navigation";
31 |
32 | // Wrapp the AwesomeSlider component with the navigationHandlers
33 | const NavigationSlider = withNavigationHandlers(AwesomeSlider);
34 |
35 | // Create an AwesomeSlider instance with some content
36 | const Slider = () => {
37 | return (
38 | Page One
45 | },
46 | {
47 | slug: "page-two",
48 | className: "page-two",
49 | children: () => Page Two
50 | }
51 | ]}
52 | />
53 | )
54 | }
55 |
56 | // Page header navigation
57 | const Header = () => {
58 | return (
59 |
60 |
61 | Page One
62 | Page Two
63 |
64 |
65 | )
66 | }
67 |
68 | // Wrapp the aplication with the navigation Provider passing down the current page slug.
69 | const App = () => {
70 | const slug = "[THE INITIAL RENDERED SLUG]";
71 |
72 | return (
73 |
74 |
75 |
76 |
77 | )
78 | }
79 |
80 | ```
81 |
--------------------------------------------------------------------------------
/nextjs-example/components/content/content.scss:
--------------------------------------------------------------------------------
1 | .content {
2 | width: 100%;
3 | height: 100%;
4 | position: absolute;
5 | top: 0;
6 | left: 0;
7 |
8 | @media all and (max-width: 768px) {
9 | .content__main {
10 | padding: 0 12%;
11 | }
12 |
13 | .content__action {
14 | flex-direction: column;
15 | align-items: center;
16 | margin-bottom: 20px;
17 |
18 | > div:nth-child(1) {
19 | margin-bottom: 16px;
20 | }
21 | > div:nth-child(2) {
22 | margin-bottom: 16px;
23 | }
24 |
25 | // select {
26 | // width: auto;
27 | // }
28 | }
29 | }
30 | }
31 |
32 | .content__main {
33 | height: 100vh;
34 | width: 100%;
35 | display: flex;
36 | align-items: center;
37 | justify-content: center;
38 | // background-color: blue;
39 | }
40 |
41 | .content__action {
42 | // background-color: red;
43 | margin-bottom: 56px;
44 | display: flex;
45 | align-items: flex-start;
46 | justify-content: center;
47 | position: absolute;
48 | bottom: 0;
49 | left: 0;
50 | width: 100%;
51 | }
52 |
53 | .content__action {
54 | display: flex;
55 | justify-content: space-around;
56 | padding: 24px 10%;
57 |
58 | > div {
59 | flex: 1;
60 | text-align: center;
61 | }
62 | > div:nth-child(1) {
63 | text-align: left;
64 | }
65 | > div:nth-child(3) {
66 | text-align: right;
67 | }
68 | }
69 |
70 | .content__action__go {
71 | display: flex;
72 | align-items: center;
73 | justify-content: center;
74 | }
75 |
76 | .content__action__github {
77 | a {
78 | font-family: Montserrat, tahoma, verdana, sans-serif;
79 | color: #fff;
80 | display: inline-block;
81 | padding: 10px 16px;
82 | font-weight: bold;
83 | font-size: 12px;
84 | text-decoration: none;
85 | background-color: rgba(0, 0, 0, 0.05);
86 | }
87 | svg {
88 | width: 20px;
89 | vertical-align: text-bottom;
90 | margin-bottom: -2px;
91 | margin-right: 6px;
92 | }
93 | }
94 |
95 | .content__action__select {
96 | select {
97 | width: 180px;
98 | background: none;
99 | border: none;
100 | -webkit-appearance: none;
101 | -moz-appearance: none;
102 | appearance: none;
103 | outline: 0;
104 | background-color: rgba(0, 0, 0, 0.05);
105 | padding: 10px;
106 | color: #fff;
107 | font-family: Montserrat, tahoma, verdana, sans-serif;
108 | font-size: 12px;
109 | font-weight: bold;
110 | background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgaWQ9ItCh0LvQvtC5XzEiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDEzOSAxMzk7IiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAxMzkgMTM5IiB4bWw6c3BhY2U9InByZXNlcnZlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj48c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtmaWxsOm5vbmU7c3Ryb2tlOiNGRkY7c3Ryb2tlLXdpZHRoOjY7c3Ryb2tlLW1pdGVybGltaXQ6MTA7fQo8L3N0eWxlPjxsaW5lIGNsYXNzPSJzdDAiIGlkPSJYTUxJRF83XyIgeDE9IjE4IiB4Mj0iMTIxIiB5MT0iMzQuOCIgeTI9IjM0LjgiLz48bGluZSBjbGFzcz0ic3QwIiBpZD0iWE1MSURfOF8iIHgxPSI5NS4yIiB4Mj0iMTgiIHkxPSI2OS41IiB5Mj0iNjkuNSIvPjxsaW5lIGNsYXNzPSJzdDAiIGlkPSJYTUxJRF85XyIgeDE9IjY5LjUiIHgyPSIxOCIgeTE9IjEwNC4yIiB5Mj0iMTA0LjIiLz48L3N2Zz4=");
111 | background-size: 20px 20px;
112 | background-repeat: no-repeat;
113 | background-position: calc(100% - 5px) 50%;
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/nextjs-example/components/fullpage/media.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { AwesomeButton } from "react-awesome-button";
3 | import "react-awesome-button/dist/themes/theme-c137.css";
4 | import { withNavigationContext } from "react-awesome-slider/dist/navigation";
5 | import Lettering from "../lettering/lettering";
6 | import Background from "../background/background";
7 | import Content from "../content/content";
8 | import Mouse from "../mouse/mouse";
9 | import Section from "../section/section";
10 | import Page from "../page/page";
11 | import "./fullpage.css";
12 |
13 | export const Home = withNavigationContext(({ fullpage }) => {
14 | return (
15 |
16 |
25 | }
26 | action={
27 |
28 |
{
31 | fullpage.navigate("/page-two");
32 | }}
33 | >
34 | Goto the next page
35 |
36 |
37 | }
38 | />
39 |
40 | );
41 | });
42 |
43 | export const Third = withNavigationContext(({ fullpage }) => {
44 | return (
45 |
46 |
47 |
53 | }
54 | action={
55 |
56 |
{
59 | fullpage.navigate("/page-two");
60 | }}
61 | >
62 | Goto the prev page
63 |
64 |
65 | }
66 | />
67 |
68 | );
69 | });
70 |
71 | export const media = [
72 | {
73 | slug: "",
74 | className: "slide page-one",
75 | children:
76 | },
77 | {
78 | slug: "page-two",
79 | className: "sectioned page-two",
80 | children: (
81 |
82 |
83 |
91 | }
92 | action={ }
93 | />
94 |
95 |
101 |
102 | )
103 | },
104 | {
105 | slug: "page-three",
106 | preload: ["https://caferati.me/images/series/bojack-0.png"],
107 | className: "slide page-three",
108 | children:
109 | }
110 | ];
111 |
--------------------------------------------------------------------------------
/nextjs-example/components/nav/nav.scss:
--------------------------------------------------------------------------------
1 | .page-header {
2 | position: fixed;
3 | top: 0;
4 | left: 0;
5 | z-index: 101;
6 | width: 100%;
7 | }
8 |
9 | .page-header nav {
10 | display: block;
11 | }
12 |
13 | .page-header nav a {
14 | margin-left: 16px;
15 | padding: 8px 16px;
16 | border-radius: 4px;
17 | font-size: 16px;
18 | line-height: 22px;
19 | font-weight: bold;
20 | text-decoration: none;
21 | color: white;
22 | font-family: Montserrat, tahoma, verdana, sans-serif;
23 |
24 | &:first-child {
25 | margin-left: 0;
26 | }
27 | }
28 |
29 | .page-header__wrapper {
30 | display: flex;
31 | justify-content: space-between;
32 | width: 100%;
33 | margin: 0 auto;
34 | padding: 32px 10%;
35 | align-items: center;
36 |
37 | @media all and (max-width: 768px) {
38 | flex-direction: column;
39 | align-items: flex-start;
40 | padding: 12px 24px;
41 |
42 | nav {
43 | margin-top: 24px;
44 | display: flex;
45 | width: 100%;
46 | align-items: center;
47 | justify-content: center;
48 |
49 | a {
50 | background-color: rgba(0, 0, 0, 0.05);
51 | margin-left: 10px;
52 | padding: 6px 12px;
53 | font-size: 14px;
54 | line-height: 18px;
55 | }
56 | }
57 |
58 | .page-header__title h1 {
59 | font-size: 20px;
60 | line-height: 28px;
61 | }
62 |
63 | .logo-container {
64 | --size: 64px;
65 | }
66 | }
67 | @media all and (max-width: 475px) {
68 | padding: 20px;
69 |
70 | .page-header__title h1 {
71 | font-size: 18px;
72 | line-height: 24px;
73 | }
74 | .page-header__title h2 {
75 | font-size: 12px;
76 | line-height: 18px;
77 | }
78 | }
79 | }
80 |
81 | .page-header small {
82 | font-size: 8px;
83 | text-transform: uppercase;
84 | font-family: Montserrat, tahoma, verdana, sans-serif;
85 | color: #fff;
86 | }
87 |
88 | .page-header small a {
89 | color: #fff;
90 | font-weight: bold;
91 | }
92 |
93 | .page-header__wrapper > :nth-child(1),
94 | .page-header__wrapper > :nth-child(2) {
95 | transform: translateY(-175px);
96 | }
97 |
98 | .animated .page-header__wrapper > :nth-child(1),
99 | .animated .page-header__wrapper > :nth-child(2) {
100 | transition: transform 335ms cubic-bezier(0.05, 0.55, 0.15, 1);
101 | }
102 |
103 | .animated .page-header__wrapper > :nth-child(2) {
104 | transition-delay: 0.125s;
105 | }
106 |
107 | .page-header__title {
108 | display: flex;
109 | align-items: center;
110 | }
111 |
112 | .page-header__title h1 {
113 | font-size: 24px;
114 | line-height: 32px;
115 | color: #fff;
116 | font-family: Montserrat, tahoma, verdana, sans-serif;
117 | display: block;
118 | }
119 |
120 | .page-header__title h2 {
121 | color: #fff;
122 | font-family: Montserrat, tahoma, verdana, sans-serif;
123 | display: block;
124 | font-size: 14px;
125 | display: block;
126 | }
127 |
128 | .page-header__title > div {
129 | margin-left: 8px;
130 | }
131 |
132 | .page-header__title h1 span {
133 | color: #fff;
134 | font-family: Montserrat, tahoma, verdana, sans-serif;
135 | display: inline-block;
136 | }
137 | .page-header__title h1 span:first-child {
138 | margin-right: 10px;
139 | color: #61dafb;
140 | }
141 |
142 | .page-header a.selected {
143 | background-color: rgba(0, 0, 0, 0.1);
144 | }
145 |
146 | .page-header a:active {
147 | background-color: rgba(0, 0, 0, 0.05);
148 | }
149 |
150 | .visible .page-header__wrapper > :nth-child(1),
151 | .visible .page-header__wrapper > :nth-child(2) {
152 | transform: translateY(0);
153 | }
154 |
--------------------------------------------------------------------------------
/nextjs-example/components/mouse/mouse.scss:
--------------------------------------------------------------------------------
1 | $size: 0.9;
2 | $color: rgba(255, 255, 255, 0.75);
3 | $opacity: 1;
4 |
5 | .scroll {
6 | --size: #{$size};
7 | --color: #{$color};
8 | --opacity: #{$opacity};
9 | --width: calc(26px * var(--size));
10 | --height: calc(var(--width) * 2);
11 | --ballSize: calc(var(--width) / 4);
12 |
13 | border: none;
14 | display: block;
15 | background: transparent;
16 | cursor: default;
17 | opacity: var(--opacity);
18 | z-index: 1001;
19 | transition: opacity 0.165s ease-out, transform 0.165s ease-out;
20 | position: relative;
21 |
22 | &.hidden {
23 | transform: translate3d(0, 25px, 0);
24 | opacity: 0;
25 | }
26 |
27 | span {
28 | display: block;
29 | width: var(--width);
30 | height: var(--height);
31 | border: calc(2px * var(--size)) solid var(--color);
32 | border-radius: calc(var(--width) / 2);
33 |
34 | &:before {
35 | content: ' ';
36 | width: var(--ballSize);
37 | height: var(--ballSize);
38 | border-radius: 50%;
39 | background-color: var(--color);
40 | position: absolute;
41 | top: calc(var(--height) * 0.1);
42 | left: calc(50% - var(--ballSize) / 2);
43 | animation: scroll 1s infinite;
44 | }
45 |
46 | &:after {
47 | content: 'DETALHES';
48 | position: absolute;
49 | display: none;
50 | color: var(--color);
51 | font-family: 'Source Code Pro', monospace;
52 | bottom: calc(-24px * var(--size));
53 | line-height: calc(20px * var(--size));
54 | font-size: calc(12px * var(--size));
55 | left: calc(50% - calc(72px * var(--size)) / 2);
56 | width: calc(72px * var(--size));
57 | text-align: center;
58 | padding-top: calc(12px * var(--size));
59 | }
60 | }
61 |
62 | @media all and (max-width: 3080px) {
63 | --size: 1;
64 | --width: calc(26px * var(--size));
65 | --height: calc(var(--width) * 2);
66 | }
67 |
68 | @media all and (max-width: 1440px) {
69 | --size: 0.9;
70 | --width: calc(26px * var(--size));
71 | --height: calc(var(--width) * 2);
72 | }
73 | @media all and (max-width: 1268px) {
74 | --size: 0.8;
75 | --width: calc(26px * var(--size));
76 | --height: calc(var(--width) * 2);
77 | }
78 | @media all and (max-width: 1120px) {
79 | --size: 0.75;
80 | --width: calc(26px * var(--size));
81 | --height: calc(var(--width) * 2);
82 | }
83 | @media all and (max-width: 1070px) {
84 | --size: 0.7;
85 | --width: calc(26px * var(--size));
86 | --height: calc(var(--width) * 2);
87 | }
88 | @media all and (max-width: 980px) {
89 | --size: 0.6;
90 | --width: calc(26px * var(--size));
91 | --height: calc(var(--width) * 2);
92 | }
93 | @media all and (max-width: 840px) {
94 | --size: 0.5;
95 | --width: calc(26px * var(--size));
96 | --height: calc(var(--width) * 2);
97 | }
98 | @media all and (max-width: 715px) {
99 | --size: 0.4;
100 | --width: calc(26px * var(--size));
101 | --height: calc(var(--width) * 2);
102 | }
103 |
104 | @media all and (max-width: 570px) {
105 | --size: 0.35;
106 | --width: calc(26px * var(--size));
107 | --height: calc(var(--width) * 2);
108 | }
109 |
110 | @media all and (max-width: 468px) {
111 | --size: 0.5;
112 | --width: calc(26px * var(--size));
113 | --height: calc(var(--width) * 2);
114 | }
115 |
116 | @media all and (max-width: 450px) {
117 | --size: 0.45;
118 | --width: calc(26px * var(--size));
119 | --height: calc(var(--width) * 2);
120 | }
121 |
122 | @media all and (max-width: 410px) {
123 | --size: 0.4;
124 | --width: calc(26px * var(--size));
125 | --height: calc(var(--width) * 2);
126 | }
127 |
128 | @media all and (max-width: 365px) {
129 | --size: 0.35;
130 | }
131 |
132 | @keyframes scroll {
133 | 0% {
134 | transform: translate(0, 0);
135 | opacity: 0;
136 | }
137 |
138 | 40% {
139 | opacity: 1;
140 | }
141 |
142 | 80% {
143 | transform: translate(0, calc(var(--height) * 0.7));
144 | opacity: 0;
145 | }
146 |
147 | 100% {
148 | opacity: 0;
149 | }
150 | }
151 | }
152 |
--------------------------------------------------------------------------------