1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

Complete visual styling

This commit is contained in:
Tim Daubenschütz 2015-10-23 10:37:23 +02:00
parent e8a9cd89a4
commit cd3c8b8f6e
9 changed files with 57 additions and 81 deletions

View File

@ -45,7 +45,7 @@ let AclInformation = React.createClass({
return ( return (
<p> <p>
<span className="info"> <span className="info">
{replaceSubstringAtIndex(info.slice(2), 's ', ' ')} <br/> {replaceSubstringAtIndex(info.slice(2), 's ', ' ')}
</span> </span>
<span className="example"> <span className="example">
{example} {example}
@ -60,7 +60,7 @@ let AclInformation = React.createClass({
{title} {title}
</span> </span>
<span className="info"> <span className="info">
{info} <br/> {info + ' '}
</span> </span>
<span className="example"> <span className="example">
{example} {example}
@ -108,18 +108,19 @@ let AclInformation = React.createClass({
}, },
render() { render() {
const { aim, buttonListSize } = this.props; const { aim, buttonListSize, verbs } = this.props;
const { isVisible } = this.state; const { isVisible } = this.state;
/* Lets just fucking get this widget out... */ /* Lets just fucking get this widget out... */
const aclInformationSize = buttonListSize - 33; const aclInformationSize = buttonListSize - 30;
return ( return (
<span > <span >
{this.getButton()} {this.getButton()}
<div <div
style={{ style={{
width: aclInformationSize > 300 ? aclInformationSize : 400 width: aclInformationSize > 300 ? aclInformationSize : 400,
marginLeft: verbs.length === 1 ? '.25em' : null
}} }}
className={classnames({'acl-information-dropdown-list': true, 'hidden': aim === 'button' && !isVisible})}> className={classnames({'acl-information-dropdown-list': true, 'hidden': aim === 'button' && !isVisible})}>
<span>{this.produceInformationBlock()}</span> <span>{this.produceInformationBlock()}</span>

View File

@ -2,6 +2,7 @@
import React from 'react'; import React from 'react';
let DetailProperty = React.createClass({ let DetailProperty = React.createClass({
propTypes: { propTypes: {
label: React.PropTypes.string, label: React.PropTypes.string,
@ -12,20 +13,29 @@ let DetailProperty = React.createClass({
separator: React.PropTypes.string, separator: React.PropTypes.string,
labelClassName: React.PropTypes.string, labelClassName: React.PropTypes.string,
valueClassName: React.PropTypes.string, valueClassName: React.PropTypes.string,
ellipsis: React.PropTypes.bool ellipsis: React.PropTypes.bool,
children: React.PropTypes.oneOfType([
React.PropTypes.arrayOf(React.PropTypes.element),
React.PropTypes.element
])
}, },
getDefaultProps() { getDefaultProps() {
return { return {
separator: '', separator: '',
labelClassName: 'col-xs-3 col-sm-3 col-md-2 col-lg-2 col-xs-height col-bottom ascribe-detail-property-label', labelClassName: 'col-xs-3 col-sm-3 col-md-2 col-lg-2 col-xs-height ascribe-detail-property-label',
valueClassName: 'col-xs-9 col-sm-9 col-md-10 col-lg-10 col-xs-height col-bottom ascribe-detail-property-value' valueClassName: 'col-xs-9 col-sm-9 col-md-10 col-lg-10 col-xs-height col-bottom ascribe-detail-property-value'
}; };
}, },
render() { render() {
let value = this.props.value;
let styles = {}; let styles = {};
const { labelClassName,
label,
separator,
valueClassName,
children,
value } = this.props;
if(this.props.ellipsis) { if(this.props.ellipsis) {
styles = { styles = {
@ -35,30 +45,16 @@ let DetailProperty = React.createClass({
}; };
} }
if (this.props.children){
value = (
<div className="row-same-height">
<div className="col-xs-6 col-xs-height col-bottom no-padding">
{ this.props.value }
</div>
<div
className="col-xs-6 col-xs-height"
style={styles}>
{ this.props.children }
</div>
</div>);
}
return ( return (
<div className="row ascribe-detail-property"> <div className="row ascribe-detail-property">
<div className="row-same-height"> <div className="row-same-height">
<div className={this.props.labelClassName}> <div className={labelClassName}>
{ this.props.label } { this.props.separator} {label} {separator}
</div> </div>
<div <div
className={this.props.valueClassName} className={valueClassName}
style={styles}> style={styles}>
{value} {children || value}
</div> </div>
</div> </div>
</div> </div>

View File

@ -211,30 +211,13 @@ let EditionSummary = React.createClass({
value={ edition.owner } /> value={ edition.owner } />
<LicenseDetail license={edition.license_type}/> <LicenseDetail license={edition.license_type}/>
{this.getStatus()} {this.getStatus()}
<div className="row ascribe-detail-property"> <EditionDetailProperty
<div className="row-same-height"> label={getLangText('ACTIONS')}>
<div className={this.props.labelClassName}>
{ this.props.label } { this.props.separator}
</div>
<div
className={this.props.valueClassName}
style={styles}>
{value}
</div>
</div>
</div>
<div className="row">
<div className="col-xs-4 no-padding">
Actions
</div>
<div
className="col-xs-8">
<EditionActionPanel <EditionActionPanel
edition={edition} edition={edition}
currentUser={currentUser} currentUser={currentUser}
handleSuccess={this.handleSuccess} /> handleSuccess={this.handleSuccess} />
</div> </EditionDetailProperty>
</div>);
<hr/> <hr/>
</div> </div>
); );

View File

@ -190,9 +190,9 @@ let PieceContainer = React.createClass({
currentUser={this.state.currentUser} currentUser={this.state.currentUser}
handleSuccess={this.loadPiece} handleSuccess={this.loadPiece}
notifications={this.state.piece.notifications}/>); notifications={this.state.piece.notifications}/>);
} } else {
else {
return ( return (
<DetailProperty label={getLangText('ACTIONS')}>
<AclButtonList <AclButtonList
className="ascribe-button-list" className="ascribe-button-list"
availableAcls={this.state.piece.acl} availableAcls={this.state.piece.acl}
@ -212,6 +212,7 @@ let PieceContainer = React.createClass({
verbs={['acl_share', 'acl_create_editions', 'acl_loan', 'acl_delete', 'acl_consign']} verbs={['acl_share', 'acl_create_editions', 'acl_loan', 'acl_delete', 'acl_consign']}
aclObject={this.state.piece.acl}/> aclObject={this.state.piece.acl}/>
</AclButtonList> </AclButtonList>
</DetailProperty>
); );
} }
}, },

View File

@ -233,7 +233,6 @@ let LoanForm = React.createClass({
<h3>{this.props.loanHeading}</h3> <h3>{this.props.loanHeading}</h3>
</div> </div>
<AclInformation aim={'form'} verbs={['acl_loan']}/> <AclInformation aim={'form'} verbs={['acl_loan']}/>
<br></br>
<Property <Property
name='loanee' name='loanee'
label={getLangText('Loanee Email')} label={getLangText('Loanee Email')}

View File

@ -3,14 +3,12 @@
padding: .5em .5em .5em 0; padding: .5em .5em .5em 0;
p { p {
margin: .5em .5em .5em 0; margin: 0 .5em 1em 0;
line-height: 15px; line-height: 1.2;
align: justify;
} }
span { span {
font-size: 11px; font-size: 11px;
line-height: 3px;
} }
.title { .title {

View File

@ -18,7 +18,3 @@
display: table-cell; display: table-cell;
vertical-align: middle; vertical-align: middle;
} }
.ascribe-button-list {
margin-top: 1em;
}

View File

@ -4,5 +4,6 @@
&:hover, &:active, &:focus { &:hover, &:active, &:focus {
color:#424242; color:#424242;
outline: none;
} }
} }

View File

@ -158,6 +158,7 @@ hr {
} }
.ascribe-detail-property-label { .ascribe-detail-property-label {
vertical-align: top;
font-size: .8em; font-size: .8em;
} }