Skip to content

Commit

Permalink
FIX Search box css for compact size
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Dec 9, 2022
1 parent 5812418 commit 00c4a37
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/styles/bundle.css

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion client/src/components/Search/SearchBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class SearchBox extends Component {
this.getComponentWidth = this.getComponentWidth.bind(this);
this.calculateSpaceForTags = this.calculateSpaceForTags.bind(this);
this.calculateInputLeftPadding = this.calculateInputLeftPadding.bind(this);
this.calculateInputRightPadding = this.calculateInputRightPadding.bind(this);
this.onTagListResize = this.onTagListResize.bind(this);
this.focusOnLastTag = this.focusOnLastTag.bind(this);
this.focusOnInput = this.focusOnInput.bind(this);
Expand Down Expand Up @@ -90,6 +91,10 @@ class SearchBox extends Component {
return this.state.tagWidth + existingPadding;
}

calculateInputRightPadding() {
return this.state.width < 576 ? 121 : 264;
}

/**
* Calculate the max-width available for tags.
*/
Expand Down Expand Up @@ -191,7 +196,10 @@ class SearchBox extends Component {
*/
renderInput() {
const { id, searchText, onChange, placeholder, name, borders } = this.props;
const style = { paddingLeft: `${this.calculateInputLeftPadding()}px` };
const style = {
paddingLeft: `${this.calculateInputLeftPadding()}px`,
paddingRight: `${this.calculateInputRightPadding()}px`
};

const mergedBorders = Object.assign({}, SearchBox.defaultProps.borders, borders);
const classe = 'search-box__content-field';
Expand Down Expand Up @@ -268,6 +276,7 @@ class SearchBox extends Component {
'btn--icon',
'font-icon-caret-down-two',
'search-box__filter-trigger',
this.state.width < 576 ? 'search-box--no-label' : '',
{ collapsed: !expanded }
);
return (<Button
Expand Down
7 changes: 7 additions & 0 deletions client/src/components/Search/SearchBox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ $search-box-height: 53px;
&.collapsed::before {
transform: rotate(0deg) translateY(0);
}

&.search-box--no-label {
font-size: 0;
margin-right: 9px;
margin-top: 13px;
padding-right: 5px;
}
}

.search-box__hideable .search-form {
Expand Down

0 comments on commit 00c4a37

Please sign in to comment.