Skip to content

Commit

Permalink
remove margin-bottom and truncate title length to 35 chars max + add …
Browse files Browse the repository at this point in the history
…title
  • Loading branch information
Manuel Wegria committed May 24, 2024
1 parent 0c369ea commit 502a675
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
3 changes: 1 addition & 2 deletions app/assets/stylesheets/webpack/line/line.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
display: flex;
position: relative;
z-index: 1;
min-height: 2rem;
margin-bottom: 1em;
min-height: 2.5rem;

.move_up-4 {
margin-top: -12rem;
Expand Down
13 changes: 11 additions & 2 deletions app/javascript/components/Line/components/Line.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,21 @@ const ItemGroup = forwardRef((props, ref) => {
emptyCount.current = 0
}

let maxTitleLenght = 35
let groupTitle = computeGroupTitle(level, title, type, format)

console.log(groupTitle)
console.log(groupTitle.length > maxTitleLenght)
if (typeof items === 'object' && !Array.isArray(items)) {
emptyCount.current = emptyCount.current + 1
return (
<div className={`line__group level-${level}`} key={`${key} `} data-controller="toggle-display-line">
{!(type === 'num' && level === 1) && !withoutGroup && (
<div className={`line__group__title level-${level}`} style={{cursor: "pointer", zIndex: 1000}}
data-action="click->toggle-display-line#reveal">
<div dangerouslySetInnerHTML={{__html: computeGroupTitle(level, title, type, format)}}/>
<div
data-toggle={groupTitle.length > maxTitleLenght ? "tooltip" : ""} data-placement="top" title={groupTitle.length > maxTitleLenght ? groupTitle : ""}
dangerouslySetInnerHTML={{__html: groupTitle.length > maxTitleLenght ? groupTitle.substring(0, maxTitleLenght) + "..." : groupTitle}}/>
<span className="px-2" data-toggle-display-line-target="upArrow"
dangerouslySetInnerHTML={{__html: icons.up}}/>
<span className="px-2 d-none" data-toggle-display-line-target="downArrow"
Expand Down Expand Up @@ -146,7 +153,9 @@ const ItemGroup = forwardRef((props, ref) => {
{!(type === 'num' && level === 1) && !withoutGroup && (
<div className={`line__group__title level-${level}`} style={{zIndex: 10, cursor: "pointer"}}
data-action="click->toggle-display-line#reveal">
<div dangerouslySetInnerHTML={{__html: computeGroupTitle(level, title, type, format)}}/>
<div
data-toggle={groupTitle.length > maxTitleLenght ? "tooltip" : ""} data-placement="top" title={groupTitle.length > maxTitleLenght ? groupTitle : ""}
dangerouslySetInnerHTML={{__html: groupTitle.length > maxTitleLenght ? groupTitle.substring(0, maxTitleLenght) + "..." : groupTitle}}/>
<span className="px-2" data-toggle-display-line-target="upArrow"
dangerouslySetInnerHTML={{__html: icons.up}}/>
<span className="px-2 d-none" data-toggle-display-line-target="downArrow"
Expand Down

0 comments on commit 502a675

Please sign in to comment.