aboutsummaryrefslogblamecommitdiffstats
path: root/packages/website/ts/components/footer.tsx
blob: d90f2f70877d3972ec6ccd20ed57d5564e01191e (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                                        
                                             
                            

                                                    
                               
 
                                                 
                                                             
                                               
                                               
 
                          
 





                                         

  
                              
                         
                           
 
 


                               

                                                                       
                                     
                     



                                                            
                                      
                                                        


                                   
                                              


                                                                                  
                                                    


                                                                           
                                             


                                                                              

                                                


                                                                        
                                          

                  
                                                                       
                                         




                                                                              

                                                  


                                                                        

                                            


                                     

                                              


                                    

                                             


                                                                         

                                                      




                                                                         
                                           


                                                                           
                                             


                                                                           

                                                    


                  


                                                                                                         
                

                                                                                                                
                                                                       
                                                                           


                                                                                         
                                





                                                       
                             

                                                








                                                                              




                                                                                
                                                                       
                                                                                                               



                                                                                    
                                                                   
                                                                                                           



                                                                         
                                                                      
                                                                                                              






                                  
                                                            
                

                                                                                            


                  
                                                           
                                                          
                                                                                   




                                                                             
                                                     
                
                                                                                                 
                                                                                                              
                         
                                                         

                                                                                                      
                                                                              

                                  
                                      
                          

                          


                  
                                                      
                             
                                  




                                      
                                                                      
                                                           


                  
                                                                                 


                                    
                                                            
     
 
import { ALink, colors, Link, LinkType } from '@0xproject/react-shared';
import { ObjectMap } from '@0xproject/types';
import * as _ from 'lodash';
import DropDownMenu from 'material-ui/DropDownMenu';
import MenuItem from 'material-ui/MenuItem';
import * as React from 'react';

import { Dispatcher } from 'ts/redux/dispatcher';
import { Deco, Key, Language, WebsitePaths } from 'ts/types';
import { constants } from 'ts/utils/constants';
import { Translate } from 'ts/utils/translate';

const ICON_DIMENSION = 16;

const languageToMenuTitle = {
    [Language.English]: 'English',
    [Language.Russian]: 'Русский',
    [Language.Spanish]: 'Español',
    [Language.Korean]: '한국어',
    [Language.Chinese]: '中文',
};

export interface FooterProps {
    translate: Translate;
    dispatcher: Dispatcher;
}

interface FooterState {
    selectedLanguage: Language;
}

export class Footer extends React.Component<FooterProps, FooterState> {
    constructor(props: FooterProps) {
        super(props);
        this.state = {
            selectedLanguage: props.translate.getLanguage(),
        };
    }
    public render(): React.ReactNode {
        const sectionNameToLinks: ObjectMap<ALink[]> = {
            [Key.Documentation]: [
                {
                    title: '0x.js',
                    to: WebsitePaths.ZeroExJs,
                },
                {
                    title: this.props.translate.get(Key.SmartContracts, Deco.Cap),
                    to: WebsitePaths.SmartContracts,
                },
                {
                    title: this.props.translate.get(Key.Connect, Deco.Cap),
                    to: WebsitePaths.Connect,
                },
                {
                    title: this.props.translate.get(Key.Whitepaper, Deco.Cap),
                    to: WebsitePaths.Whitepaper,
                    type: LinkType.External,
                },
                {
                    title: this.props.translate.get(Key.Wiki, Deco.Cap),
                    to: WebsitePaths.Wiki,
                },
                {
                    title: this.props.translate.get(Key.Faq, Deco.Cap),
                    to: WebsitePaths.FAQ,
                },
            ],
            [Key.Community]: [
                {
                    title: this.props.translate.get(Key.RocketChat, Deco.Cap),
                    type: LinkType.External,
                    to: constants.URL_ZEROEX_CHAT,
                },
                {
                    title: this.props.translate.get(Key.Blog, Deco.Cap),
                    type: LinkType.External,
                    to: constants.URL_BLOG,
                },
                {
                    title: 'Twitter',
                    type: LinkType.External,
                    to: constants.URL_TWITTER,
                },
                {
                    title: 'Reddit',
                    type: LinkType.External,
                    to: constants.URL_REDDIT,
                },
                {
                    title: this.props.translate.get(Key.Forum, Deco.Cap),
                    type: LinkType.External,
                    to: constants.URL_DISCOURSE_FORUM,
                },
            ],
            [Key.Organization]: [
                {
                    title: this.props.translate.get(Key.About, Deco.Cap),
                    to: WebsitePaths.About,
                },
                {
                    title: this.props.translate.get(Key.Careers, Deco.Cap),
                    to: WebsitePaths.Careers,
                },
                {
                    title: this.props.translate.get(Key.Contact, Deco.Cap),
                    type: LinkType.External,
                    to: 'mailto:team@0xproject.com',
                },
            ],
        };
        const languageMenuItems = _.map(languageToMenuTitle, (menuTitle: string, language: Language) => {
            return <MenuItem key={menuTitle} value={language} primaryText={menuTitle} />;
        });
        return (
            <div className="relative pb4 pt2" style={{ backgroundColor: colors.darkerGrey }}>
                <div className="mx-auto max-width-4 md-px2 lg-px0 py4 clearfix" style={{ color: colors.white }}>
                    <div className="col lg-col-4 md-col-4 col-12 left">
                        <div className="sm-mx-auto" style={{ width: 148 }}>
                            <div>
                                <img src="/images/protocol_logo_white.png" height="30" />
                            </div>
                            <div
                                style={{
                                    fontSize: 11,
                                    color: colors.grey,
                                    paddingLeft: 37,
                                    paddingTop: 2,
                                }}
                            >
                                © ZeroEx, Intl.
                            </div>
                            <div className="pt4 center">
                                <DropDownMenu
                                    labelStyle={{ color: colors.white }}
                                    value={this.state.selectedLanguage}
                                    onChange={this._updateLanguage.bind(this)}
                                >
                                    {languageMenuItems}
                                </DropDownMenu>
                            </div>
                        </div>
                    </div>
                    <div className="col lg-col-8 md-col-8 col-12 lg-pl4 md-pl4">
                        <div className="col lg-col-4 md-col-4 col-12">
                            <div className="lg-right md-right sm-center">
                                {this._renderHeader(Key.Documentation)}
                                {_.map(sectionNameToLinks[Key.Documentation], this._renderMenuItem.bind(this))}
                            </div>
                        </div>
                        <div className="col lg-col-4 md-col-4 col-12 lg-pr2 md-pr2">
                            <div className="lg-right md-right sm-center">
                                {this._renderHeader(Key.Community)}
                                {_.map(sectionNameToLinks[Key.Community], this._renderMenuItem.bind(this))}
                            </div>
                        </div>
                        <div className="col lg-col-4 md-col-4 col-12">
                            <div className="lg-right md-right sm-center">
                                {this._renderHeader(Key.Organization)}
                                {_.map(sectionNameToLinks[Key.Organization], this._renderMenuItem.bind(this))}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        );
    }
    private _renderIcon(fileName: string): React.ReactNode {
        return (
            <div style={{ height: ICON_DIMENSION, width: ICON_DIMENSION }}>
                <img src={`/images/social/${fileName}`} style={{ width: ICON_DIMENSION }} />
            </div>
        );
    }
    private _renderMenuItem(link: ALink): React.ReactNode {
        const titleToIcon: { [title: string]: string } = {
            [this.props.translate.get(Key.RocketChat, Deco.Cap)]: 'rocketchat.png',
            [this.props.translate.get(Key.Blog, Deco.Cap)]: 'medium.png',
            Twitter: 'twitter.png',
            Reddit: 'reddit.png',
            [this.props.translate.get(Key.Forum, Deco.Cap)]: 'discourse.png',
        };
        const iconIfExists = titleToIcon[link.title];
        return (
            <div key={link.title} className="sm-center" style={{ fontSize: 13, paddingTop: 25 }}>
                <Link to={link.to} type={link.type} fontColor={colors.white} className="text-decoration-none">
                    <div>
                        {!_.isUndefined(iconIfExists) ? (
                            <div className="inline-block">
                                <div className="pr1 table-cell">{this._renderIcon(iconIfExists)}</div>
                                <div className="table-cell">{link.title}</div>
                            </div>
                        ) : (
                            link.title
                        )}
                    </div>
                </Link>
            </div>
        );
    }
    private _renderHeader(key: Key): React.ReactNode {
        const headerStyle = {
            color: colors.grey400,
            letterSpacing: 2,
            fontFamily: 'Roboto Mono',
            fontSize: 13,
        };
        return (
            <div className="lg-pb2 md-pb2 sm-pt4" style={headerStyle}>
                {this.props.translate.get(key, Deco.Upper)}
            </div>
        );
    }
    private _updateLanguage(_event: any, _index: number, value: Language): void {
        this.setState({
            selectedLanguage: value,
        });
        this.props.dispatcher.updateSelectedLanguage(value);
    }
}