Skip to content
This repository was archived by the owner on Aug 25, 2021. It is now read-only.

Commit f798b0c

Browse files
committed
Address UX review
1 parent a851715 commit f798b0c

File tree

11 files changed

+101
-44
lines changed

11 files changed

+101
-44
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
"patternfly-react": "^1.16.4",
9898
"prop-types": "^15.6.0",
9999
"react": "^16.2.0",
100+
"react-bootstrap": "^0.32.1",
100101
"react-dom": "^16.2.0",
101102
"react-props": "0.0.3",
102103
"react-redux": "^5.0.6",

src/tagging/components/categoryModifier.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ CategoryModifier.propTypes = {
2424
};
2525

2626
CategoryModifier.defaultProps = {
27-
categoryLabel: 'Category:',
27+
categoryLabel: 'Category',
2828
};
2929

3030
export default CategoryModifier;

src/tagging/components/tag.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import styles from './tag.scss';
77
const Tag = ({
88
onTagDeleteClick, tagCategory, tagValue,
99
}) => (
10-
<li key={tagValue.id}>
10+
<li key={tagValue.id} className="tag">
1111
<Label
1212
key={tagValue.id}
1313
bsStyle="primary"

src/tagging/components/tag.scss

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
@import '~patternfly/dist/sass/patternfly/variables';
22
:export { defaultColor: $color-pf-white; }
33

4-
.remove-button {
5-
color: $color-pf-black;
6-
margin-left: 5px;
4+
.pf-remove-button {
5+
color: $color-pf-white;
6+
vertical-align: middle;
7+
}
8+
9+
.tag {
10+
font-size: 0.8em;
11+
display: table-cell !important;
12+
vertical-align:middle;
13+
span {
14+
background-color: $color-pf-blue-400;
15+
}
716
}

src/tagging/components/tagCategory.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class TagCategory extends React.Component {
1515
render() {
1616
return (
1717
<ul className="tag-category list-inline">
18-
{this.props.tagCategory.description}:
18+
<div className="category-label">{this.props.tagCategory.description}</div>
1919
{this.props.tagValues.map(tagValue => this.generateTag(tagValue))}
2020
</ul>
2121
);
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
@import '~patternfly/dist/sass/patternfly/variables';
22

33
ul.tag-category.list-inline {
4-
display: inline-block;
54
background-color: $color-pf-blue-500;
6-
padding: 5px 5px 5px 5px !important;
5+
padding: 3px 10px 3px 15px !important;
76
color: $color-pf-white;
87
margin-left: 5px;
98
margin-right: 10px;
109
margin-bottom: 5px;
10+
font-size: 14px;
11+
line-height: 24px;
12+
display: table;
13+
float: left;
1114
li a span {
1215
color: $color-pf-white;
1316
}
1417
}
18+
19+
.category-label {
20+
padding-right: 15px;
21+
}
Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import Select from 'react-select';
33
import PropTypes from 'prop-types';
4+
import './tagSelector.scss';
45

56
class TagSelector extends React.Component {
67
handleChange = (selectedOption) => {
@@ -11,28 +12,50 @@ class TagSelector extends React.Component {
1112
}
1213

1314

14-
tagCategories = this.props.tagCategories.map(category =>
15-
({ value: category.id, label: (category.description + (category.singleValue ? '*' : '')) }));
15+
tagCategories = this.props.tagCategories.map(category => ((category.singleValue &&
16+
{
17+
value: category.id,
18+
label:
19+
<div>
20+
<span>
21+
{category.description}
22+
</span>
23+
<span
24+
className="pull-right pficon pficon-info tag-icon"
25+
aria-hidden="true"
26+
title={this.props.infoText}
27+
/>
28+
<span className="sr-only">{this.props.infoText}</span>
29+
</div>,
30+
}) ||
31+
{ value: category.id, label: category.description }));
1632

1733
render() {
1834
const label = this.props.selectedOption.description;
1935
const value = this.props.selectedOption.id;
2036
return (
2137
<Select
38+
className="selected-option"
2239
name="form-field-name"
2340
value={value}
2441
label={label}
2542
onChange={this.handleChange}
2643
options={this.tagCategories}
27-
resetValue={{ label: '', value: '' }}
44+
clearable={false}
2845
/>
46+
2947
);
3048
}
3149
}
3250
TagSelector.propTypes = {
3351
tagCategories: PropTypes.arrayOf(PropTypes.object),
3452
selectedOption: PropTypes.object.isRequired,
3553
onTagCategoryChange: PropTypes.func.isRequired,
54+
infoText: PropTypes.string,
55+
};
56+
57+
TagSelector.defaultProps = {
58+
infoText: 'Only a single value can be assigned from these categories',
3659
};
3760

3861
export default TagSelector;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.selected-option {
2+
.Select-value {
3+
width: calc(100% - 20px);
4+
.pficon {
5+
line-height: 34px !important;
6+
}
7+
.Select-value-label{
8+
span:first-child {
9+
float: left;
10+
}
11+
}
12+
}
13+
}
14+
15+
.tag-icon {
16+
line-height: 18px;
17+
}

src/tagging/components/tagging.jsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ class Tagging extends React.Component {
5757
<TagView assignedTags={this.props.assignedTags} onTagDeleteClick={this.onTagDeleteClick} />
5858
</Col>
5959
</Row>
60-
<Row>
61-
<Col md={12}>
62-
<div>{this.props.infoText}</div>
63-
</Col>
64-
</Row>
6560
</Grid>
6661
);
6762
}
@@ -76,12 +71,10 @@ Tagging.propTypes = {
7671
onTagCategoryChange: PropTypes.func.isRequired,
7772
onTagValueChange: PropTypes.func.isRequired,
7873
onTagMultiValueChange: PropTypes.func,
79-
infoText: PropTypes.string,
8074
};
8175

8276
Tagging.defaultProps = {
8377
onTagMultiValueChange: () => {},
84-
infoText: '* Only a single value can be assigned from these categories',
8578
};
8679

8780
export default Tagging;

src/tagging/components/taggingWithButtons.jsx

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { Grid, Row, ButtonGroup, Button } from 'patternfly-react';
4+
import { ButtonToolbar } from 'react-bootstrap';
45
import Tagging from './tagging';
56

67
class TaggingWithButtons extends React.Component {
@@ -22,33 +23,39 @@ class TaggingWithButtons extends React.Component {
2223
selectedTagValue={this.props.selectedTagValue}
2324
/>
2425
<Row className="pull-right">
25-
<ButtonGroup>
26-
<Button
27-
onClick={this.props.cancelButton.onClick}
28-
href={this.props.cancelButton.href}
29-
disabled={this.props.cancelButton.disabled}
30-
type={this.props.cancelButton.type}
31-
>
32-
{this.props.cancelButton.description}
33-
</Button>
34-
{this.props.showReset &&
26+
<ButtonToolbar>
27+
<ButtonGroup>
3528
<Button
36-
onClick={this.props.resetButton.onClick}
37-
href={this.props.resetButton.href}
38-
disabled={this.props.resetButton.disabled}
39-
type={this.props.resetButton.type}
29+
onClick={this.props.saveButton.onClick}
30+
href={this.props.saveButton.href}
31+
disabled={this.props.saveButton.disabled}
32+
type={this.props.saveButton.type}
4033
>
41-
{this.props.resetButton.description}
42-
</Button>}
43-
<Button
44-
onClick={this.props.saveButton.onClick}
45-
href={this.props.saveButton.href}
46-
disabled={this.props.saveButton.disabled}
47-
type={this.props.saveButton.type}
48-
>
49-
{this.props.saveButton.description}
50-
</Button>
51-
</ButtonGroup>
34+
{this.props.saveButton.description}
35+
</Button>
36+
</ButtonGroup>
37+
<ButtonGroup>
38+
{this.props.showReset &&
39+
<Button
40+
onClick={this.props.resetButton.onClick}
41+
href={this.props.resetButton.href}
42+
disabled={this.props.resetButton.disabled}
43+
type={this.props.resetButton.type}
44+
>
45+
{this.props.resetButton.description}
46+
</Button>}
47+
</ButtonGroup>
48+
<ButtonGroup>
49+
<Button
50+
onClick={this.props.cancelButton.onClick}
51+
href={this.props.cancelButton.href}
52+
disabled={this.props.cancelButton.disabled}
53+
type={this.props.cancelButton.type}
54+
>
55+
{this.props.cancelButton.description}
56+
</Button>
57+
</ButtonGroup>
58+
</ButtonToolbar>
5259
</Row>
5360
</Grid>
5461
);

0 commit comments

Comments
 (0)