Skip to content

Commit

Permalink
fixing the UI and triming the string
Browse files Browse the repository at this point in the history
  • Loading branch information
gandompm committed Jun 6, 2021
1 parent 11d4c3a commit 69831a4
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions frontend/src/components/productGrid/ModelDropdownComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,35 @@ const ModelDropdownComponent = (props) => {
}

if (variables.length === 1) {
return <h3>{variables[0].modelName}</h3>;
let variableName = variables[0].modelName;

return (
<Container fluid={true}>
<Row
className='w3-margin-top w3-margin-bottom:2em'
style={{ backgroundColor: theme.uniformStyle.color.secondaryBackgroundColor }}
>
<Col xs={2}>
<button
title={variableName}
className='w3-button'
style={{
color: theme.uniformStyle.color.secondaryFontColor,
backgroundColor: theme.uniformStyle.color.secondaryBackgroundColor,
fontSize: theme.typography.buttontitle.fontSize,
fontWeight: theme.typography.buttontitle.fontWeight,
lineHeight: theme.typography.buttontitle.lineHeight,
letterSpacing: theme.typography.buttontitle.letterSpacing
}}
>
{variableName.length > 25
? variableName.substring(0, 25 - 3) + '...'
: variableName}
</button>
</Col>
</Row>
</Container>
);
}

return (
Expand All @@ -43,6 +71,7 @@ const ModelDropdownComponent = (props) => {
<Col xs={2}>
<button
className='w3-button'
title={selected}
style={{
color: theme.uniformStyle.color.secondaryFontColor,
backgroundColor: theme.uniformStyle.color.secondaryBackgroundColor,
Expand All @@ -52,7 +81,7 @@ const ModelDropdownComponent = (props) => {
letterSpacing: theme.typography.buttontitle.letterSpacing
}}
>
{selected}
{selected.length > 25 ? selected.substring(0, 25 - 3) + '...' : selected}
</button>
<div
className='w3-dropdown-content w3-bar-block w3-border'
Expand Down Expand Up @@ -83,7 +112,9 @@ const ModelDropdownComponent = (props) => {
className=' w3-bar w3-button'
key={item.modelID}
>
{item.modelName}
{item.modelName.length > 35
? item.modelName.substring(0, 35 - 3) + '...'
: item.modelName}
</button>
))}
</div>
Expand Down

0 comments on commit 69831a4

Please sign in to comment.