npm install --save react-fullpage
import {SectionsContainer, Section} from 'react-fullpage';
export default function MainPage() {
let options = {
};
return (
<SectionsContainer {...options}>
<Section>Page 1</Section>
<Section>Page 2</Section>
<Section>Page 3</Section>
<Section>Page 4</Section>
</SectionsContainer>
);
}
๐ฅ (ํ์) anchors section ๊ฐ์์ ๋ง๊ฒ ํด๋น section์ด๋ฆ์ ์ค์ ํด์ผํ๋ค.
๊ทธ๋ผ ์คํฌ๋กค์ url์ # ์ค๋ฅธ์ชฝ์ ์ฌ์ฉ์๊ฐ์ค์ ํ section๋ช
์ด ๋ํ๋๋ค.
let options = {
activeClass: 'active', // the class that is appended to the sections links
anchors: [], // the anchors for each sections
arrowNavigation: true, // use arrow keys
className: 'SectionContainer', // the class name for the section container
delay: 1000, // the scroll animation speed
navigation: true, // use dots navigatio
scrollBar: false, // use the browser default scrollbar
sectionClassName: 'Section', // the section class name
sectionPaddingTop: '0', // the section top padding
sectionPaddingBottom: '0', // the section bottom padding
verticalAlign: false // align the content of each section vertical
};
import React from 'react';
import { SectionsContainer, Section } from 'react-fullpage';
import HeroSection from './section/HeroSection';
import HistoryTimeLine from './section/HistoryTimeLine';
import Vison from './section/Vison';
import StroySection from './section/StroySection';
import SloganSection from './section/SloganSection';
export default function BrandStory() {
let options = {
activeClass: 'active',
anchors: ['HeroSection', 'TimeLineSection', 'MissionSection', 'StorySection', 'SloganSection'],
arrowNavigation: true,
className: 'SectionContainer',
delay: 1000,
navigation: true,
scrollBar: false,
sectionClassName: 'Section',
sectionPaddingTop: '0',
sectionPaddingBottom: '0',
verticalAlign: false,
};
const sectionComponents = [HeroSection, HistoryTimeLine, Vison, StroySection, SloganSection];
//๊ธฐ๋ณธ ver
return (
<SectionsContainer {...options}>
<Section>
<HeroSection />
</Section>
<Section>
<HistoryTimeLine />
</Section>
<Section>
<Vison />
</Section>
<Section>
<StroySection />
</Section>
<Section>
<SloganSection />
</Section>
</SectionsContainer>
);
//๋ฆฌํฉํ ๋ง ver
return (
<SectionsContainer {...options}>
{sectionComponents.map((Component, i) => (
<Section key={sectionAnchors[i]}>
<Component />
</Section>
))}
</SectionsContainer>
);
}