twreporter-react-components
INSTALL
Need Peer Dependencies:
yarn add react react-dom react-router
Install:
yarn add twreporter-react-components
USE
index-components
const CategorySection EditorPicks Header InforgraphicSection LatestSection LatestTopicSection NewsLetterSection PhotographySection ReporterIntro ReviewsSection SideBar TopicsSection = IndexPageCompositecomponents
header-components
const Page = <div> <Header isIndex pageTheme=propspageTheme pathName=propspathName /> propschildren </div>
Props:
isIndex
: (boolean) The Component is used on index page or not. (default:false
)pageTheme
: (string) The page theme passed bytwreporter-react
.DARK
orBRIGHT
. (default:'BRIGHT'
)pathName
: (string) The pathname passed bytwreporter-react
. With format likes/categories/inforgraphic
,/photography
. (default:''
)
footer-components
const Page = <div> propschildren <Footer /> </div>
Props:
none
listing-components
Topics
const Page = <div> <PageContent> <TopicsList currentPage=propspage topics=propsdata isFetching=propsisFetching /> </PageContent> </div>
props:
currentPage
(number): current page
topics
(array): topics data
isFetching
(boolean): is data ready
Developement
Dev
npm run dev
will build the package into the customer folder, and start watching the .js
files change.
If any .js
file has been changed, gulp
will babel changed files into the customer folder automatically.
cd twreporter-react-components
npm run dev
Build (pre-publish)
cd twreporter-react-components
npm run build
Pubish
cd twreporter-react-components
npm publish