-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
styling and functionality improvements
- Loading branch information
Showing
14 changed files
with
265 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { modifier } from 'ember-modifier'; | ||
import numbersOnly from '../utils/numbers-only'; | ||
|
||
export default modifier(function setMaxHeight(element, [height]) { | ||
if (height === undefined || height === null) { | ||
return; | ||
} | ||
|
||
let heightValue = height; | ||
let unit = ''; | ||
|
||
// Check if height is a string with a unit | ||
if (typeof height === 'string') { | ||
const match = height.match(/^(\d+(?:\.\d+)?)(\D+)?$/); | ||
if (match !== null) { | ||
heightValue = match[1]; | ||
unit = match[2] || ''; | ||
} | ||
} | ||
|
||
// Convert the height value to pixels | ||
if (unit === 'em') { | ||
heightValue *= 16; // 1em = 16px | ||
} else if (unit === 'rem') { | ||
heightValue *= 16; // 1rem = 16px (assuming default font size of 16px) | ||
} else if (unit === 'pt') { | ||
heightValue *= 1.33; // 1pt = 1.33px (assuming 96dpi) | ||
} else if (unit === 'pc') { | ||
heightValue *= 16; // 1pc = 16px (assuming 12pt = 16px) | ||
} | ||
|
||
// Set the max height of the element by the value | ||
element.style.maxHeight = `${numbersOnly(heightValue)}px`; | ||
}); |
Oops, something went wrong.