1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +01:00

Merge pull request #51 from Unleash/github-link-into-menu-drawer

github link into menu + username tooltip + visual tweaks
This commit is contained in:
Vegard Sandvold 2017-01-20 13:04:42 +01:00 committed by GitHub
commit e8058d426b
5 changed files with 71 additions and 34 deletions

View File

@ -4,7 +4,8 @@ import { Layout, Drawer, Header, Navigation, Content,
Grid, Cell, Icon,
} from 'react-mdl';
import { Link } from 'react-router';
import style from './styles.scss';
import styles from './styles.scss';
import { styles as commonStyles } from './common';
import ErrorContainer from './error/error-container';
import UserContainer from './user/user-container';
@ -100,30 +101,49 @@ export default class App extends Component {
return [0, 0];
}
};
const createListItem = (path, caption, icon) =>
<Link
to={path}
className={this.context.router.isActive(path) ? style.active : ''}>
{icon && <Icon name={icon} />} {caption}
</Link>;
const createListItem = (path, caption, icon, isDrawerNavigation = false) => {
const linkColor = isDrawerNavigation &&
this.context.router.isActive(path) ? 'mdl-color-text--black' : 'mdl-color-text--grey-900';
const iconColor = isDrawerNavigation &&
this.context.router.isActive(path) ? 'mdl-color-text--black' : 'mdl-color-text--grey-600';
return (
<Link
to={path}
className={isDrawerNavigation && [styles.navigationLink, linkColor].join(' ')}>
{icon && <Icon name={icon} className={isDrawerNavigation && [styles.navigationIcon, iconColor].join(' ')}/>}{caption}
</Link>
);
};
return (
<div style={{}}>
<div>
<UserContainer />
<Layout fixedHeader>
<Header title={this.getTitleWithLinks()}>
<Navigation>
<a href="https://github.com/Unleash" target="_blank">Github</a>
<ShowUserContainer />
</Navigation>
</Header>
<Drawer title="Unleash Admin">
<Navigation>
{createListItem('/features', 'Feature toggles', 'list')}
{createListItem('/strategies', 'Strategies', 'extension')}
{createListItem('/history', 'Event history', 'history')}
{createListItem('/archive', 'Archived toggles', 'archive')}
{createListItem('/applications', 'Applications', 'apps')}
<Drawer className="mdl-color--white">
<span className={[styles.title, 'mdl-layout-title'].join(' ')}>Unleash</span>
<hr className={commonStyles.divider}/>
<Navigation className={styles.navigation}>
{createListItem('/features', 'Feature toggles', 'list', true)}
{createListItem('/strategies', 'Strategies', 'extension', true)}
{createListItem('/history', 'Event history', 'history', true)}
{createListItem('/archive', 'Archived toggles', 'archive', true)}
{createListItem('/applications', 'Applications', 'apps', true)}
</Navigation>
<hr className={commonStyles.divider}/>
<Navigation className={styles.navigation}>
<a href="https://github.com/Unleash" target="_blank" className={[styles.navigationLink, 'mdl-color-text--grey-900'].join(' ')}>
<i className={[
'material-icons',
styles.navigationIcon,
styles.githubIcon,
'mdl-color-text--grey-600',
].join(' ')}/>GitHub
</a>
</Navigation>
</Drawer>
<ScrollContainer scrollKey="container" shouldUpdateScroll={shouldUpdateScroll}>

View File

@ -5,7 +5,8 @@
}
.divider {
border-color: #e1e1e1;
margin: 0;
border-color: rgba(0,0,0,.12);
}
@media (max-width: 960px) {

View File

@ -16,7 +16,7 @@ const StrategyChipItem = ({ strategy }) => (
// TODO what about "missing" strategies here?
const StrategiesList = ({ strategies }) => (
<div style={{ verticalAlign: 'middle' }}>With {strategies.length > 1 ? 'strategies' : 'strategy'} {
<div style={{ verticalAlign: 'middle', paddingTop: '14px' }}>With {strategies.length > 1 ? 'strategies' : 'strategy'} {
strategies.map((strategy, i) => <StrategyChipItem key={i} strategy={strategy} />)
}</div>
);

View File

@ -1,17 +1,31 @@
.container {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: auto;
overflow-y: auto;
.title {
padding-left: 24px !important;
}
.navigation {
.active {
background-color: #EEE;
@media screen and (max-width: 1024px) {
.title {
padding-left: 16px !important;
}
}
.navigation {
padding: 8px 0 !important;
}
.navigationLink {
padding: 12px 24px !important;
}
@media screen and (max-width: 1024px) {
.navigationLink {
padding: 12px 16px !important;
}
}
.navigationIcon {
margin-right: 32px;
}
.githubIcon {
width: 24px;
height: 24px;
background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHN0eWxlPSJ3aW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TEwLDEwIDAgMCwwIDEyLDJaIiAvPgo8L3N2Zz4=);
}

View File

@ -1,4 +1,5 @@
import React, { PropTypes } from 'react';
import { Icon, Tooltip } from 'react-mdl';
export default class ShowUserComponent extends React.Component {
static propTypes () {
@ -15,9 +16,10 @@ export default class ShowUserComponent extends React.Component {
render () {
return (
<a className="mdl-navigation__link" href="#edit-user" onClick={this.openEdit} style={{}}>
Username:&nbsp;
<strong>{this.props.user.userName || 'Unknown'}</strong>
<a className="mdl-navigation__link" href="#edit-user" onClick={this.openEdit}>
<Tooltip label={this.props.user.userName || 'Unknown'} large>
<Icon name="account_circle"/>
</Tooltip>
</a>
);
}