Skip to content

Commit

Permalink
Reorganize sidenav items. Delete sandboxes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcenizal committed Feb 21, 2018
1 parent 30bfc7e commit e4a2c8a
Show file tree
Hide file tree
Showing 20 changed files with 20 additions and 829 deletions.
1 change: 0 additions & 1 deletion src-docs/src/components/guide_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,5 @@ $guideZLevelHighest: $euiZLevel9 + 1000;
}
}

@import "guide_sandbox/index";
@import "guide_section/index";
@import "guide_rule/index";
158 changes: 0 additions & 158 deletions src-docs/src/components/guide_page/guide_page_chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,164 +91,6 @@ export class GuidePageChrome extends Component {
}));
}

renderGuidelineNavItems() {
const matchingItems = this.props.guidelines.filter(item => (
item.name.toLowerCase().indexOf(this.state.search.toLowerCase()) !== -1
));

const items = matchingItems.map(item => {
const {
name,
path,
sections,
} = item;

return {
id: `guideline-${path}`,
name,
href: `#/${path}`,
items: this.renderSubSections(sections),
isSelected: name === this.props.currentRouteName,
};
});

if (!items.length) {
return;
}

return {
name: 'Guidelines',
id: 'guidelines',
items,
};
}

renderServiceNavItems() {
const matchingItems = this.props.services.filter(item => (
item.name.toLowerCase().indexOf(this.state.search.toLowerCase()) !== -1
));

const items = matchingItems.map(item => {
const {
name,
path,
sections,
} = item;

return {
id: `service-${path}`,
name,
href: `#/${path}`,
items: this.renderSubSections(sections),
isSelected: name === this.props.currentRouteName,
};
});

if (!items.length) {
return;
}

return {
name: 'Services',
id: 'services',
items,
};
}

renderComponentNavItems() {
const matchingItems = this.props.components.filter(item => (
item.name.toLowerCase().indexOf(this.state.search.toLowerCase()) !== -1
));

const items = matchingItems.map(item => {
const {
name,
path,
sections,
} = item;

return {
id: `component-${path}`,
name,
href: `#/${path}`,
items: this.renderSubSections(sections),
isSelected: name === this.props.currentRouteName,
};
});

if (!items.length) {
return;
}

return {
name: 'Components',
id: 'components',
items,
};
}

rendePatternNavItems() {
const matchingItems = this.props.patterns.filter(item => (
item.name.toLowerCase().indexOf(this.state.search.toLowerCase()) !== -1
));

const items = matchingItems.map(item => {
const {
name,
path,
sections,
} = item;

return {
id: `pattern-${path}`,
name,
href: `#/${path}`,
items: this.renderSubSections(sections),
isSelected: name === this.props.currentRouteName,
};
});

if (!items.length) {
return;
}

return {
name: 'Patterns',
id: 'patterns',
items,
};
}

renderSandboxNavItems() {
const matchingItems = this.props.sandboxes.filter(item => (
item.name.toLowerCase().indexOf(this.state.search.toLowerCase()) !== -1
));

const items = matchingItems.map(item => {
const {
name,
path,
} = item;

return {
id: `sandbox-${path}`,
name,
href: `#/${path}`,
isSelected: name === this.props.currentRouteName,
};
});

if (!items.length) {
return;
}

return {
name: 'Sandboxes',
id: 'sandboxes',
items,
};
}

renderSideNav = sideNav => {
// TODO: Add contents pages
return sideNav.map(section => {
Expand Down
30 changes: 0 additions & 30 deletions src-docs/src/components/guide_sandbox/_guide_sandbox_chrome.scss

This file was deleted.

1 change: 0 additions & 1 deletion src-docs/src/components/guide_sandbox/_index.scss

This file was deleted.

62 changes: 0 additions & 62 deletions src-docs/src/components/guide_sandbox/guide_sandbox_chrome.js

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion src-docs/src/components/guide_sandbox/index.js

This file was deleted.

11 changes: 0 additions & 11 deletions src-docs/src/components/guide_section/_guide_section.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,6 @@
height: $euiSizeL;
}

.guideSandbox {
.guideSection__text {
margin-top: $euiSizeXL;
padding: 0 $euiSizeL;
}

.guideSection__space {
height: 0;
}
}

.guideSectionPropsTable {
width: auto;
min-width: 50%;
Expand Down
35 changes: 0 additions & 35 deletions src-docs/src/components/guide_section/guide_section.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { flatten } from 'lodash';

import {
GuideSandboxChrome,
} from '../guide_sandbox';

import {
EuiCode,
EuiCodeBlock,
Expand Down Expand Up @@ -110,9 +106,6 @@ export class GuideSection extends Component {

this.state = {
selectedTab: this.tabs[0],
sandbox: {
isChromeVisible: props.isSandbox ? false : undefined,
},
};
}

Expand All @@ -122,14 +115,6 @@ export class GuideSection extends Component {
});
}

onToggleSandboxChrome = () => {
this.setState({
sandbox: {
isChromeVisible: !this.state.sandbox.isChromeVisible,
},
});
}

renderTabs() {
return this.tabs.map(tab => (
<EuiTab
Expand Down Expand Up @@ -291,27 +276,8 @@ export class GuideSection extends Component {
}

renderChrome() {
let header;

if (this.props.isSandbox) {
header = (
<GuideSandboxChrome
routes={this.props.routes.getAppRoutes()}
onToggleTheme={this.props.toggleTheme}
onToggleSandboxChrome={this.onToggleSandboxChrome}
selectedTheme={this.props.theme}
isVisible={this.state.sandbox.isChromeVisible}
/>
);
}

if (this.props.isSandbox && !this.state.sandbox.isChromeVisible) {
return header;
}

return (
<div>
{header}
<div className="guideSection__text">
<EuiTitle>
<h2>{this.props.title}</h2>
Expand Down Expand Up @@ -396,7 +362,6 @@ GuideSection.propTypes = {
id: PropTypes.string,
source: PropTypes.array,
children: PropTypes.any,
isSandbox: PropTypes.bool,
toggleTheme: PropTypes.func.isRequired,
theme: PropTypes.string.isRequired,
routes: PropTypes.object.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { connect } from 'react-redux';
import { GuideSection } from './guide_section';

import {
getIsSandbox,
getTheme,
getRoutes,
} from '../../store';
Expand All @@ -14,7 +13,6 @@ import {

function mapStateToProps(state) {
return {
isSandbox: getIsSandbox(state),
theme: getTheme(state),
routes: getRoutes(state),
};
Expand Down
Loading

0 comments on commit e4a2c8a

Please sign in to comment.