-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #561 from rtibbles/new_logo_new_you
Update the kolibri logo.
- Loading branch information
Showing
7 changed files
with
504 additions
and
262 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export function validateAndFormatUnits(propValue) { | ||
if (propValue) { | ||
if (!isNaN(propValue)) { | ||
return `${propValue}px`; | ||
} else { | ||
// split numbers apart from units | ||
const [, ...arr] = propValue.match(/(\d*\.?\d+)([a-zA-Z | %]*)/); | ||
const validUnits = [ | ||
'%', | ||
'cm', | ||
'em', | ||
'ex', | ||
'ch', | ||
'in', | ||
'lh', | ||
'mm', | ||
'px', | ||
'rem', | ||
'rlh', | ||
'vh', | ||
'vw', | ||
]; | ||
|
||
// if made up of valid numbers and valid units | ||
if (!isNaN(arr[0]) && validUnits.includes(arr[1])) { | ||
return propValue; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.