npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ftchinese/ftc-header-react-new

v2.0.5

Published

The new react version for ftc-header, composing with a series of smaller components such as ftc-nav-react, ftc-pushdownmenu-react, ftc-login-react,etc.

Downloads

17

Readme

ftc-header-react-new

The new version for ftc-header-react.

The dependency components of it includes '@ftchinese/ftc-pushdownmenu-react','@ftchinese/ftc-nav-react','@ftchinese/ftc-searchbar-react', '@ftchinese/ftc-login-react'.

Install

cd yourProject
npm install "@ftchinese/ftc-header-react-new" --save 

Usage

Example:

import Header from '@ftchinese/ftc-header-react-new';
import React from 'react';
import ReactDOM from 'react-dom';

ReactDOM.render(
  <Header customHomeTitle="管理系统"

    pushdownMenuData={[
      {
        name: "相关资源",
        selected: true
      },
      {
        name: "FTC首页",
        url: "http://www.ftchinese.com",
        selected: false
      },
      {
        name: "FT首页",
        url: "https://www.ft.com/",
        selected: false
      },
    ]}

    signData={[
      {
        "word":"登录",
        "name":"signIn",
        "showTime":"before"
      },
      {
        "url":"URL_FOR_SIGNUP",
        "word":"免费注册",
        "name":"signUp",
        "showTime":"before"
      },
      {
        "url":"URL_FOR_SIGNOUT",
        "word":"登出",
        "name":"signOut",
        "showTime":"after"
      }
    ]}

    hasSignedIn={false}


    dynamicNav={false}
    navChannelData={[
      {
        "name": "首页",
        "url": "http://www.ftchinese.com",
        "order":0,
        "subs":[
          {
            "name":"特别报道",
            "url":"http://www.ftchinese.com/channel/special.html",
            "order":0
          },
          {
            "name":"热门文章",
            "url":"http://www.ftchinese.com/channel/special.html",
            "order":1
          },
          {
            "name":"会议活动",
            "url":"http://www.ftchinese.com/m/events/event.html",
            "order":2
          }
        ]  
      },
      {
        "name": "中国",
        "url": "http://www.ftchinese.com/channel/china.html",
        "order":1,
        "subs":[
          {
            "name":"政经",
            "url":"http://www.ftchinese.com/channel/chinareport.html",
            "order":0
          },
          {
            "name":"商业",
            "url":"http://www.ftchinese.com/channel/chinabusiness.html",
            "order":1
          },
          {
            "name":"金融市场",
            "url":"http://www.ftchinese.com/channel/chinamarkets.html",
            "order":2
          }
        ]
      },
      {
        "name": "全球",
        "url": "http://www.ftchinese.com/channel/world.html",
        "order":2
      },
    ]}
    navDefaultTopOrder={1}
    navDefaultSubOrder={1}

    searchPostUrl={"URL_FOR_SEARCH"}
    searchPlaceHolder={"输入年月日‘xxxx-xx-xx’可搜索该日存档" }
  />,
  document.getElementById('root')
);

Props of Header

You can briefly know about it by the proptypes:

 static propTypes = {
    customHomeTitle: PropTypes.string, 

    pushdownMenuData: PropTypes.arrayOf(
      PropTypes.shape({
        name: PropTypes.string.isRequired,
        url: PropTypes.string,
        selected: PropTypes.bool.isRequired,
      })
    ),

    signData:PropTypes.arrayOf( // data For SignMenu
      PropTypes.shape({
        word: PropTypes.string.isRequired,
        clickHandler: PropTypes.func,
        url: PropTypes.string,
        name: PropTypes.string.isRequired,
        showTime: PropTypes.oneOf(['before','after'])
      })
    ),
    hasSignedIn:PropTypes.bool,

    dynamicNav: PropTypes.bool,// data for Nav
    navChannelData: PropTypes.arrayOf( 
      PropTypes.shape({
        name: PropTypes.string.isRequired,
        order: PropTypes.number.isRequired,
        url: PropTypes.string,
        subs: PropTypes.arrayOf(
            PropTypes.shape({
                name: PropTypes.string.isRequired,
                order: PropTypes.number.isRequired,
                url: PropTypes.string
            })
        )
      })
    ),
    navDefaultTopOrder: PropTypes.number,
    navDefaultSubOrder: PropTypes.number,

    searchPostUrl: PropTypes.string,
    searchPlaceHolder: PropTypes.string
  }

The following are the details about the props:

customHomeTitle

TYPE String. Default ''. Optional. Self-defined title for home. If it is '', the home title will use FTC logo image.

pushdownMenuData

TYPE Array. Optional. Data for tc-pushdownmenu-react. Look at ftc-pushdownmenu-react for details.

signData

TYPE Array. Optional. The data for sign menu. For one item of signData, it has the flowing properties:

word

TYPE String. Required. The word showed on the menu item.

clickHandler

TYPE Func. Optional. The event handler for clicking. If there is the clickHandler, the item would be a div, and will exect the clickHandler func when clicking it. Otherwise, if there is no clickHandler, the item would be an a and will use the following param url.

url

Type String. Optional. Default '#'. The navigating target page when clicking on the menu item. If the word is '登录', it will pop a window instead.

name

Type String. Optional. The value of the 'key' for every list item of the menu.

showTime

Type String, should be 'before' or 'after'. Optional. Default 'before'. Decide to show the item or not depending on if there is the cookie whose name is defined by the variable signedFlagCookieName.

hasSignedIn

Type Bool. If the user opening the page has signed in. It may passed from parent component, and may depend on some cookies.

dynamicNav, navChannelData, navDefaultTopOrder, navDefaultSubOrder

Data for @ftchinse/ftc-nav-react.

dynamicNav for the prop dynamicnav of ftc-nav-react. navChannelData for the prop channels of ftc-nav-react. navDefaultTopOrder for the prop defaultSelectedTopChannelOrder of ftc-nav-react. navDefaultSubOrder for the prop defaultSelectedSubChannelOrder of ftc-nav-react.

Look for ftc-nav-react for details.

searchPostUrl, searchPlaceHolder

Data for ftc-searchbar-react. searchPostUrl for the prop postUrl of ftc-searchbar-react. searchPlaceHolder for the prop placeholderText of ftc-searchbar-react.

Look for ftc-searchbar-react for details.