Поддержка иконок для заголовков панелей

This commit is contained in:
SleepWalker 2016-01-09 13:59:42 +02:00
parent 8bb485d1e0
commit d2192b6057
4 changed files with 31 additions and 29 deletions

View File

@ -5,7 +5,7 @@ import classNames from 'classnames';
import buttons from 'components/ui/buttons.scss'; import buttons from 'components/ui/buttons.scss';
import icons from 'components/ui/icons.scss'; import icons from 'components/ui/icons.scss';
import { Panel, PanelHeader, PanelBody, PanelFooter } from 'components/ui/Panel'; import { Panel, PanelBody, PanelFooter } from 'components/ui/Panel';
import { Input } from 'components/ui/Form'; import { Input } from 'components/ui/Form';
import styles from './signIn.scss'; import styles from './signIn.scss';
@ -13,7 +13,6 @@ import messages from './SignIn.messages';
import panel from 'components/ui/panel.scss'; import panel from 'components/ui/panel.scss';
styles.headerControl = panel.headerControl;
// 0.5s cubic-bezier(0.075, 0.82, 0.165, 1) // 0.5s cubic-bezier(0.075, 0.82, 0.165, 1)
@ -57,15 +56,7 @@ export default class SignIn extends Component {
</div> </div>
</div> </div>
<div className={styles.signIn}> <div className={styles.signIn}>
<Panel> <Panel icon="arrowLeft" title={<Message {...messages.enterPassword} />}>
<PanelHeader>
<div className={styles.headerControl}>
<button className={buttons.black}>
<span className={icons.arrowLeft} />
</button>
</div>
<Message {...messages.enterPassword} />
</PanelHeader>
<PanelBody> <PanelBody>
<div className={styles.error}> <div className={styles.error}>
<Message {...messages.invalidPassword} /> <Message {...messages.invalidPassword} />
@ -206,15 +197,7 @@ export default class SignIn extends Component {
</div> </div>
</div> </div>
<div className={styles.signIn}> <div className={styles.signIn}>
<Panel> <Panel icon="arrowLeft" title={<Message {...messages.accountActivationTitle} />}>
<PanelHeader>
<div className={styles.headerControl}>
<button className={buttons.black}>
<span className={icons.arrowLeft} />
</button>
</div>
<Message {...messages.accountActivationTitle} />
</PanelHeader>
<PanelBody> <PanelBody>
<div className={styles.description}> <div className={styles.description}>
<div className={styles.descriptionImage}> <div className={styles.descriptionImage}>

View File

@ -1,13 +1,23 @@
import React from 'react'; import React from 'react';
import styles from './panel.scss'; import styles from './panel.scss';
import icons from './icons.scss';
export function Panel(props) { export function Panel(props) {
var { title } = props; var { title, icon } = props;
if (icon) {
icon = (
<button className={styles.headerControl}>
<span className={icons[icon]} />
</button>
);
}
if (title) { if (title) {
title = ( title = (
<PanelHeader> <PanelHeader>
{icon}
{title} {title}
</PanelHeader> </PanelHeader>
); );

View File

@ -21,8 +21,7 @@
} }
} }
.button, .button {
.black {
display: inline-block; display: inline-block;
box-sizing: border-box; box-sizing: border-box;
height: 50px; height: 50px;
@ -38,6 +37,14 @@
transition: background-color 0.25s; transition: background-color 0.25s;
&:focus {
outline: none;
}
}
.black {
composes: button;
background-color: $black; background-color: $black;
&:hover { &:hover {
@ -47,10 +54,6 @@
&:active { &:active {
background-color: $black-button-dark; background-color: $black-button-dark;
} }
&:focus {
outline: none;
}
} }
@include button-color('blue', $blue); @include button-color('blue', $blue);

View File

@ -18,11 +18,17 @@
} }
.headerControl { .headerControl {
composes: black from './buttons.scss';
float: left; float: left;
line-height: 1;
border-right: 1px solid lighter($black);
overflow: hidden; overflow: hidden;
height: 49px; height: 49px;
width: 49px;
padding: 0;
border-right: 1px solid lighter($black);
line-height: 1;
text-align: center;
} }
.body { .body {