mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
Skeleton Component
This commit is contained in:
13
lib/to-pixels.ts
Normal file
13
lib/to-pixels.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
// Convert numbers or strings to pixel value
|
||||
// Helpful for styled-jsx when using a prop
|
||||
// height: ${toPixels(height)}; (supports height={20} and height="20px")
|
||||
|
||||
const toPixels = (value: string | number) => {
|
||||
if (typeof value === 'number') {
|
||||
return `${value}px`
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
export default toPixels
|
Reference in New Issue
Block a user