Skip to content
This repository was archived by the owner on Jan 21, 2019. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
560e654
FAN-3742 | Add Global Footer placeholder component
vforge Jun 18, 2018
5a300ec
FAN-3857 | Add Global Navigation html
vforge Jun 18, 2018
ff201f6
FAN-3742 | Componentize GN (1)
vforge Jun 19, 2018
3623155
FAN-3742 | Small cleanup
vforge Jun 20, 2018
f94884e
FAN-3742 | Add anon styles back
vforge Jun 20, 2018
9bfd9cb
FAN-3741-logo-update | Added global nav logo switcher
Jun 25, 2018
163a4ce
Merge pull request #36 from Wikia/FAN-3741-logo-update
vforge Jun 25, 2018
7441c4f
Rename country to edition
vforge Jun 25, 2018
c5d8360
FAN-3742-edition-styles
Jun 25, 2018
641dabb
FAN-3742-edition-styles
Jun 25, 2018
c2c7e87
FAN-3742-edition-styles | removed media query
Jun 25, 2018
7dbe12d
Merge branch 'FAN-3742-edition-styles' of github.com:Wikia/react-desi…
Jun 25, 2018
31388bd
Merge pull request #37 from Wikia/FAN-3742-edition-styles
vforge Jun 25, 2018
1b22222
FAN-3742 | Add tests
vforge Jun 25, 2018
44ce2af
Merge pull request #38 from Wikia/FAN-3742-tests
Jun 27, 2018
e8596a0
(temp) Add pure desktop view component to the GN
vforge Jun 27, 2018
825b362
Merge pull request #39 from Wikia/add-pure-gn-view
vforge Jun 27, 2018
bbed916
Merge remote-tracking branch 'origin/master' into FAN-3742
vforge Jun 28, 2018
a2281ad
Make edition optional
vforge Jun 28, 2018
1165d64
Merge pull request #40 from Wikia/make-edition-optional
mklucsarits Jun 28, 2018
7c9a4be
Bump DS and fix styles
vforge Jul 10, 2018
f1bc1b4
Rebuild
vforge Jul 10, 2018
f9baa67
typo
vforge Jul 10, 2018
4231579
wip
vforge Jul 18, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"plugins": [
"babel-plugin-transform-object-rest-spread",
"transform-class-properties"
],
"presets": ["env", "react"]
}
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"rules": {
"indent": ["error", 2, {"VariableDeclarator": 1, "SwitchCase": 1}],
"no-tabs": 1,
"camelcase": 0,
"no-underscore-dangle": 0,
"no-unused-vars": 0,
"react/jsx-filename-extension": 0,
Expand Down
4 changes: 3 additions & 1 deletion components.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
"name": "Design System UI",
"components": [
"BannerNotification",
"BannerNotifications"
"BannerNotifications",
"GlobalNavigation",
"GlobalFooter"
]
},
{
Expand Down
1 change: 0 additions & 1 deletion docs/build/0.723480b2.js

This file was deleted.

1 change: 1 addition & 0 deletions docs/build/0.b0dc0f27.js

Large diffs are not rendered by default.

55 changes: 55 additions & 0 deletions docs/build/bundle.3582c817.js

Large diffs are not rendered by default.

55 changes: 0 additions & 55 deletions docs/build/bundle.5577cc43.js

This file was deleted.

9 changes: 7 additions & 2 deletions docs/index.html

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
"license": "PRIVATE",
"private": true,
"dependencies": {
"design-system": "git://github.com/Wikia/design-system.git#12.0.0",
"axios": "^0.18.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"design-system": "git://github.com/Wikia/design-system.git#2c96b85b1c2121d5204b3e9a446934c0e3e2e76e",
"lodash.get": "^4.4.2",
"lodash.uniqueid": "^4.0.1",
"prop-types": "^15.6.1",
"react": "^16.2.0",
"react-dom": "^16.2.0"
"react": "^16.3.0",
"react-dom": "^16.3.0"
},
"scripts": {
"build:watch": "styleguidist server",
Expand All @@ -34,6 +37,7 @@
"test": "yarn lint && yarn test:run && yarn coverage"
},
"devDependencies": {
"axios-mock-adapter": "^1.15.0",
"babel-core": "^6.26.0",
"babel-jest": "^22.4.1",
"babel-loader": "^7.1.3",
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`GlobalFooter should render correctly with default data 1`] = `
<div>
NOT IMPLEMENTED
</div>
`;
8 changes: 8 additions & 0 deletions src/components/GlobalFooter/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react';

/**
* TODO Not yet implemented
*/
const GlobalFooter = () => <div>NOT IMPLEMENTED</div>;

export default GlobalFooter;
13 changes: 13 additions & 0 deletions src/components/GlobalFooter/index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import renderer from 'react-test-renderer';
import {shallow} from 'enzyme';
import sinon from 'sinon';

import GlobalFooter from './index';

test('GlobalFooter should render correctly with default data', () => {
const component = renderer.create(
<GlobalFooter />
);
expect(component.toJSON()).toMatchSnapshot();
});
14 changes: 14 additions & 0 deletions src/components/GlobalNavigation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
User:
```js
<GlobalNavigation api={() => Promise.resolve({data: require('./mockedData').user})}/>
```

Anon:
```js
<GlobalNavigation api={() => Promise.resolve({data: require('./mockedData').anon})}/>
```

Anon with Partner Slot:
```js
<GlobalNavigation api={() => Promise.resolve({data: require('./mockedData').anonPartner})}/>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`GlobalNavigation should work with axios 1`] = `
<GlobalNavigation
api={[Function]}
className=""
/>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import React from 'react';
import PropTypes from 'prop-types';
import get from 'lodash.get';

import Logo from './Logo';
import Link from './Link';
import Search from './Search';
import User from './User';
import UserAnon from './UserAnon';

import './GlobalNavigationWrapper.scss';

class GlobalNavigationWrapper extends React.Component {
constructor(props) {
super(props);

this.onSearchStateChange = this.onSearchStateChange.bind(this);
}

state = {
searchIsFocused: false,
};

onSearchStateChange(searchIsFocused) {
this.setState({searchIsFocused});
}

renderLeft() {
const logo = get(this.props.navigationData, 'logo');
const navLinks = get(this.props.navigationData, 'main_navigation');

const navigationLinks = (
<nav className="wds-global-navigation__links">
{navLinks.map(
// eslint-disable-next-line react/no-array-index-key
(link, index) => <Link key={`link-${index}`} link={link} />
)}
</nav>
);

return (
<div className="wds-global-navigation__content-bar-left">
<Logo {...logo} />
{navigationLinks}
</div>
);
}

renderDropdownControls() {
const createWiki = get(this.props.navigationData, 'create_wiki');
const search = get(this.props.navigationData, 'search');
const anonLinks = get(this.props.navigationData, 'anon');
const user = get(this.props.navigationData, 'user');

const startWikiButton = (
<div className="wds-global-navigation__start-a-wiki">
<Link link={createWiki} />
</div>
);

return (
<div className="wds-global-navigation__dropdown-controls">
<Search onStateChange={this.onSearchStateChange} {...search} />
<UserAnon anonLinks={anonLinks} />
<User user={user} />
{startWikiButton}
</div>
);
}

renderRight() {
return (
<div className="wds-global-navigation__content-bar-right">
{this.renderDropdownControls()}
</div>
);
}

render() {
const partnerSlot = get(this.props.navigationData, 'partner_slot');

// loaded
const classes = [
'wds-global-navigation',
'wds-search-is-always-visible',
this.state.searchIsFocused ? 'wds-search-is-active' : null,
partnerSlot ? 'wds-has-partner-slot' : null,
this.props.className,
].filter(c => c).join(' ');

return (
<div className={classes}>
<div className="wds-global-navigation__content-container">
{this.renderLeft()}
{this.renderRight()}
<Link link={partnerSlot} />
</div>
</div>
);
}
}

GlobalNavigationWrapper.propTypes = {
className: PropTypes.string,
// eslint-disable-next-line react/forbid-prop-types
navigationData: PropTypes.object.isRequired,
};

GlobalNavigationWrapper.defaultProps = {
className: '',
};

export default GlobalNavigationWrapper;
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// import variables
@import "~design-system/dist/scss/wds-functions/index.scss";
@import "~design-system/dist/scss/wds-mixins/index.scss";
@import "~design-system/dist/scss/wds-variables/index.scss";

// import wds-button
@import "~design-system/dist/scss/wds-components/_global-navigation.scss";

// hacks
// .wds-global-navigation__partner-slot-image {
// max-height: 35px;
// max-width: 60px;
// }
//
// .wds-global-navigation__search-toggle {
// background: transparent;
// border: 0;
// color: inherit;
// font: inherit;
// }
//
// .wds-global-navigation__logo {
// position: relative;
// }

.wds-global-navigation__edition-text {
bottom: -9px;
color: $wds-fandom-color-middle-gray;
font-size: 10px;
font-weight: 500;
letter-spacing: .5px;
position: absolute;
right: 0;
text-align: right;
text-transform: uppercase;
width: 130px;
}
Loading